You've already forked lazarus-ccr
Initial commit of khexeditor
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1773 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
34
applications/khexeditor/HexEditor.dpr
Normal file
34
applications/khexeditor/HexEditor.dpr
Normal file
@ -0,0 +1,34 @@
|
||||
program HexEditor;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
uses
|
||||
Forms,
|
||||
Res in 'Res.pas',
|
||||
Basic in 'Basic.pas',
|
||||
About in 'About.pas' {AboutForm},
|
||||
Search in 'Search.pas' {SearchForm},
|
||||
Replace in 'Replace.pas' {ReplaceForm},
|
||||
Options in 'Options.pas' {OptionsForm},
|
||||
ReplacePrompt in 'ReplacePrompt.pas' {ReplacePromptForm},
|
||||
Main in 'Main.pas' {MainForm},
|
||||
PrintStatus in 'PrintStatus.pas' {PrintStatusForm};
|
||||
|
||||
{$R *.res}
|
||||
{$IFDEF USE_THEMES}
|
||||
{$R xpman.res}
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF COMPILER10_UP}
|
||||
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
|
||||
{$ENDIF}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.CreateForm(TSearchForm, SearchForm);
|
||||
Application.CreateForm(TReplaceForm, ReplaceForm);
|
||||
Application.CreateForm(TAboutForm, AboutForm);
|
||||
Application.CreateForm(TOptionsForm, OptionsForm);
|
||||
Application.CreateForm(TReplacePromptForm, ReplacePromptForm);
|
||||
Application.CreateForm(TPrintStatusForm, PrintStatusForm);
|
||||
Application.Run;
|
||||
end.
|
BIN
applications/khexeditor/HexEditor.res
Normal file
BIN
applications/khexeditor/HexEditor.res
Normal file
Binary file not shown.
BIN
applications/khexeditor/XPman.res
Normal file
BIN
applications/khexeditor/XPman.res
Normal file
Binary file not shown.
52
applications/khexeditor/about.lfm
Normal file
52
applications/khexeditor/about.lfm
Normal file
@ -0,0 +1,52 @@
|
||||
object AboutForm: TAboutForm
|
||||
Left = 1395
|
||||
Height = 120
|
||||
Top = 985
|
||||
Width = 292
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'About'
|
||||
ClientHeight = 120
|
||||
ClientWidth = 292
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
object LBProductName: TLabel
|
||||
Left = 8
|
||||
Height = 20
|
||||
Top = 8
|
||||
Width = 140
|
||||
Caption = 'Hex Editor (Demo)'
|
||||
Font.Height = -16
|
||||
Font.Name = 'Arial'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object LBCopyright: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 32
|
||||
Width = 153
|
||||
Caption = 'Copyright (C) 2006 Tomas Krysl'
|
||||
ParentColor = False
|
||||
end
|
||||
object LBEmail: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 53
|
||||
Width = 106
|
||||
Caption = 'http://www.tkweb.eu'
|
||||
ParentColor = False
|
||||
end
|
||||
object BUOk: TButton
|
||||
Left = 111
|
||||
Height = 25
|
||||
Top = 84
|
||||
Width = 75
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
17
applications/khexeditor/about.lrs
Normal file
17
applications/khexeditor/about.lrs
Normal file
@ -0,0 +1,17 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TAboutForm','FORMDATA',[
|
||||
'TPF0'#10'TAboutForm'#9'AboutForm'#4'Left'#3's'#5#6'Height'#2'x'#3'Top'#3#217
|
||||
+#3#5'Width'#3'$'#1#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#5'About'#12'Cl'
|
||||
+'ientHeight'#2'x'#11'ClientWidth'#3'$'#1#11'Font.Height'#2#245#9'Font.Name'#6
|
||||
+#6'Tahoma'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#6'T'
|
||||
+'Label'#13'LBProductName'#4'Left'#2#8#6'Height'#2#20#3'Top'#2#8#5'Width'#3
|
||||
+#140#0#7'Caption'#6#17'Hex Editor (Demo)'#11'Font.Height'#2#240#9'Font.Name'
|
||||
+#6#5'Arial'#10'Font.Style'#11#6'fsBold'#0#11'ParentColor'#8#10'ParentFont'#8
|
||||
+#0#0#6'TLabel'#11'LBCopyright'#4'Left'#2#8#6'Height'#2#14#3'Top'#2' '#5'Widt'
|
||||
+'h'#3#153#0#7'Caption'#6#30'Copyright (C) 2006 Tomas Krysl'#11'ParentColor'#8
|
||||
+#0#0#6'TLabel'#7'LBEmail'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'5'#5'Width'#2
|
||||
+'j'#7'Caption'#6#19'http://www.tkweb.eu'#11'ParentColor'#8#0#0#7'TButton'#4
|
||||
+'BUOk'#4'Left'#2'o'#6'Height'#2#25#3'Top'#2'T'#5'Width'#2'K'#7'Caption'#6#2
|
||||
+'OK'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2#0#0#0#0
|
||||
]);
|
40
applications/khexeditor/about.pas
Normal file
40
applications/khexeditor/about.pas
Normal file
@ -0,0 +1,40 @@
|
||||
unit About;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
|
||||
Buttons, ExtCtrls;
|
||||
|
||||
type
|
||||
TAboutForm = class(TForm)
|
||||
BUOk: TButton;
|
||||
LBProductName: TLabel;
|
||||
LBCopyright: TLabel;
|
||||
LBEmail: TLabel;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
AboutForm: TAboutForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i about.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
||||
|
234
applications/khexeditor/basic.pas
Normal file
234
applications/khexeditor/basic.pas
Normal file
@ -0,0 +1,234 @@
|
||||
unit Basic;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
Classes, SysUtils, Graphics, StdCtrls, KHexEditor, KControls;
|
||||
|
||||
type
|
||||
TEnvironmentPacked = packed record
|
||||
Version: Byte;
|
||||
// options
|
||||
DropFiles,
|
||||
GroupUndo,
|
||||
UndoAfterSave: Boolean;
|
||||
// appearance
|
||||
ShowAddress,
|
||||
ShowDigits,
|
||||
ShowText,
|
||||
ShowHorzLines,
|
||||
ShowVertLines,
|
||||
ShowSeparators,
|
||||
ShowInactiveCaret: Boolean;
|
||||
// settings
|
||||
AddressMode,
|
||||
AddressSize,
|
||||
CharSpacing,
|
||||
DigitGrouping,
|
||||
DisabledDrawStyle,
|
||||
LineHeightPercent,
|
||||
LineSize,
|
||||
UndoLimit: Integer;
|
||||
// font
|
||||
FontSize: Integer;
|
||||
FontStyle: TFontStyles;
|
||||
end;
|
||||
|
||||
TEnvironment = record
|
||||
P: TEnvironmentPacked;
|
||||
AddressPrefix: string;
|
||||
FontName: string;
|
||||
end;
|
||||
|
||||
PEnvironment = ^TEnvironment;
|
||||
|
||||
var
|
||||
Environment: TEnvironment;
|
||||
Colors: TKColorArray;
|
||||
|
||||
AppName: string;
|
||||
IniPath: string;
|
||||
IniVersion: Integer;
|
||||
|
||||
const
|
||||
secSettings = 'Settings';
|
||||
secMRUFs = 'MRUFs';
|
||||
secColors = 'Custom colors';
|
||||
|
||||
procedure DataToString(Buffer: Pointer; Size: Integer; var S: string);
|
||||
procedure StringToData(const S: string; Buffer: Pointer; Size: Integer);
|
||||
|
||||
function Modified2Text(Modified: Boolean): string;
|
||||
function InsertMode2Text(Mode: Boolean): string;
|
||||
|
||||
procedure AddFontsToList(DC: HDC; L: TStrings; Pitch: TFontPitch);
|
||||
function EditStrToInt(Handle: HWND; Edit: TEdit; AMin, AMax, Default: Integer; var Ok: Boolean): Integer;
|
||||
|
||||
procedure InitEnvironment(var Data: TEnvironment);
|
||||
|
||||
procedure InitColors(var Colors: TKColorArray);
|
||||
procedure CopyColors(Src, Dest: TKColorArray);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, Res, Forms;
|
||||
|
||||
type
|
||||
PEnumFontData = ^TEnumFontData;
|
||||
TEnumFontData = record
|
||||
List: TStrings;
|
||||
Pitch: TFontPitch;
|
||||
end;
|
||||
|
||||
procedure DataToString(Buffer: Pointer; Size: Integer; var S: string);
|
||||
var
|
||||
I: Integer;
|
||||
T: string;
|
||||
begin
|
||||
SetLength(S, Size * 2);
|
||||
for I := 1 to Size do
|
||||
begin
|
||||
T := Format('%.2x' , [PByteArray(Buffer)^[I - 1]]);
|
||||
S[I * 2 - 1] := T[1];
|
||||
S[I * 2] := T[2];
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure StringToData(const S: string; Buffer: Pointer; Size: Integer);
|
||||
var
|
||||
I, Code: Integer;
|
||||
T: string;
|
||||
begin
|
||||
T := '$00';
|
||||
for I := 1 to Min(Size, Length(S) div 2) do
|
||||
begin
|
||||
T[2] := S[I * 2 - 1];
|
||||
T[3] := S[I * 2];
|
||||
Val(T, PByteArray(Buffer)^[I - 1], Code);
|
||||
end;
|
||||
end;
|
||||
|
||||
function EditStrToInt(Handle: HWND; Edit: TEdit; AMin, AMax, Default: Integer; var Ok: Boolean): Integer;
|
||||
var
|
||||
I, Code: Integer;
|
||||
S: string;
|
||||
begin
|
||||
Result := Default;
|
||||
if Ok then
|
||||
begin
|
||||
Val(Edit.Text, I, Code);
|
||||
if Code > 0 then
|
||||
S := sErrIntegerValue
|
||||
else if (I < AMin) or (I > AMax) then
|
||||
S := Format(sErrIntegerValueOutOfRange, [AMin, AMax])
|
||||
else
|
||||
S := '';
|
||||
if S <> '' then
|
||||
begin
|
||||
MessageBox(Handle, PChar(S), PChar(sAppName), MB_OK);
|
||||
Ok := False;
|
||||
// Edit.Text := IntToStr(Default);
|
||||
if Edit.CanFocus then
|
||||
try
|
||||
GetParentForm(Edit).ActiveControl := Edit;
|
||||
except
|
||||
end;
|
||||
end else
|
||||
Result := I;
|
||||
end;
|
||||
end;
|
||||
|
||||
function Modified2Text(Modified: Boolean): string;
|
||||
begin
|
||||
if Modified then Result := sModified else Result := '';
|
||||
end;
|
||||
|
||||
function InsertMode2Text(Mode: Boolean): string;
|
||||
begin
|
||||
if Mode then Result := sInsert else Result := sOverWrite;
|
||||
end;
|
||||
|
||||
function EnumFontFamProc(var LFData: TEnumLogFont; var PFData: TNewTextMetric;
|
||||
FontType: Integer; Data: PEnumFontData): Integer; stdcall;
|
||||
begin
|
||||
if Data.Pitch = fpFixed then
|
||||
begin
|
||||
if LFData.elfLogFont.lfPitchAndFamily and 1 = 1 then
|
||||
Data.List.Add(LFData.elfLogFont.lfFaceName);
|
||||
end else
|
||||
Data.List.Add(LFData.elfLogFont.lfFaceName);
|
||||
Result := 1;
|
||||
end;
|
||||
|
||||
procedure AddFontsToList(DC: HDC; L: TStrings; Pitch: TFontPitch);
|
||||
var
|
||||
Data: TEnumFontData;
|
||||
begin
|
||||
Data.List := L;
|
||||
Data.Pitch := Pitch;
|
||||
EnumFontFamilies(DC, nil, @EnumFontFamProc, Integer(@Data));
|
||||
end;
|
||||
|
||||
procedure InitEnvironment(var Data: TEnvironment);
|
||||
begin
|
||||
with Data.P do
|
||||
begin
|
||||
Version := IniVersion;
|
||||
DropFiles := True;
|
||||
GroupUndo := True;
|
||||
UndoAfterSave := False;
|
||||
ShowAddress := True;
|
||||
ShowDigits := True;
|
||||
ShowText := True;
|
||||
ShowHorzLines := False;
|
||||
ShowVertLines := False;
|
||||
ShowSeparators := True;
|
||||
ShowInactiveCaret := True;
|
||||
DisabledDrawStyle := Integer(cDisabledDrawStyleDef);
|
||||
AddressMode := Integer(cAddressModeDef);
|
||||
AddressSize := cAddressSizeDef;
|
||||
CharSpacing := cCharSpacingDef;
|
||||
LineSize := cLineSizeDef;
|
||||
DigitGrouping := cDigitGroupingDef;
|
||||
LineHeightPercent := cLineHeightPercentDef;
|
||||
UndoLimit := cUndoLimitDef;
|
||||
FontSize := cFontSizeDef;
|
||||
FontStyle := cFontStyleDef;
|
||||
end;
|
||||
with Data do
|
||||
begin
|
||||
AddressPrefix := cAddressPrefixDef;
|
||||
FontName := cFontNameDef;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure InitColors(var Colors: TKColorArray);
|
||||
var
|
||||
I: TKHexEditorColorIndex;
|
||||
begin
|
||||
SetLength(Colors, ciHexEditorColorsMax + 1);
|
||||
for I := 0 to Length(Colors) - 1 do
|
||||
Colors[I] := GetColorSpec(I).Def;
|
||||
end;
|
||||
|
||||
procedure CopyColors(Src, Dest: TKColorArray);
|
||||
var
|
||||
I: TKHexEditorColorIndex;
|
||||
begin
|
||||
for I := 0 to Min(Length(Src), Length(Dest)) - 1 do
|
||||
Dest[I] := Src[I];
|
||||
end;
|
||||
|
||||
initialization
|
||||
AppName := 'Hex Editor (Demo)';
|
||||
IniPath := ExtractFilePath(Application.ExeName) + 'hexeditor.ini';
|
||||
IniVersion := 103
|
||||
end.
|
534
applications/khexeditor/hexeditorlaz.lpi
Normal file
534
applications/khexeditor/hexeditorlaz.lpi
Normal file
@ -0,0 +1,534 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="7"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="Printer4Lazarus"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="40">
|
||||
<Unit0>
|
||||
<Filename Value="hexeditorlaz.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="17" Y="19"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="about.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="AboutForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="About"/>
|
||||
<CursorPos X="12" Y="38"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Main"/>
|
||||
<CursorPos X="21" Y="905"/>
|
||||
<TopLine Value="862"/>
|
||||
<EditorIndex Value="15"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="options.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="OptionsForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Options"/>
|
||||
<CursorPos X="7" Y="229"/>
|
||||
<TopLine Value="208"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="printstatus.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="PrintStatusForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="PrintStatus"/>
|
||||
<CursorPos X="22" Y="15"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="17"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="replace.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="ReplaceForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Replace"/>
|
||||
<CursorPos X="11" Y="3"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="replaceprompt.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="ReplacePromptForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="ReplacePrompt"/>
|
||||
<CursorPos X="45" Y="2"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="14"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="res.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Res"/>
|
||||
<CursorPos X="32" Y="17"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="search.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="SearchForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Search"/>
|
||||
<CursorPos X="87" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="53"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="basic.pas"/>
|
||||
<UnitName Value="Basic"/>
|
||||
<CursorPos X="55" Y="70"/>
|
||||
<TopLine Value="52"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="..\..\source\kprintpreview.pas"/>
|
||||
<ComponentName Value="KPrintPreviewForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="KPrintPreview"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<UnitName Value="KHexEditor"/>
|
||||
<CursorPos X="15" Y="4879"/>
|
||||
<TopLine Value="4879"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\..\source\kgrids.pas"/>
|
||||
<UnitName Value="KGrids"/>
|
||||
<CursorPos X="19" Y="9092"/>
|
||||
<TopLine Value="9081"/>
|
||||
<EditorIndex Value="13"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="..\..\source\kdbgrids.pas"/>
|
||||
<UnitName Value="KDBGrids"/>
|
||||
<CursorPos X="26" Y="470"/>
|
||||
<TopLine Value="442"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="..\..\source\kcontrols.pas"/>
|
||||
<UnitName Value="KControls"/>
|
||||
<CursorPos X="29" Y="1596"/>
|
||||
<TopLine Value="1555"/>
|
||||
<EditorIndex Value="12"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="..\..\source\kdialogs.pas"/>
|
||||
<UnitName Value="KDialogs"/>
|
||||
<CursorPos X="59" Y="28"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="..\..\source\kprintsetup.pas"/>
|
||||
<ComponentName Value="KPrintSetupForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="KPrintSetup"/>
|
||||
<CursorPos X="76" Y="13"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="16"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="..\kdbgrid\kdbgriddemolaz.lpr"/>
|
||||
<UnitName Value="kdbgriddemolaz"/>
|
||||
<CursorPos X="27" Y="4"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="..\..\source\kcontrols.inc"/>
|
||||
<CursorPos X="39" Y="35"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\printers.pas"/>
|
||||
<UnitName Value="Printers"/>
|
||||
<CursorPos X="1" Y="583"/>
|
||||
<TopLine Value="561"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\include\customaction.inc"/>
|
||||
<CursorPos X="1" Y="137"/>
|
||||
<TopLine Value="115"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\include\control.inc"/>
|
||||
<CursorPos X="1" Y="1253"/>
|
||||
<TopLine Value="1231"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\clipbrd.pp"/>
|
||||
<UnitName Value="Clipbrd"/>
|
||||
<CursorPos X="16" Y="254"/>
|
||||
<TopLine Value="242"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\include\clipbrd.inc"/>
|
||||
<CursorPos X="1" Y="746"/>
|
||||
<TopLine Value="724"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\include\lclintf.inc"/>
|
||||
<CursorPos X="1" Y="86"/>
|
||||
<TopLine Value="64"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\interfaces\gtk\gtkwinapi.inc"/>
|
||||
<CursorPos X="1" Y="568"/>
|
||||
<TopLine Value="546"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\components\printers\unix\cupsdyn.pp"/>
|
||||
<UnitName Value="cupsdyn"/>
|
||||
<CursorPos X="14" Y="1389"/>
|
||||
<TopLine Value="1358"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit26>
|
||||
<Unit27>
|
||||
<Filename Value="..\..\..\..\..\usr\lib\lazarus\0.9.29\lcl\include\statuspanels.inc"/>
|
||||
<CursorPos X="1" Y="35"/>
|
||||
<TopLine Value="10"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
<Filename Value="C:\lazarusSVN\lcl\lmessages.pp"/>
|
||||
<UnitName Value="LMessages"/>
|
||||
<CursorPos X="113" Y="22"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit28>
|
||||
<Unit29>
|
||||
<Filename Value="C:\lazarusSVN\lcl\include\control.inc"/>
|
||||
<CursorPos X="1" Y="1637"/>
|
||||
<TopLine Value="1609"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit29>
|
||||
<Unit30>
|
||||
<Filename Value="C:\lazarusSVN\lcl\include\wincontrol.inc"/>
|
||||
<CursorPos X="1" Y="5036"/>
|
||||
<TopLine Value="5008"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit30>
|
||||
<Unit31>
|
||||
<Filename Value="C:\lazarusSVN\lcl\lclmessageglue.pas"/>
|
||||
<UnitName Value="LCLMessageGlue"/>
|
||||
<CursorPos X="1" Y="121"/>
|
||||
<TopLine Value="93"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit31>
|
||||
<Unit32>
|
||||
<Filename Value="C:\lazarusSVN\lcl\interfaces\win32\win32callback.inc"/>
|
||||
<CursorPos X="25" Y="1141"/>
|
||||
<TopLine Value="1115"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit32>
|
||||
<Unit33>
|
||||
<Filename Value="C:\lazarusSVN\lcl\include\application.inc"/>
|
||||
<CursorPos X="1" Y="1801"/>
|
||||
<TopLine Value="1773"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit33>
|
||||
<Unit34>
|
||||
<Filename Value="C:\lazarusSVN\lcl\forms.pp"/>
|
||||
<UnitName Value="Forms"/>
|
||||
<CursorPos X="82" Y="383"/>
|
||||
<TopLine Value="355"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit34>
|
||||
<Unit35>
|
||||
<Filename Value="C:\lazarusSVN\lcl\include\canvas.inc"/>
|
||||
<CursorPos X="1" Y="1460"/>
|
||||
<TopLine Value="1432"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit35>
|
||||
<Unit36>
|
||||
<Filename Value="C:\lazarusSVN\lcl\include\winapi.inc"/>
|
||||
<CursorPos X="1" Y="865"/>
|
||||
<TopLine Value="837"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit36>
|
||||
<Unit37>
|
||||
<Filename Value="C:\lazarusSVN\lcl\interfaces\gtk\gtkwinapi.inc"/>
|
||||
<CursorPos X="1" Y="9267"/>
|
||||
<TopLine Value="9239"/>
|
||||
<UsageCount Value="22"/>
|
||||
</Unit37>
|
||||
<Unit38>
|
||||
<Filename Value="..\..\source\kfunctions.pas"/>
|
||||
<UnitName Value="KFunctions"/>
|
||||
<CursorPos X="47" Y="88"/>
|
||||
<TopLine Value="59"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit38>
|
||||
<Unit39>
|
||||
<Filename Value="..\..\source\kgraphics.pas"/>
|
||||
<UnitName Value="KGraphics"/>
|
||||
<CursorPos X="20" Y="970"/>
|
||||
<TopLine Value="940"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit39>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3691" Column="1" TopLine="3663"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="4015" Column="1" TopLine="3987"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3689" Column="1" TopLine="3661"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3690" Column="1" TopLine="3662"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3691" Column="1" TopLine="3663"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="4015" Column="1" TopLine="3987"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3689" Column="1" TopLine="3661"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3690" Column="1" TopLine="3662"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3691" Column="1" TopLine="3663"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="4015" Column="1" TopLine="3987"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3689" Column="1" TopLine="3661"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3690" Column="1" TopLine="3662"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3691" Column="1" TopLine="3663"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="4015" Column="1" TopLine="3987"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3689" Column="1" TopLine="3661"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3690" Column="1" TopLine="3662"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3691" Column="1" TopLine="3663"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="4015" Column="1" TopLine="3987"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="3686" Column="29" TopLine="3648"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\..\source\KGrids.pas"/>
|
||||
<Caret Line="8949" Column="72" TopLine="8927"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\..\source\KGrids.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\..\source\KGrids.pas"/>
|
||||
<Caret Line="4758" Column="40" TopLine="4730"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="hexeditorlaz.lpr"/>
|
||||
<Caret Line="5" Column="20" TopLine="1"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\..\source\kcontrols.pas"/>
|
||||
<Caret Line="23" Column="14" TopLine="1"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="hexeditorlaz.lpr"/>
|
||||
<Caret Line="29" Column="37" TopLine="1"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\..\source\kfunctions.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\..\source\kfunctions.pas"/>
|
||||
<Caret Line="1207" Column="1" TopLine="1181"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="..\..\source\kgraphics.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="..\..\source\khexeditor.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="hexeditorlaz.lpr"/>
|
||||
<Caret Line="16" Column="18" TopLine="1"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="8"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="..\..\source\;$(ProjOutDir)\"/>
|
||||
<OtherUnitFiles Value="..\..\source\"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
<LCLWidgetType Value="win32"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<Verbosity>
|
||||
<ShowHints Value="False"/>
|
||||
</Verbosity>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
29
applications/khexeditor/hexeditorlaz.lpr
Normal file
29
applications/khexeditor/hexeditorlaz.lpr
Normal file
@ -0,0 +1,29 @@
|
||||
program hexeditorlaz;
|
||||
|
||||
uses
|
||||
Interfaces,
|
||||
Forms, LResources, Printer4Lazarus,
|
||||
Res in 'Res.pas',
|
||||
Basic in 'Basic.pas',
|
||||
About in 'About.pas' {AboutForm},
|
||||
Search in 'Search.pas' {SearchForm},
|
||||
Replace in 'Replace.pas' {ReplaceForm},
|
||||
Options in 'Options.pas' {OptionsForm},
|
||||
ReplacePrompt in 'ReplacePrompt.pas' {ReplacePromptForm},
|
||||
Main in 'Main.pas' {MainForm},
|
||||
PrintStatus in 'PrintStatus.pas';
|
||||
|
||||
{$IFDEF WINDOWS}{$R hexeditorlaz.rc}{$ENDIF}
|
||||
|
||||
begin
|
||||
{$I hexeditorlaz.lrs}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.CreateForm(TSearchForm, SearchForm);
|
||||
Application.CreateForm(TReplaceForm, ReplaceForm);
|
||||
Application.CreateForm(TAboutForm, AboutForm);
|
||||
Application.CreateForm(TOptionsForm, OptionsForm);
|
||||
Application.CreateForm(TReplacePromptForm, ReplacePromptForm);
|
||||
Application.CreateForm(TPrintStatusForm, PrintStatusForm);
|
||||
Application.Run;
|
||||
end.
|
5237
applications/khexeditor/hexeditorlaz.lrs
Normal file
5237
applications/khexeditor/hexeditorlaz.lrs
Normal file
File diff suppressed because it is too large
Load Diff
1923
applications/khexeditor/main.lfm
Normal file
1923
applications/khexeditor/main.lfm
Normal file
File diff suppressed because it is too large
Load Diff
1879
applications/khexeditor/main.lrs
Normal file
1879
applications/khexeditor/main.lrs
Normal file
File diff suppressed because it is too large
Load Diff
918
applications/khexeditor/main.pas
Normal file
918
applications/khexeditor/main.pas
Normal file
@ -0,0 +1,918 @@
|
||||
unit Main;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
ActnList, ComCtrls, StdCtrls, Menus, ToolWin, ExtCtrls, ImgList,
|
||||
KEditCommon, KHexEditor, KControls, KDialogs;
|
||||
|
||||
|
||||
type
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
MainMenu: TMainMenu;
|
||||
MGFile: TMenuItem;
|
||||
MINew: TMenuItem;
|
||||
MIOpen: TMenuItem;
|
||||
MISave: TMenuItem;
|
||||
MISaveAs: TMenuItem;
|
||||
MIClose: TMenuItem;
|
||||
MIExit: TMenuItem;
|
||||
N1: TMenuItem;
|
||||
StatusBar: TStatusBar;
|
||||
ALFile: TActionList;
|
||||
ACNew: TAction;
|
||||
ACOpen: TAction;
|
||||
ACSave: TAction;
|
||||
ACSaveAs: TAction;
|
||||
ACClose: TAction;
|
||||
ACExit: TAction;
|
||||
ODMain: TOpenDialog;
|
||||
SDMain: TSaveDialog;
|
||||
ACStatusBar: TAction;
|
||||
ALEdit: TActionList;
|
||||
ACUndo: TAction;
|
||||
ACRedo: TAction;
|
||||
ACCut: TAction;
|
||||
ACCopy: TAction;
|
||||
ACPaste: TAction;
|
||||
ACDelete: TAction;
|
||||
ACSelectAll: TAction;
|
||||
MGEdit: TMenuItem;
|
||||
MIUndo: TMenuItem;
|
||||
MIRedo: TMenuItem;
|
||||
N2: TMenuItem;
|
||||
MICut: TMenuItem;
|
||||
MICopy: TMenuItem;
|
||||
MIPaste: TMenuItem;
|
||||
MIDelete: TMenuItem;
|
||||
N3: TMenuItem;
|
||||
MISelectAll: TMenuItem;
|
||||
MGSearch: TMenuItem;
|
||||
MGOptions: TMenuItem;
|
||||
MISearch: TMenuItem;
|
||||
MIReplace: TMenuItem;
|
||||
MISearchAgain: TMenuItem;
|
||||
MIOptions: TMenuItem;
|
||||
MGHelp: TMenuItem;
|
||||
MIAbout: TMenuItem;
|
||||
ALSearch: TActionList;
|
||||
ACSearch: TAction;
|
||||
ACReplace: TAction;
|
||||
ACSearchAgain: TAction;
|
||||
ACEditorOptions: TAction;
|
||||
MIMRUFEnd: TMenuItem;
|
||||
MIMRUF1: TMenuItem;
|
||||
MIMRUF2: TMenuItem;
|
||||
MIMRUF3: TMenuItem;
|
||||
MIMRUF4: TMenuItem;
|
||||
MIMRUF5: TMenuItem;
|
||||
PMMRUFs: TPopupMenu;
|
||||
PMIMRUF1: TMenuItem;
|
||||
PMIMRUF2: TMenuItem;
|
||||
PMIMRUF3: TMenuItem;
|
||||
PMIMRUF4: TMenuItem;
|
||||
PMIMRUF5: TMenuItem;
|
||||
MIPrint: TMenuItem;
|
||||
PMMain: TPopupMenu;
|
||||
PMIUndo: TMenuItem;
|
||||
PMIRedo: TMenuItem;
|
||||
N6: TMenuItem;
|
||||
PMICut: TMenuItem;
|
||||
PMICopy: TMenuItem;
|
||||
PMIPaste: TMenuItem;
|
||||
PMIDelete: TMenuItem;
|
||||
PMISelectAll: TMenuItem;
|
||||
N7: TMenuItem;
|
||||
N8: TMenuItem;
|
||||
ACPrint: TAction;
|
||||
ACViewToolBar: TAction;
|
||||
MIViewToolBar: TMenuItem;
|
||||
PNMain: TPanel;
|
||||
N11: TMenuItem;
|
||||
MIMRUFStart: TMenuItem;
|
||||
PMIEnvProps: TMenuItem;
|
||||
ACEnabledEditor: TAction;
|
||||
ACReadOnlyEditor: TAction;
|
||||
EnabledEditor1: TMenuItem;
|
||||
Close1: TMenuItem;
|
||||
ILMain: TImageList;
|
||||
Editor: TKHexEditor;
|
||||
ACPreview: TAction;
|
||||
MIPreview: TMenuItem;
|
||||
PSDMain: TKPrintSetupDialog;
|
||||
PPDMain: TKPrintPreviewDialog;
|
||||
ToBMain: TToolBar;
|
||||
TBNew: TToolButton;
|
||||
TBOpen: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBPreview: TToolButton;
|
||||
TBPrint: TToolButton;
|
||||
TBSep1: TToolButton;
|
||||
TBCut: TToolButton;
|
||||
TBCopy: TToolButton;
|
||||
TBPaste: TToolButton;
|
||||
TBDelete: TToolButton;
|
||||
TBSep2: TToolButton;
|
||||
TBUndo: TToolButton;
|
||||
TBRedo: TToolButton;
|
||||
TBSep3: TToolButton;
|
||||
TBFind: TToolButton;
|
||||
TBReplace: TToolButton;
|
||||
TBSearchAgain: TToolButton;
|
||||
TBSep4: TToolButton;
|
||||
TBEnvProps: TToolButton;
|
||||
ILMainDis: TImageList;
|
||||
procedure EditorReplaceText(Sender: TObject; const TextToFind,
|
||||
TextToReplace: string; var Action: TKEditReplaceAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ACNewExecute(Sender: TObject);
|
||||
procedure ACEnabledUpdate(Sender: TObject);
|
||||
procedure ACOpenExecute(Sender: TObject);
|
||||
procedure ACSaveExecute(Sender: TObject);
|
||||
procedure ACSaveUpdate(Sender: TObject);
|
||||
procedure ACSaveAsExecute(Sender: TObject);
|
||||
procedure ACCloseExecute(Sender: TObject);
|
||||
procedure ACExitExecute(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
procedure ACStatusBarUpdate(Sender: TObject);
|
||||
procedure ACUndoExecute(Sender: TObject);
|
||||
procedure ACUndoUpdate(Sender: TObject);
|
||||
procedure ACRedoExecute(Sender: TObject);
|
||||
procedure ACRedoUpdate(Sender: TObject);
|
||||
procedure ACCutExecute(Sender: TObject);
|
||||
procedure ACCutUpdate(Sender: TObject);
|
||||
procedure ACCopyExecute(Sender: TObject);
|
||||
procedure ACPasteExecute(Sender: TObject);
|
||||
procedure ACPasteUpdate(Sender: TObject);
|
||||
procedure ACDeleteExecute(Sender: TObject);
|
||||
procedure ACSelectAllExecute(Sender: TObject);
|
||||
procedure ACSelectAllUpdate(Sender: TObject);
|
||||
procedure ACSearchExecute(Sender: TObject);
|
||||
procedure ACSearchAgainExecute(Sender: TObject);
|
||||
procedure ACSearchAgainUpdate(Sender: TObject);
|
||||
procedure ACSearchUpdate(Sender: TObject);
|
||||
procedure ACReplaceExecute(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure ACEditorOptionsExecute(Sender: TObject);
|
||||
procedure ACPrintExecute(Sender: TObject);
|
||||
procedure ACPrintUpdate(Sender: TObject);
|
||||
procedure MIAboutClick(Sender: TObject);
|
||||
procedure ACViewToolBarExecute(Sender: TObject);
|
||||
procedure ACSaveAsUpdate(Sender: TObject);
|
||||
procedure ACCloseUpdate(Sender: TObject);
|
||||
procedure ACCopyUpdate(Sender: TObject);
|
||||
procedure ACDeleteUpdate(Sender: TObject);
|
||||
procedure ACReplaceUpdate(Sender: TObject);
|
||||
procedure EditorDropFiles(Sender: TObject; X, Y: Integer;
|
||||
Files: TStrings);
|
||||
procedure ACEnabledEditorExecute(Sender: TObject);
|
||||
procedure ACEnabledEditorUpdate(Sender: TObject);
|
||||
procedure ACReadOnlyEditorExecute(Sender: TObject);
|
||||
procedure ACReadOnlyEditorUpdate(Sender: TObject);
|
||||
procedure ACViewToolBarUpdate(Sender: TObject);
|
||||
procedure EditorPrintNotify(Sender: TObject; Status: TKPrintStatus;
|
||||
var Abort: Boolean);
|
||||
procedure EditorPrintPaint(Sender: TObject);
|
||||
procedure ACPreviewExecute(Sender: TObject);
|
||||
procedure ACPreviewUpdate(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
FMRUFList: TStringList;
|
||||
FLastFileName: string;
|
||||
IsNew: Boolean;
|
||||
SearchData: TKEditSearchData;
|
||||
SearchAgainEnabled: Boolean;
|
||||
LastSearchCommand: TKEditCommand;
|
||||
TextToFind, TextToReplace: string;
|
||||
procedure AddMRUF(const FileName: string);
|
||||
procedure DeleteMRUF(const FileName: string);
|
||||
procedure DeleteMRUFs;
|
||||
procedure MRUFClick(Sender: TObject);
|
||||
procedure UpdateMRUFs;
|
||||
procedure LoadFromIni;
|
||||
procedure SaveToIni;
|
||||
procedure EnvironmentChanged;
|
||||
procedure CloseFile;
|
||||
procedure NewFile;
|
||||
procedure OpenFile(FileName: string);
|
||||
function SaveFile(SaveAs, NeedAnotherOp: Boolean): Boolean;
|
||||
procedure Search(Command: TKEditCommand);
|
||||
procedure HandleSearchError;
|
||||
{$IFDEF FPC}
|
||||
procedure LazDropFiles(Sender: TObject; const FileNames: Array of String);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
IniFiles, Res, Basic, About, Options, KFunctions,
|
||||
Replace, ReplacePrompt, Search, PrintStatus, ClipBrd;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Application.Title := AppName;
|
||||
{$IFDEF FPC}
|
||||
Application.OnDropFiles := LazDropFiles;
|
||||
{$ENDIF}
|
||||
Caption := AppName;
|
||||
FLastFileName := '';
|
||||
SDMain.Filter := ODMain.Filter;
|
||||
FMRUFList := TStringList.Create;
|
||||
InitEnvironment(Environment);
|
||||
InitColors(Colors);
|
||||
SearchData := DefaultSearchData;
|
||||
LoadFromIni;
|
||||
EnvironmentChanged;
|
||||
UpdateMRUFs;
|
||||
SearchAgainEnabled := False;
|
||||
if ParamCount > 0 then
|
||||
FLastFileName := ParamStr(1);
|
||||
if FLastFileName <> '' then
|
||||
OpenFile(FLastFileName)
|
||||
else
|
||||
NewFile;
|
||||
//Editor.AddressOffset := 16384;
|
||||
Editor.AreaSpacing := 1;
|
||||
Editor.DoubleBuffered := True;
|
||||
//define 1 cm space for custom header
|
||||
Editor.PageSetup.HeaderSpace := 1; //cm by default
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
SaveToIni;
|
||||
CloseFile;
|
||||
FMRUFList.Free;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := SaveFile(False, True);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACNewExecute(Sender: TObject);
|
||||
begin
|
||||
NewFile;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACEnabledUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := True;
|
||||
StatusBar.Panels[4].Text := Application.Hint;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACOpenExecute(Sender: TObject);
|
||||
begin
|
||||
OpenFile('');
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSaveExecute(Sender: TObject);
|
||||
begin
|
||||
SaveFile(False, False);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSaveUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.Visible and Editor.Modified;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSaveAsExecute(Sender: TObject);
|
||||
begin
|
||||
SaveFile(True, False);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSaveAsUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.Visible;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACCloseExecute(Sender: TObject);
|
||||
begin
|
||||
if SaveFile(False, True) then
|
||||
CloseFile;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACCloseUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.Visible;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACPreviewExecute(Sender: TObject);
|
||||
begin
|
||||
PPDMain.Show;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACPreviewUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACPrintExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.PageSetup.Title := FLastFileName;
|
||||
PSDMain.SelAvail := Editor.SelAvail;
|
||||
PSDMain.Execute;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACPrintUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CanPrint;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACExitExecute(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACStatusBarUpdate(Sender: TObject);
|
||||
var
|
||||
I: Integer;
|
||||
S: string;
|
||||
begin
|
||||
with StatusBar do
|
||||
begin
|
||||
if Editor.Visible then
|
||||
begin
|
||||
if Editor.AddressMode = eamDec then S := sStatusPosDec else S := sStatusPosHex;
|
||||
Panels[0].Text := Format(S, [Editor.SelEnd.Index]);
|
||||
Panels[1].Text := Format(sStatusDigit, [Editor.SelEnd.Digit]);
|
||||
Panels[2].Text := Modified2Text(Editor.Modified);
|
||||
Panels[3].Text := InsertMode2Text(Editor.InsertMode);
|
||||
end else
|
||||
for I := 0 to 3 do Panels[I].Text := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACUndoExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecUndo);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACUndoUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecUndo);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACRedoExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecRedo);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACRedoUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecRedo);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACCutExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecCut);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACCutUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecCut);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACCopyExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecCopy);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACCopyUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecCopy);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACPasteExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecPaste);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACPasteUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecPaste);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACDeleteExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecClearSelection);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACDeleteUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecClearSelection);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSelectAllExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(ecSelectAll);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSelectAllUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecSelectAll);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSearchExecute(Sender: TObject);
|
||||
begin
|
||||
Search(ecSearch);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSearchUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecSearch);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACReplaceExecute(Sender: TObject);
|
||||
begin
|
||||
Search(ecReplace);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACReplaceUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := Editor.CommandEnabled(ecReplace);
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSearchAgainExecute(Sender: TObject);
|
||||
begin
|
||||
Editor.ExecuteCommand(LastSearchCommand, @SearchData);
|
||||
HandleSearchError;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACSearchAgainUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Enabled := SearchAgainEnabled;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACEditorOptionsExecute(Sender: TObject);
|
||||
begin
|
||||
OptionsForm.SetData(Environment, Colors);
|
||||
if OptionsForm.ShowModal = mrOk then
|
||||
begin
|
||||
OptionsForm.GetData(Environment, Colors);
|
||||
EnvironmentChanged;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACViewToolBarExecute(Sender: TObject);
|
||||
begin
|
||||
ACViewToolBar.Checked := not ACViewToolBar.Checked;
|
||||
ToBMain.Visible := ACViewToolBar.Checked;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACViewToolBarUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Checked := ToBMain.Visible;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACEnabledEditorExecute(Sender: TObject);
|
||||
begin
|
||||
ACEnabledEditor.Checked := not ACEnabledEditor.Checked;
|
||||
Editor.Enabled := ACEnabledEditor.Checked;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACEnabledEditorUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Checked := Editor.Enabled;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACReadOnlyEditorExecute(Sender: TObject);
|
||||
begin
|
||||
ACReadOnlyEditor.Checked := not ACReadOnlyEditor.Checked;
|
||||
Editor.ReadOnly := ACReadOnlyEditor.Checked;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ACReadOnlyEditorUpdate(Sender: TObject);
|
||||
begin
|
||||
TAction(Sender).Checked := Editor.ReadOnly;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MIAboutClick(Sender: TObject);
|
||||
begin
|
||||
AboutForm.ShowModal;
|
||||
end;
|
||||
|
||||
procedure TMainForm.AddMRUF(const FileName: string);
|
||||
begin
|
||||
if FileName <> '' then
|
||||
try
|
||||
if FMRUFList.IndexOf(FileName) < 0 then
|
||||
FMRUFList.Insert(0, FileName);
|
||||
UpdateMRUFs;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.DeleteMRUF(const FileName: string);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
if FileName <> '' then
|
||||
try
|
||||
I := FMRUFList.IndexOf(FileName);
|
||||
if I >= 0 then FMRUFList.Delete(I);
|
||||
UpdateMRUFs;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.DeleteMRUFs;
|
||||
begin
|
||||
try
|
||||
FMRUFList.Clear;
|
||||
UpdateMRUFs;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MRUFClick(Sender: TObject);
|
||||
var
|
||||
S: string;
|
||||
begin
|
||||
S := TMenuItem(Sender).Caption;
|
||||
Delete(S, 1, 3);
|
||||
if S <> '' then
|
||||
OpenFile(S);
|
||||
end;
|
||||
|
||||
procedure TMainForm.UpdateMRUFs;
|
||||
var
|
||||
I, Index: Integer;
|
||||
MI, PMI: TMenuItem;
|
||||
S: string;
|
||||
B: Boolean;
|
||||
begin
|
||||
B := False;
|
||||
Index := MGFile.IndexOf(MIMRUF1);
|
||||
for I := 0 to 4 do
|
||||
begin
|
||||
MI := MGFile.Items[I + Index];
|
||||
PMI := PMMRUFs.Items[I];
|
||||
if I < FMRUFList.Count then
|
||||
begin
|
||||
S := Format('&%d %s', [I + 1, FMRUFList[I]]);
|
||||
MI.Visible := True;
|
||||
PMI.Visible := True;
|
||||
MI.Caption := S;
|
||||
PMI.Caption := S;
|
||||
MI.OnClick := MRUFClick;
|
||||
PMI.OnClick := MRUFClick;
|
||||
B := True;
|
||||
end else
|
||||
begin
|
||||
MI.Visible := False;
|
||||
PMI.Visible := False;
|
||||
end;
|
||||
end;
|
||||
MIMRUFEnd.Visible := B;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CloseFile;
|
||||
begin
|
||||
if Editor.Visible then
|
||||
begin
|
||||
Editor.Clear;
|
||||
AddMRUF(FLastFileName);
|
||||
FLastFileName := '';
|
||||
Editor.Visible := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.NewFile;
|
||||
begin
|
||||
if SaveFile(False, True) then
|
||||
begin
|
||||
CloseFile;
|
||||
IsNew := True;
|
||||
Caption := Format('%s - %s', [AppName, sNoname]);
|
||||
Editor.Visible := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.OpenFile(FileName: string);
|
||||
begin
|
||||
if SaveFile(False, True) then
|
||||
begin
|
||||
if FileName = '' then
|
||||
if ODMain.Execute then
|
||||
FileName := ODMain.FileName;
|
||||
if FileName <> '' then
|
||||
begin
|
||||
CloseFile;
|
||||
if ExtractFileDir(FileName) = '' then
|
||||
FileName := Format('%s\%s', [GetCurrentDir, FileName]);
|
||||
try
|
||||
Editor.LoadFromFile(FileName);
|
||||
FLastFileName := FileName;
|
||||
IsNew := False;
|
||||
Caption := Format('%s - %s', [AppName, FLastFileName]);
|
||||
Editor.Visible := True;
|
||||
except
|
||||
MessageBox(Handle, PChar(Format(sErrOpenError, [FileName])), PChar(sAppName), MB_OK);
|
||||
end;
|
||||
DeleteMRUF(FileName);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainForm.SaveFile(SaveAs, NeedAnotherOp: Boolean): Boolean;
|
||||
var
|
||||
NeedDlg: Boolean;
|
||||
FileName: string;
|
||||
begin
|
||||
Result := False;
|
||||
if IsNew then
|
||||
FileName := sNoname
|
||||
else
|
||||
FileName := ExtractFileName(FLastFileName);
|
||||
if NeedAnotherOp then
|
||||
begin
|
||||
if Editor.Modified then
|
||||
begin
|
||||
case MessageBox(Handle, PChar(Format(sNeedSaveQuestion, [FileName])), PChar(sAppName), MB_YESNOCANCEL) of
|
||||
ID_NO: begin Result := True; Exit end;
|
||||
ID_CANCEL: Exit;
|
||||
end
|
||||
end else
|
||||
begin
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
NeedDlg := IsNew or SaveAs;
|
||||
SDMain.FileName := FileName;
|
||||
if not NeedDlg or SDMain.Execute then
|
||||
begin
|
||||
if NeedDlg then FLastFileName := SDMain.Filename;
|
||||
try
|
||||
Editor.SaveToFile(FLastFileName);
|
||||
Editor.Modified := False;
|
||||
IsNew := False;
|
||||
Caption := Format('%s - %s', [AppName, FLastFileName]);
|
||||
Result := True;
|
||||
except
|
||||
MessageBox(Handle, PChar(Format(sErrSaveError, [FileName])), PChar(sAppName), MB_OK);
|
||||
end;
|
||||
end;
|
||||
if Result then Editor.Modified := False;
|
||||
end;
|
||||
|
||||
procedure TMainForm.LoadFromIni;
|
||||
var
|
||||
Ini: TIniFile;
|
||||
I: Integer;
|
||||
S: string;
|
||||
begin
|
||||
Ini := TIniFile.Create(IniPath);
|
||||
try
|
||||
I := Ini.ReadInteger(secSettings, 'Version', 0);
|
||||
if I = IniVersion then with Environment do
|
||||
begin
|
||||
DataToString(@P, SizeOf(TEnvironmentPacked), S);
|
||||
S := Ini.ReadString(secSettings, 'Environment', S);
|
||||
StringToData(S, @P, SizeOf(TEnvironmentPacked));
|
||||
AddressPrefix := Ini.ReadString(secSettings, 'Address prefix', AddressPrefix);
|
||||
FontName := Ini.ReadString(secSettings, 'Font name', FontName);
|
||||
end;
|
||||
FLastFileName := Ini.ReadString(secSettings, 'Last file name', FLastFileName);
|
||||
WindowState := TWindowState(Ini.ReadInteger(secSettings, 'Window state', Integer(WindowState)));
|
||||
BoundsRect := Rect(
|
||||
Ini.ReadInteger(secSettings, 'Left', Left),
|
||||
Ini.ReadInteger(secSettings, 'Top', Top),
|
||||
Ini.ReadInteger(secSettings, 'Right', Left + Width),
|
||||
Ini.ReadInteger(secSettings, 'Bottom', Top + Height));
|
||||
FMRUFList.Clear;
|
||||
for I := 1 to 5 do
|
||||
begin
|
||||
S := Ini.ReadString(secMRUFs, Format('MRUF%d', [I]), '');
|
||||
if S <> '' then FMRUFList.Add(S);
|
||||
end;
|
||||
finally
|
||||
Ini.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.SaveToIni;
|
||||
var
|
||||
Ini: TIniFile;
|
||||
I: Integer;
|
||||
S: string;
|
||||
begin
|
||||
Ini := TIniFile.Create(IniPath);
|
||||
try
|
||||
Ini.WriteInteger(secSettings, 'Version', IniVersion);
|
||||
with Environment do
|
||||
begin
|
||||
DataToString(@P, SizeOf(TEnvironmentPacked), S);
|
||||
Ini.WriteString(secSettings, 'Environment', S);
|
||||
Ini.WriteString(secSettings, 'Address prefix', AddressPrefix);
|
||||
Ini.WriteString(secSettings, 'Font name', FontName);
|
||||
end;
|
||||
Ini.WriteString(secSettings, 'Last file name', FLastFileName);
|
||||
Ini.WriteInteger(secSettings, 'Window state', Integer(WindowState));
|
||||
Ini.WriteInteger(secSettings, 'Left', Left);
|
||||
Ini.WriteInteger(secSettings, 'Top', Top);
|
||||
Ini.WriteInteger(secSettings, 'Right', Left + Width);
|
||||
Ini.WriteInteger(secSettings, 'Bottom', Top + Height);
|
||||
for I := 0 to FMRUFList.Count - 1 do
|
||||
Ini.WriteString(secMRUFs, Format('MRUF%d', [I + 1]), FMRUFList[I]);
|
||||
finally
|
||||
Ini.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.EnvironmentChanged;
|
||||
var
|
||||
Options: TKEditOptions;
|
||||
DrawStyles: TKHexEditorDrawStyles;
|
||||
begin
|
||||
with Environment do
|
||||
begin
|
||||
Options := [];
|
||||
if P.DropFiles then Include(Options, eoDropFiles);
|
||||
if P.GroupUndo then Include(Options, eoGroupUndo);
|
||||
if P.UndoAfterSave then Include(Options, eoUndoAfterSave);
|
||||
Editor.Options := Options;
|
||||
DrawStyles := [];
|
||||
if P.ShowAddress then Include(DrawStyles, edAddress);
|
||||
if P.ShowDigits then Include(DrawStyles, edDigits);
|
||||
if P.ShowText then Include(DrawStyles, edText);
|
||||
if P.ShowHorzLines then Include(DrawStyles, edHorzLines);
|
||||
if P.ShowVertLines then Include(DrawStyles, edVertLines);
|
||||
if P.ShowSeparators then Include(DrawStyles, edSeparators);
|
||||
if P.ShowInactiveCaret then Include(DrawStyles, edInactiveCaret);
|
||||
Editor.DrawStyles := DrawStyles;
|
||||
Editor.AddressMode := TKHexEditorAddressMode(P.AddressMode);
|
||||
Editor.AddressPrefix := AddressPrefix;
|
||||
Editor.AddressSize := P.AddressSize;
|
||||
Editor.CharSpacing := P.CharSpacing;
|
||||
Editor.DigitGrouping := P.DigitGrouping;
|
||||
Editor.DisabledDrawStyle := TKHexEditorDisabledDrawStyle(P.DisabledDrawStyle);
|
||||
Editor.LineHeightPercent := P.LineHeightPercent;
|
||||
Editor.LineSize := P.LineSize;
|
||||
Editor.UndoLimit := P.UndoLimit;
|
||||
// font
|
||||
Editor.Font.Name := FontName;
|
||||
Editor.Font.Size := P.FontSize;
|
||||
Editor.Font.Style := P.FontStyle;
|
||||
// colors
|
||||
Editor.Colors.Colors := Colors;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Search(Command: TKEditCommand);
|
||||
var
|
||||
Form: TSearchForm;
|
||||
MResult: TModalResult;
|
||||
begin
|
||||
if Command = ecReplace then
|
||||
Form := ReplaceForm
|
||||
else
|
||||
Form := SearchForm;
|
||||
if Editor.EditArea = eaDigits then
|
||||
Include(SearchData.Options, esoTreatAsDigits)
|
||||
else
|
||||
Exclude(SearchData.Options, esoTreatAsDigits);
|
||||
Form.SetData(SearchData, Editor.SelAvail);
|
||||
MResult := Form.ShowModal;
|
||||
if MResult in [mrYes, mrYesToAll] then
|
||||
begin
|
||||
Form.GetData(SearchData);
|
||||
SearchAgainEnabled := True;
|
||||
LastSearchCommand := Command;
|
||||
Include(SearchData.Options, esoFirstSearch);
|
||||
TextToFind := TrimToSize(SearchData.TextToFind, 40);
|
||||
TextToReplace := TrimToSize(SearchData.TextToReplace, 40);
|
||||
ReplacePromptForm.LBText.Caption := Format(sReplaceQuestion, [TextToFind]);
|
||||
if MResult = mrYesToAll then
|
||||
Include(SearchData.Options, esoAll);
|
||||
Editor.ExecuteCommand(Command, @SearchData);
|
||||
HandleSearchError;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.EditorReplaceText(Sender: TObject; const TextToFind,
|
||||
TextToReplace: String; var Action: TKEditReplaceAction);
|
||||
begin
|
||||
case ReplacePromptForm.ShowModal of
|
||||
mrYes: Action := eraYes;
|
||||
mrNo: Action := eraNo;
|
||||
mrYesToAll: Action := eraAll;
|
||||
mrCancel: Action := eraCancel;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.HandleSearchError;
|
||||
var
|
||||
S: string;
|
||||
begin
|
||||
case SearchData.ErrorReason of
|
||||
eseNoMatch: S := Format(sErrTextNotFound, [TextToFind]);
|
||||
eseNoDigitsFind: S := Format(sErrNoDigitsInText, [TextToFind]);
|
||||
eseNoDigitsReplace: S := Format(sErrNoDigitsInText, [TextToReplace]);
|
||||
else
|
||||
S := '';
|
||||
end;
|
||||
if S <> '' then
|
||||
MessageBox(Handle, PChar(S), PChar(sAppName), MB_OK);
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
procedure TMainForm.LazDropFiles(Sender: TObject;
|
||||
const FileNames: array of String);
|
||||
begin
|
||||
if Length(FileNames) > 0 then
|
||||
begin
|
||||
Application.BringToFront;
|
||||
OpenFile(FileNames[0]);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TMainForm.EditorDropFiles(Sender: TObject; X, Y: Integer;
|
||||
Files: TStrings);
|
||||
begin
|
||||
//not called in Lazarus but keep assigned in this demo
|
||||
if Files.Count > 0 then
|
||||
begin
|
||||
Application.BringToFront;
|
||||
OpenFile(Files[0]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.EditorPrintNotify(Sender: TObject;
|
||||
Status: TKPrintStatus; var Abort: Boolean);
|
||||
begin
|
||||
with PrintStatusForm do
|
||||
begin
|
||||
case Status of
|
||||
epsBegin:
|
||||
begin
|
||||
Self.Enabled := False;
|
||||
Aborted := False;
|
||||
Show;
|
||||
end;
|
||||
epsNewPage:
|
||||
begin
|
||||
LBPage.Caption := Format(sPrintedPageAndCopy,
|
||||
[Editor.PageSetup.CurrentPage, Editor.PageSetup.PageCount,
|
||||
Editor.PageSetup.CurrentCopy, Editor.PageSetup.Copies]);
|
||||
Update;
|
||||
end;
|
||||
epsEnd:
|
||||
begin
|
||||
Hide;
|
||||
Self.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
Abort := Aborted;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.EditorPrintPaint(Sender: TObject);
|
||||
var
|
||||
Y: Integer;
|
||||
begin
|
||||
with Editor.PageSetup do
|
||||
begin
|
||||
// paint filename as header - we have 1 cm space defined
|
||||
Canvas.Brush.Style := bsClear;
|
||||
Canvas.Font.Pitch := fpDefault;
|
||||
Canvas.Font.Name := 'Arial';
|
||||
Canvas.Font.Height := VMap(16);
|
||||
Canvas.Font.Style := [fsBold];
|
||||
Canvas.Font.Color := clBlack;
|
||||
Canvas.TextOut(PrinterMarginLeftMirrored, PrinterMarginTop, FLastFileName);
|
||||
Canvas.Brush.Style := bsSolid;
|
||||
Canvas.Pen.Color := clBlack;
|
||||
Canvas.Pen.Width := VMap(2);
|
||||
Y := PrinterMarginTop + VMap(22);
|
||||
Canvas.MoveTo(PrinterMarginLeftMirrored, Y);
|
||||
Canvas.LineTo(PageWidth - PrinterMarginRightMirrored, Y);
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i main.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
517
applications/khexeditor/options.lfm
Normal file
517
applications/khexeditor/options.lfm
Normal file
@ -0,0 +1,517 @@
|
||||
object OptionsForm: TOptionsForm
|
||||
Left = 1101
|
||||
Height = 363
|
||||
Top = 773
|
||||
Width = 437
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Editor options'
|
||||
ClientHeight = 363
|
||||
ClientWidth = 437
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
object PCMain: TPageControl
|
||||
Left = 8
|
||||
Height = 320
|
||||
Top = 8
|
||||
Width = 425
|
||||
ActivePage = TSEditorFont
|
||||
TabIndex = 1
|
||||
TabOrder = 0
|
||||
object TSEditorOptions: TTabSheet
|
||||
Caption = 'Editor Options'
|
||||
ClientHeight = 294
|
||||
ClientWidth = 417
|
||||
object LBAddressPrefix: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 69
|
||||
Width = 75
|
||||
Caption = 'Address prefix:'
|
||||
FocusControl = EDAddressPrefix
|
||||
ParentColor = False
|
||||
end
|
||||
object LBAddressSize: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 93
|
||||
Width = 65
|
||||
Caption = 'Address size:'
|
||||
FocusControl = EDAddressSize
|
||||
ParentColor = False
|
||||
end
|
||||
object LBCharSpacing: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 117
|
||||
Width = 118
|
||||
Caption = 'Inter-character spacing:'
|
||||
FocusControl = EDCharSpacing
|
||||
ParentColor = False
|
||||
end
|
||||
object LBDigitGrouping: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 165
|
||||
Width = 71
|
||||
Caption = 'Digit grouping:'
|
||||
FocusControl = EDDigitGrouping
|
||||
ParentColor = False
|
||||
end
|
||||
object LBLineSize: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 141
|
||||
Width = 45
|
||||
Caption = 'Line size:'
|
||||
FocusControl = EDLineSize
|
||||
ParentColor = False
|
||||
end
|
||||
object LBbytes: TLabel
|
||||
Left = 381
|
||||
Height = 14
|
||||
Top = 141
|
||||
Width = 28
|
||||
Caption = 'bytes'
|
||||
ParentColor = False
|
||||
end
|
||||
object LBpoints: TLabel
|
||||
Left = 381
|
||||
Height = 14
|
||||
Top = 118
|
||||
Width = 30
|
||||
Caption = 'points'
|
||||
ParentColor = False
|
||||
end
|
||||
object LBbytes2: TLabel
|
||||
Left = 381
|
||||
Height = 14
|
||||
Top = 165
|
||||
Width = 28
|
||||
Caption = 'bytes'
|
||||
ParentColor = False
|
||||
end
|
||||
object LBLineHeightPercent: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 189
|
||||
Width = 115
|
||||
Caption = 'Line height percentage:'
|
||||
FocusControl = EDLineHeightPercent
|
||||
ParentColor = False
|
||||
end
|
||||
object LBpercent: TLabel
|
||||
Left = 381
|
||||
Height = 14
|
||||
Top = 189
|
||||
Width = 12
|
||||
Caption = '%'
|
||||
ParentColor = False
|
||||
end
|
||||
object LBUndoLimit: TLabel
|
||||
Left = 212
|
||||
Height = 14
|
||||
Top = 213
|
||||
Width = 51
|
||||
Caption = 'Undo limit:'
|
||||
FocusControl = EDUndoLimit
|
||||
ParentColor = False
|
||||
end
|
||||
object GBGeneral: TGroupBox
|
||||
Left = 4
|
||||
Height = 69
|
||||
Top = 2
|
||||
Width = 201
|
||||
Caption = 'General'
|
||||
ClientHeight = 51
|
||||
ClientWidth = 197
|
||||
TabOrder = 0
|
||||
object CBDropFiles: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 0
|
||||
Width = 63
|
||||
Caption = 'Drop files'
|
||||
TabOrder = 0
|
||||
end
|
||||
object CBUndoAfterSave: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 32
|
||||
Width = 96
|
||||
Caption = 'Undo after save'
|
||||
TabOrder = 2
|
||||
end
|
||||
object CBGroupUndo: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 16
|
||||
Width = 74
|
||||
Caption = 'Group undo'
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object RGAddressMode: TRadioGroup
|
||||
Left = 212
|
||||
Height = 45
|
||||
Top = 6
|
||||
Width = 201
|
||||
AutoFill = True
|
||||
Caption = 'Address mode'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 27
|
||||
ClientWidth = 197
|
||||
Columns = 2
|
||||
Items.Strings = (
|
||||
'Decimal'
|
||||
'Hexadecimal'
|
||||
)
|
||||
TabOrder = 3
|
||||
end
|
||||
object RGDisabledDrawStyle: TRadioGroup
|
||||
Left = 4
|
||||
Height = 83
|
||||
Top = 207
|
||||
Width = 201
|
||||
AutoFill = True
|
||||
Caption = 'Draw style when disabled'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 65
|
||||
ClientWidth = 197
|
||||
Items.Strings = (
|
||||
'Brighter colors'
|
||||
'Gray and white'
|
||||
'Normal colors'
|
||||
)
|
||||
TabOrder = 2
|
||||
end
|
||||
object GBAppearance: TGroupBox
|
||||
Left = 4
|
||||
Height = 133
|
||||
Top = 72
|
||||
Width = 201
|
||||
Caption = 'Appearance'
|
||||
ClientHeight = 115
|
||||
ClientWidth = 197
|
||||
TabOrder = 1
|
||||
object CBShowAddress: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 2
|
||||
Width = 110
|
||||
Caption = 'Show address area'
|
||||
TabOrder = 0
|
||||
end
|
||||
object CBShowDigits: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 18
|
||||
Width = 92
|
||||
Caption = 'Show digit area'
|
||||
TabOrder = 1
|
||||
end
|
||||
object CBShowText: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 34
|
||||
Width = 92
|
||||
Caption = 'Show text area'
|
||||
TabOrder = 2
|
||||
end
|
||||
object CBShowHorzLines: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 50
|
||||
Width = 118
|
||||
Caption = 'Show horizontal lines'
|
||||
TabOrder = 3
|
||||
end
|
||||
object CBShowVertLines: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 66
|
||||
Width = 106
|
||||
Caption = 'Show vertical lines'
|
||||
TabOrder = 4
|
||||
end
|
||||
object CBShowSeparators: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 82
|
||||
Width = 124
|
||||
Caption = 'Show area separators'
|
||||
TabOrder = 5
|
||||
end
|
||||
object CBShowInactiveCaret: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 98
|
||||
Width = 112
|
||||
Caption = 'Show inactive caret'
|
||||
TabOrder = 6
|
||||
end
|
||||
end
|
||||
object EDAddressPrefix: TEdit
|
||||
Left = 328
|
||||
Height = 21
|
||||
Top = 66
|
||||
Width = 49
|
||||
TabOrder = 4
|
||||
end
|
||||
object EDAddressSize: TEdit
|
||||
Left = 344
|
||||
Height = 21
|
||||
Top = 90
|
||||
Width = 33
|
||||
TabOrder = 5
|
||||
end
|
||||
object EDCharSpacing: TEdit
|
||||
Left = 344
|
||||
Height = 21
|
||||
Top = 114
|
||||
Width = 33
|
||||
TabOrder = 6
|
||||
end
|
||||
object EDDigitGrouping: TEdit
|
||||
Left = 344
|
||||
Height = 21
|
||||
Top = 162
|
||||
Width = 33
|
||||
TabOrder = 7
|
||||
end
|
||||
object EDLineSize: TEdit
|
||||
Left = 344
|
||||
Height = 21
|
||||
Top = 138
|
||||
Width = 33
|
||||
TabOrder = 8
|
||||
end
|
||||
object EDLineHeightPercent: TEdit
|
||||
Left = 344
|
||||
Height = 21
|
||||
Top = 186
|
||||
Width = 33
|
||||
TabOrder = 9
|
||||
end
|
||||
object EDUndoLimit: TEdit
|
||||
Left = 328
|
||||
Height = 21
|
||||
Top = 210
|
||||
Width = 49
|
||||
TabOrder = 10
|
||||
end
|
||||
end
|
||||
object TSEditorFont: TTabSheet
|
||||
Caption = 'Editor Font'
|
||||
ClientHeight = 294
|
||||
ClientWidth = 417
|
||||
ImageIndex = 2
|
||||
object LBFontName: TLabel
|
||||
Left = 16
|
||||
Height = 14
|
||||
Top = 16
|
||||
Width = 56
|
||||
Caption = '&Font name:'
|
||||
FocusControl = CoBFontName
|
||||
ParentColor = False
|
||||
end
|
||||
object LBSample: TLabel
|
||||
Left = 16
|
||||
Height = 14
|
||||
Top = 120
|
||||
Width = 39
|
||||
Caption = 'Sample:'
|
||||
FocusControl = PNFontSample
|
||||
ParentColor = False
|
||||
end
|
||||
object LBFontSize: TLabel
|
||||
Left = 315
|
||||
Height = 14
|
||||
Top = 34
|
||||
Width = 48
|
||||
Alignment = taRightJustify
|
||||
Caption = 'Font size:'
|
||||
FocusControl = EDFontSize
|
||||
ParentColor = False
|
||||
end
|
||||
object CoBFontName: TComboBox
|
||||
Left = 16
|
||||
Height = 21
|
||||
Top = 32
|
||||
Width = 201
|
||||
ItemHeight = 13
|
||||
OnExit = CoBFontNameClick
|
||||
OnSelect = CoBFontNameClick
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
end
|
||||
object PNFontSample: TPanel
|
||||
Left = 16
|
||||
Height = 105
|
||||
Top = 136
|
||||
Width = 385
|
||||
BevelOuter = bvLowered
|
||||
Caption = 'AaBbCcXxYyZz'
|
||||
TabOrder = 1
|
||||
end
|
||||
object EDFontSize: TEdit
|
||||
Left = 368
|
||||
Height = 21
|
||||
Top = 31
|
||||
Width = 33
|
||||
OnExit = EDFontSizeExit
|
||||
TabOrder = 2
|
||||
end
|
||||
object CBFontStyleBold: TCheckBox
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 64
|
||||
Width = 38
|
||||
Caption = 'Bold'
|
||||
OnClick = CoBFontNameClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object CBFontStyleItalic: TCheckBox
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 88
|
||||
Width = 41
|
||||
Caption = 'Italic'
|
||||
OnClick = CoBFontNameClick
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
object TSColors: TTabSheet
|
||||
Caption = 'Colors'
|
||||
ClientHeight = 294
|
||||
ClientWidth = 417
|
||||
ImageIndex = 1
|
||||
object LBAttributes: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 8
|
||||
Width = 53
|
||||
Caption = 'Color item:'
|
||||
FocusControl = LiBColors
|
||||
ParentColor = False
|
||||
end
|
||||
object LiBColors: TListBox
|
||||
Left = 8
|
||||
Height = 233
|
||||
Top = 24
|
||||
Width = 209
|
||||
ItemHeight = 13
|
||||
OnClick = LiBColorsClick
|
||||
OnDrawItem = LiBColorsDrawItem
|
||||
OnMouseMove = LiBColorsMouseMove
|
||||
Style = lbOwnerDrawFixed
|
||||
TabOrder = 0
|
||||
end
|
||||
object GBColors: TGroupBox
|
||||
Left = 224
|
||||
Height = 95
|
||||
Top = 19
|
||||
Width = 185
|
||||
Caption = 'Color assignment'
|
||||
ClientHeight = 77
|
||||
ClientWidth = 181
|
||||
TabOrder = 1
|
||||
object LBHighFG: TLabel
|
||||
Left = 10
|
||||
Height = 14
|
||||
Top = 18
|
||||
Width = 68
|
||||
Caption = 'Current color:'
|
||||
ParentColor = False
|
||||
end
|
||||
object SHColor: TShape
|
||||
Left = 112
|
||||
Height = 49
|
||||
Top = 16
|
||||
Width = 65
|
||||
end
|
||||
object BUColorChange: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 40
|
||||
Width = 75
|
||||
Caption = 'Change...'
|
||||
OnClick = BUColorChangeClick
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object BUOk: TButton
|
||||
Left = 275
|
||||
Height = 25
|
||||
Top = 333
|
||||
Width = 75
|
||||
Caption = '&OK'
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 2
|
||||
end
|
||||
object BuCancel: TButton
|
||||
Left = 358
|
||||
Height = 25
|
||||
Top = 333
|
||||
Width = 75
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object BUDefault: TButton
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 333
|
||||
Width = 75
|
||||
Caption = 'Defaults'
|
||||
OnClick = BUDefaultClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object CDChange: TColorDialog
|
||||
Color = clBlack
|
||||
CustomColors.Strings = (
|
||||
'ColorA=000000'
|
||||
'ColorB=000080'
|
||||
'ColorC=008000'
|
||||
'ColorD=008080'
|
||||
'ColorE=800000'
|
||||
'ColorF=800080'
|
||||
'ColorG=808000'
|
||||
'ColorH=808080'
|
||||
'ColorI=C0C0C0'
|
||||
'ColorJ=0000FF'
|
||||
'ColorK=00FF00'
|
||||
'ColorL=00FFFF'
|
||||
'ColorM=FF0000'
|
||||
'ColorN=FF00FF'
|
||||
'ColorO=FFFF00'
|
||||
'ColorP=FFFFFF'
|
||||
'ColorQ=C0DCC0'
|
||||
'ColorR=F0CAA6'
|
||||
'ColorS=F0FBFF'
|
||||
'ColorT=A4A0A0'
|
||||
)
|
||||
left = 404
|
||||
end
|
||||
end
|
135
applications/khexeditor/options.lrs
Normal file
135
applications/khexeditor/options.lrs
Normal file
@ -0,0 +1,135 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TOptionsForm','FORMDATA',[
|
||||
'TPF0'#12'TOptionsForm'#11'OptionsForm'#4'Left'#3'M'#4#6'Height'#3'k'#1#3'Top'
|
||||
+#3#5#3#5'Width'#3#181#1#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#14'Editor'
|
||||
+' options'#12'ClientHeight'#3'k'#1#11'ClientWidth'#3#181#1#11'Font.Height'#2
|
||||
+#245#9'Font.Name'#6#6'Tahoma'#12'OnCloseQuery'#7#14'FormCloseQuery'#8'OnCrea'
|
||||
+'te'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.'
|
||||
+'9.29'#0#12'TPageControl'#6'PCMain'#4'Left'#2#8#6'Height'#3'@'#1#3'Top'#2#8#5
|
||||
+'Width'#3#169#1#10'ActivePage'#7#12'TSEditorFont'#8'TabIndex'#2#1#8'TabOrder'
|
||||
+#2#0#0#9'TTabSheet'#15'TSEditorOptions'#7'Caption'#6#14'Editor Options'#12'C'
|
||||
+'lientHeight'#3'&'#1#11'ClientWidth'#3#161#1#0#6'TLabel'#15'LBAddressPrefix'
|
||||
+#4'Left'#3#212#0#6'Height'#2#14#3'Top'#2'E'#5'Width'#2'K'#7'Caption'#6#15'Ad'
|
||||
+'dress prefix:'#12'FocusControl'#7#15'EDAddressPrefix'#11'ParentColor'#8#0#0
|
||||
+#6'TLabel'#13'LBAddressSize'#4'Left'#3#212#0#6'Height'#2#14#3'Top'#2']'#5'Wi'
|
||||
+'dth'#2'A'#7'Caption'#6#13'Address size:'#12'FocusControl'#7#13'EDAddressSiz'
|
||||
+'e'#11'ParentColor'#8#0#0#6'TLabel'#13'LBCharSpacing'#4'Left'#3#212#0#6'Heig'
|
||||
+'ht'#2#14#3'Top'#2'u'#5'Width'#2'v'#7'Caption'#6#24'Inter-character spacing:'
|
||||
+#12'FocusControl'#7#13'EDCharSpacing'#11'ParentColor'#8#0#0#6'TLabel'#15'LBD'
|
||||
+'igitGrouping'#4'Left'#3#212#0#6'Height'#2#14#3'Top'#3#165#0#5'Width'#2'G'#7
|
||||
+'Caption'#6#15'Digit grouping:'#12'FocusControl'#7#15'EDDigitGrouping'#11'Pa'
|
||||
+'rentColor'#8#0#0#6'TLabel'#10'LBLineSize'#4'Left'#3#212#0#6'Height'#2#14#3
|
||||
+'Top'#3#141#0#5'Width'#2'-'#7'Caption'#6#10'Line size:'#12'FocusControl'#7#10
|
||||
+'EDLineSize'#11'ParentColor'#8#0#0#6'TLabel'#7'LBbytes'#4'Left'#3'}'#1#6'Hei'
|
||||
+'ght'#2#14#3'Top'#3#141#0#5'Width'#2#28#7'Caption'#6#5'bytes'#11'ParentColor'
|
||||
+#8#0#0#6'TLabel'#8'LBpoints'#4'Left'#3'}'#1#6'Height'#2#14#3'Top'#2'v'#5'Wid'
|
||||
+'th'#2#30#7'Caption'#6#6'points'#11'ParentColor'#8#0#0#6'TLabel'#8'LBbytes2'
|
||||
+#4'Left'#3'}'#1#6'Height'#2#14#3'Top'#3#165#0#5'Width'#2#28#7'Caption'#6#5'b'
|
||||
+'ytes'#11'ParentColor'#8#0#0#6'TLabel'#19'LBLineHeightPercent'#4'Left'#3#212
|
||||
+#0#6'Height'#2#14#3'Top'#3#189#0#5'Width'#2's'#7'Caption'#6#23'Line height p'
|
||||
+'ercentage:'#12'FocusControl'#7#19'EDLineHeightPercent'#11'ParentColor'#8#0#0
|
||||
+#6'TLabel'#9'LBpercent'#4'Left'#3'}'#1#6'Height'#2#14#3'Top'#3#189#0#5'Width'
|
||||
+#2#12#7'Caption'#6#1'%'#11'ParentColor'#8#0#0#6'TLabel'#11'LBUndoLimit'#4'Le'
|
||||
+'ft'#3#212#0#6'Height'#2#14#3'Top'#3#213#0#5'Width'#2'3'#7'Caption'#6#11'Und'
|
||||
+'o limit:'#12'FocusControl'#7#11'EDUndoLimit'#11'ParentColor'#8#0#0#9'TGroup'
|
||||
+'Box'#9'GBGeneral'#4'Left'#2#4#6'Height'#2'E'#3'Top'#2#2#5'Width'#3#201#0#7
|
||||
+'Caption'#6#7'General'#12'ClientHeight'#2'3'#11'ClientWidth'#3#197#0#8'TabOr'
|
||||
+'der'#2#0#0#9'TCheckBox'#11'CBDropFiles'#4'Left'#2#8#6'Height'#2#17#3'Top'#2
|
||||
+#0#5'Width'#2'?'#7'Caption'#6#10'Drop files'#8'TabOrder'#2#0#0#0#9'TCheckBox'
|
||||
+#15'CBUndoAfterSave'#4'Left'#2#8#6'Height'#2#17#3'Top'#2' '#5'Width'#2'`'#7
|
||||
+'Caption'#6#15'Undo after save'#8'TabOrder'#2#2#0#0#9'TCheckBox'#11'CBGroupU'
|
||||
+'ndo'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#16#5'Width'#2'J'#7'Caption'#6#10'G'
|
||||
+'roup undo'#8'TabOrder'#2#1#0#0#0#11'TRadioGroup'#13'RGAddressMode'#4'Left'#3
|
||||
+#212#0#6'Height'#2'-'#3'Top'#2#6#5'Width'#3#201#0#8'AutoFill'#9#7'Caption'#6
|
||||
+#12'Address mode'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBot'
|
||||
+'tomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildRe'
|
||||
+'size'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'Chi'
|
||||
+'ldSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertic'
|
||||
+'al'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopT'
|
||||
+'oBottom'#27'ChildSizing.ControlsPerLine'#2#2#12'ClientHeight'#2#27#11'Clien'
|
||||
+'tWidth'#3#197#0#7'Columns'#2#2#13'Items.Strings'#1#6#7'Decimal'#6#11'Hexade'
|
||||
+'cimal'#0#8'TabOrder'#2#3#0#0#11'TRadioGroup'#19'RGDisabledDrawStyle'#4'Left'
|
||||
+#2#4#6'Height'#2'S'#3'Top'#3#207#0#5'Width'#3#201#0#8'AutoFill'#9#7'Caption'
|
||||
+#6#24'Draw style when disabled'#28'ChildSizing.LeftRightSpacing'#2#6#28'Chil'
|
||||
+'dSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHom'
|
||||
+'ogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChild'
|
||||
+'Resize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizin'
|
||||
+'g.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftT'
|
||||
+'oRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'
|
||||
+#2'A'#11'ClientWidth'#3#197#0#13'Items.Strings'#1#6#15'Brighter colors'#6#14
|
||||
+'Gray and white'#6#13'Normal colors'#0#8'TabOrder'#2#2#0#0#9'TGroupBox'#12'G'
|
||||
+'BAppearance'#4'Left'#2#4#6'Height'#3#133#0#3'Top'#2'H'#5'Width'#3#201#0#7'C'
|
||||
+'aption'#6#10'Appearance'#12'ClientHeight'#2's'#11'ClientWidth'#3#197#0#8'Ta'
|
||||
+'bOrder'#2#1#0#9'TCheckBox'#13'CBShowAddress'#4'Left'#2#8#6'Height'#2#17#3'T'
|
||||
+'op'#2#2#5'Width'#2'n'#7'Caption'#6#17'Show address area'#8'TabOrder'#2#0#0#0
|
||||
+#9'TCheckBox'#12'CBShowDigits'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#18#5'Widt'
|
||||
+'h'#2'\'#7'Caption'#6#15'Show digit area'#8'TabOrder'#2#1#0#0#9'TCheckBox'#10
|
||||
,'CBShowText'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'"'#5'Width'#2'\'#7'Caption'
|
||||
+#6#14'Show text area'#8'TabOrder'#2#2#0#0#9'TCheckBox'#15'CBShowHorzLines'#4
|
||||
+'Left'#2#8#6'Height'#2#17#3'Top'#2'2'#5'Width'#2'v'#7'Caption'#6#21'Show hor'
|
||||
+'izontal lines'#8'TabOrder'#2#3#0#0#9'TCheckBox'#15'CBShowVertLines'#4'Left'
|
||||
+#2#8#6'Height'#2#17#3'Top'#2'B'#5'Width'#2'j'#7'Caption'#6#19'Show vertical '
|
||||
+'lines'#8'TabOrder'#2#4#0#0#9'TCheckBox'#16'CBShowSeparators'#4'Left'#2#8#6
|
||||
+'Height'#2#17#3'Top'#2'R'#5'Width'#2'|'#7'Caption'#6#20'Show area separators'
|
||||
+#8'TabOrder'#2#5#0#0#9'TCheckBox'#19'CBShowInactiveCaret'#4'Left'#2#8#6'Heig'
|
||||
+'ht'#2#17#3'Top'#2'b'#5'Width'#2'p'#7'Caption'#6#19'Show inactive caret'#8'T'
|
||||
+'abOrder'#2#6#0#0#0#5'TEdit'#15'EDAddressPrefix'#4'Left'#3'H'#1#6'Height'#2
|
||||
+#21#3'Top'#2'B'#5'Width'#2'1'#8'TabOrder'#2#4#0#0#5'TEdit'#13'EDAddressSize'
|
||||
+#4'Left'#3'X'#1#6'Height'#2#21#3'Top'#2'Z'#5'Width'#2'!'#8'TabOrder'#2#5#0#0
|
||||
+#5'TEdit'#13'EDCharSpacing'#4'Left'#3'X'#1#6'Height'#2#21#3'Top'#2'r'#5'Widt'
|
||||
+'h'#2'!'#8'TabOrder'#2#6#0#0#5'TEdit'#15'EDDigitGrouping'#4'Left'#3'X'#1#6'H'
|
||||
+'eight'#2#21#3'Top'#3#162#0#5'Width'#2'!'#8'TabOrder'#2#7#0#0#5'TEdit'#10'ED'
|
||||
+'LineSize'#4'Left'#3'X'#1#6'Height'#2#21#3'Top'#3#138#0#5'Width'#2'!'#8'TabO'
|
||||
+'rder'#2#8#0#0#5'TEdit'#19'EDLineHeightPercent'#4'Left'#3'X'#1#6'Height'#2#21
|
||||
+#3'Top'#3#186#0#5'Width'#2'!'#8'TabOrder'#2#9#0#0#5'TEdit'#11'EDUndoLimit'#4
|
||||
+'Left'#3'H'#1#6'Height'#2#21#3'Top'#3#210#0#5'Width'#2'1'#8'TabOrder'#2#10#0
|
||||
+#0#0#9'TTabSheet'#12'TSEditorFont'#7'Caption'#6#11'Editor Font'#12'ClientHei'
|
||||
+'ght'#3'&'#1#11'ClientWidth'#3#161#1#10'ImageIndex'#2#2#0#6'TLabel'#10'LBFon'
|
||||
+'tName'#4'Left'#2#16#6'Height'#2#14#3'Top'#2#16#5'Width'#2'8'#7'Caption'#6#11
|
||||
+'&Font name:'#12'FocusControl'#7#11'CoBFontName'#11'ParentColor'#8#0#0#6'TLa'
|
||||
+'bel'#8'LBSample'#4'Left'#2#16#6'Height'#2#14#3'Top'#2'x'#5'Width'#2''''#7'C'
|
||||
+'aption'#6#7'Sample:'#12'FocusControl'#7#12'PNFontSample'#11'ParentColor'#8#0
|
||||
+#0#6'TLabel'#10'LBFontSize'#4'Left'#3';'#1#6'Height'#2#14#3'Top'#2'"'#5'Widt'
|
||||
+'h'#2'0'#9'Alignment'#7#14'taRightJustify'#7'Caption'#6#10'Font size:'#12'Fo'
|
||||
+'cusControl'#7#10'EDFontSize'#11'ParentColor'#8#0#0#9'TComboBox'#11'CoBFontN'
|
||||
+'ame'#4'Left'#2#16#6'Height'#2#21#3'Top'#2' '#5'Width'#3#201#0#10'ItemHeight'
|
||||
+#2#13#6'OnExit'#7#16'CoBFontNameClick'#8'OnSelect'#7#16'CoBFontNameClick'#5
|
||||
+'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#6'TPanel'#12'PNFontSample'#4
|
||||
+'Left'#2#16#6'Height'#2'i'#3'Top'#3#136#0#5'Width'#3#129#1#10'BevelOuter'#7#9
|
||||
+'bvLowered'#7'Caption'#6#12'AaBbCcXxYyZz'#8'TabOrder'#2#1#0#0#5'TEdit'#10'ED'
|
||||
+'FontSize'#4'Left'#3'p'#1#6'Height'#2#21#3'Top'#2#31#5'Width'#2'!'#6'OnExit'
|
||||
+#7#14'EDFontSizeExit'#8'TabOrder'#2#2#0#0#9'TCheckBox'#15'CBFontStyleBold'#4
|
||||
+'Left'#2#16#6'Height'#2#17#3'Top'#2'@'#5'Width'#2'&'#7'Caption'#6#4'Bold'#7
|
||||
+'OnClick'#7#16'CoBFontNameClick'#8'TabOrder'#2#3#0#0#9'TCheckBox'#17'CBFontS'
|
||||
+'tyleItalic'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'X'#5'Width'#2')'#7'Caption'
|
||||
+#6#6'Italic'#7'OnClick'#7#16'CoBFontNameClick'#8'TabOrder'#2#4#0#0#0#9'TTabS'
|
||||
+'heet'#8'TSColors'#7'Caption'#6#6'Colors'#12'ClientHeight'#3'&'#1#11'ClientW'
|
||||
+'idth'#3#161#1#10'ImageIndex'#2#1#0#6'TLabel'#12'LBAttributes'#4'Left'#2#8#6
|
||||
+'Height'#2#14#3'Top'#2#8#5'Width'#2'5'#7'Caption'#6#11'Color item:'#12'Focus'
|
||||
+'Control'#7#9'LiBColors'#11'ParentColor'#8#0#0#8'TListBox'#9'LiBColors'#4'Le'
|
||||
+'ft'#2#8#6'Height'#3#233#0#3'Top'#2#24#5'Width'#3#209#0#10'ItemHeight'#2#13#7
|
||||
+'OnClick'#7#14'LiBColorsClick'#10'OnDrawItem'#7#17'LiBColorsDrawItem'#11'OnM'
|
||||
+'ouseMove'#7#18'LiBColorsMouseMove'#5'Style'#7#16'lbOwnerDrawFixed'#8'TabOrd'
|
||||
+'er'#2#0#0#0#9'TGroupBox'#8'GBColors'#4'Left'#3#224#0#6'Height'#2'_'#3'Top'#2
|
||||
+#19#5'Width'#3#185#0#7'Caption'#6#16'Color assignment'#12'ClientHeight'#2'M'
|
||||
+#11'ClientWidth'#3#181#0#8'TabOrder'#2#1#0#6'TLabel'#8'LBHighFG'#4'Left'#2#10
|
||||
+#6'Height'#2#14#3'Top'#2#18#5'Width'#2'D'#7'Caption'#6#14'Current color:'#11
|
||||
+'ParentColor'#8#0#0#6'TShape'#7'SHColor'#4'Left'#2'p'#6'Height'#2'1'#3'Top'#2
|
||||
+#16#5'Width'#2'A'#0#0#7'TButton'#13'BUColorChange'#4'Left'#2#8#6'Height'#2#25
|
||||
+#3'Top'#2'('#5'Width'#2'K'#7'Caption'#6#9'Change...'#7'OnClick'#7#18'BUColor'
|
||||
+'ChangeClick'#8'TabOrder'#2#0#0#0#0#0#0#7'TButton'#4'BUOk'#4'Left'#3#19#1#6
|
||||
+'Height'#2#25#3'Top'#3'M'#1#5'Width'#2'K'#7'Caption'#6#3'&OK'#7'Default'#9#11
|
||||
+'ModalResult'#2#1#8'TabOrder'#2#2#0#0#7'TButton'#8'BuCancel'#4'Left'#3'f'#1#6
|
||||
+'Height'#2#25#3'Top'#3'M'#1#5'Width'#2'K'#6'Cancel'#9#7'Caption'#6#6'Cancel'
|
||||
+#11'ModalResult'#2#2#8'TabOrder'#2#3#0#0#7'TButton'#9'BUDefault'#4'Left'#2#8
|
||||
+#6'Height'#2#25#3'Top'#3'M'#1#5'Width'#2'K'#7'Caption'#6#8'Defaults'#7'OnCli'
|
||||
+'ck'#7#14'BUDefaultClick'#8'TabOrder'#2#1#0#0#12'TColorDialog'#8'CDChange'#5
|
||||
+'Color'#7#7'clBlack'#20'CustomColors.Strings'#1#6#13'ColorA=000000'#6#13'Col'
|
||||
+'orB=000080'#6#13'ColorC=008000'#6#13'ColorD=008080'#6#13'ColorE=800000'#6#13
|
||||
+'ColorF=800080'#6#13'ColorG=808000'#6#13'ColorH=808080'#6#13'ColorI=C0C0C0'#6
|
||||
+#13'ColorJ=0000FF'#6#13'ColorK=00FF00'#6#13'ColorL=00FFFF'#6#13'ColorM=FF000'
|
||||
,'0'#6#13'ColorN=FF00FF'#6#13'ColorO=FFFF00'#6#13'ColorP=FFFFFF'#6#13'ColorQ='
|
||||
+'C0DCC0'#6#13'ColorR=F0CAA6'#6#13'ColorS=F0FBFF'#6#13'ColorT=A4A0A0'#0#4'lef'
|
||||
+'t'#3#148#1#0#0#0
|
||||
]);
|
289
applications/khexeditor/options.pas
Normal file
289
applications/khexeditor/options.pas
Normal file
@ -0,0 +1,289 @@
|
||||
unit Options;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
StdCtrls, ComCtrls, ExtCtrls, KControls, KHexEditor, Basic;
|
||||
|
||||
type
|
||||
|
||||
{ TOptionsForm }
|
||||
|
||||
TOptionsForm = class(TForm)
|
||||
BUOk: TButton;
|
||||
BuCancel: TButton;
|
||||
PCMain: TPageControl;
|
||||
TSEditorOptions: TTabSheet;
|
||||
TSColors: TTabSheet;
|
||||
LiBColors: TListBox;
|
||||
LBAttributes: TLabel;
|
||||
GBGeneral: TGroupBox;
|
||||
CBDropFiles: TCheckBox;
|
||||
CBUndoAfterSave: TCheckBox;
|
||||
GBColors: TGroupBox;
|
||||
LBHighFG: TLabel;
|
||||
TSEditorFont: TTabSheet;
|
||||
CoBFontName: TComboBox;
|
||||
LBFontName: TLabel;
|
||||
PNFontSample: TPanel;
|
||||
LBSample: TLabel;
|
||||
BUDefault: TButton;
|
||||
CBGroupUndo: TCheckBox;
|
||||
RGAddressMode: TRadioGroup;
|
||||
RGDisabledDrawStyle: TRadioGroup;
|
||||
GBAppearance: TGroupBox;
|
||||
CBShowAddress: TCheckBox;
|
||||
CBShowDigits: TCheckBox;
|
||||
CBShowText: TCheckBox;
|
||||
CBShowHorzLines: TCheckBox;
|
||||
CBShowVertLines: TCheckBox;
|
||||
CBShowSeparators: TCheckBox;
|
||||
CBShowInactiveCaret: TCheckBox;
|
||||
BUColorChange: TButton;
|
||||
LBAddressPrefix: TLabel;
|
||||
EDAddressPrefix: TEdit;
|
||||
EDAddressSize: TEdit;
|
||||
LBAddressSize: TLabel;
|
||||
LBCharSpacing: TLabel;
|
||||
EDCharSpacing: TEdit;
|
||||
LBDigitGrouping: TLabel;
|
||||
EDDigitGrouping: TEdit;
|
||||
EDLineSize: TEdit;
|
||||
LBLineSize: TLabel;
|
||||
LBbytes: TLabel;
|
||||
LBpoints: TLabel;
|
||||
LBbytes2: TLabel;
|
||||
LBLineHeightPercent: TLabel;
|
||||
EDLineHeightPercent: TEdit;
|
||||
LBpercent: TLabel;
|
||||
LBUndoLimit: TLabel;
|
||||
EDUndoLimit: TEdit;
|
||||
LBFontSize: TLabel;
|
||||
EDFontSize: TEdit;
|
||||
SHColor: TShape;
|
||||
CBFontStyleBold: TCheckBox;
|
||||
CBFontStyleItalic: TCheckBox;
|
||||
CDChange: TColorDialog;
|
||||
procedure CoBFontNameClick(Sender: TObject);
|
||||
procedure BUDefaultClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure EDFontSizeExit(Sender: TObject);
|
||||
procedure LiBColorsClick(Sender: TObject);
|
||||
procedure BUColorChangeClick(Sender: TObject);
|
||||
procedure LiBColorsDrawItem(Control: TWinControl; Index: Integer;
|
||||
Rect: TRect; State: TOwnerDrawState);
|
||||
procedure LiBColorsMouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
Y: Integer);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
private
|
||||
FColors: TKColorArray;
|
||||
procedure UpdateFontSample;
|
||||
public
|
||||
procedure SetData(const Data: TEnvironment; AColors: TKColorArray);
|
||||
procedure GetData(var Data: TEnvironment; AColors: TKColorArray);
|
||||
end;
|
||||
|
||||
var
|
||||
OptionsForm: TOptionsForm;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
{ TOptionsForm }
|
||||
|
||||
procedure TOptionsForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
I: TKHexEditorColorIndex;
|
||||
begin
|
||||
PCMain.ActivePageIndex := 0;
|
||||
InitColors(FColors);
|
||||
for I := 0 to Length(FColors) - 1 do
|
||||
LiBColors.Items.Add(GetColorSpec(I).Name);
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.GetData(var Data: TEnvironment; AColors: TKColorArray);
|
||||
begin
|
||||
with Data do
|
||||
begin
|
||||
P.DropFiles := CBDropFiles.Checked;
|
||||
P.GroupUndo := CBGroupUndo.Checked;
|
||||
P.UndoAfterSave := CBUndoAfterSave.Checked;
|
||||
P.ShowAddress := CBShowAddress.Checked;
|
||||
P.ShowDigits := CBShowDigits.Checked;
|
||||
P.ShowText := CBShowText.Checked;
|
||||
P.ShowHorzLines := CBShowHorzLines.Checked;
|
||||
P.ShowVertLines := CBShowVertLines.Checked;
|
||||
P.ShowSeparators := CBShowSeparators.Checked;
|
||||
P.ShowInactiveCaret := CBShowInactiveCaret.Checked;
|
||||
P.AddressMode := RGAddressMode.ItemIndex;
|
||||
AddressPrefix := EDAddressPrefix.Text;
|
||||
P.AddressSize := StrToIntDef(EDAddressSize.Text, P.AddressSize);
|
||||
P.CharSpacing := StrToIntDef(EDCharSpacing.Text, P.CharSpacing);
|
||||
P.DigitGrouping := StrToIntDef(EDDigitGrouping.Text, P.DigitGrouping);
|
||||
P.DisabledDrawStyle := RGDisabledDrawStyle.ItemIndex;
|
||||
P.LineHeightPercent := StrToIntDef(EDLineHeightPercent.Text, P.LineHeightPercent);
|
||||
P.LineSize := StrToIntDef(EDLineSize.Text, P.LineSize);
|
||||
P.UndoLimit := StrToIntDef(EDUndoLimit.Text, P.UndoLimit);
|
||||
FontName := CoBFontName.Text;
|
||||
P.FontSize := StrToIntDef(EDFontSize.Text, P.FontSize);
|
||||
P.FontStyle := [];
|
||||
if CBFontStyleBold.Checked then Include(P.FontStyle, fsBold);
|
||||
if CBFontStyleItalic.Checked then Include(P.FontStyle, fsItalic);
|
||||
CopyColors(FColors, AColors);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.SetData(const Data: TEnvironment; AColors: TKColorArray);
|
||||
begin
|
||||
with Data do
|
||||
begin
|
||||
CBDropFiles.Checked := P.DropFiles;
|
||||
CBGroupUndo.Checked := P.GroupUndo;
|
||||
CBUndoAfterSave.Checked := P.UndoAfterSave;
|
||||
CBShowAddress.Checked := P.ShowAddress;
|
||||
CBShowDigits.Checked := P.ShowDigits;
|
||||
CBShowText.Checked := P.ShowText;
|
||||
CBShowHorzLines.Checked := P.ShowHorzLines;
|
||||
CBShowVertLines.Checked := P.ShowVertLines;
|
||||
CBShowSeparators.Checked := P.ShowSeparators;
|
||||
CBShowInactiveCaret.Checked := P.ShowInactiveCaret;
|
||||
RGAddressMode.ItemIndex := P.AddressMode;
|
||||
EDAddressPrefix.Text := AddressPrefix;
|
||||
EDAddressSize.Text := IntToStr(P.AddressSize);
|
||||
EDCharSpacing.Text := IntToStr(P.CharSpacing);
|
||||
EDDigitGrouping.Text := IntToStr(P.DigitGrouping);
|
||||
RGDisabledDrawStyle.ItemIndex := P.DisabledDrawStyle;
|
||||
EDLineHeightPercent.Text := IntToSTr(P.LineHeightPercent);
|
||||
EDLineSize.Text := IntToStr(P.LineSize);
|
||||
EDUndoLimit.Text := IntToStr(P.UndoLimit);
|
||||
CobFontName.Items.Clear;
|
||||
AddFontsToList(Canvas.Handle, CoBFontName.Items, fpFixed);
|
||||
CoBFontName.ItemIndex := Max(CoBFontName.Items.IndexOf(FontName), Min(0, CobFontName.Items.Count - 1));
|
||||
EDFontSize.Text := IntToStr(P.FontSize);
|
||||
CBFontStyleBold.Checked := fsBold in P.FontStyle;
|
||||
CBFontStyleItalic.Checked := fsItalic in P.FontStyle;
|
||||
UpdateFontSample;
|
||||
CopyColors(AColors, FColors);
|
||||
LiBColors.Invalidate;
|
||||
if LiBColors.ItemIndex < 0 then LiBColors.ItemIndex := 0;
|
||||
LiBColorsClick(nil);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.UpdateFontSample;
|
||||
var
|
||||
Ok: Boolean;
|
||||
FontStyle: TFontStyles;
|
||||
begin
|
||||
if CoBFontName.Text <> '' then
|
||||
begin
|
||||
Ok := True;
|
||||
with PNFontSample.Font do
|
||||
begin
|
||||
Name := CoBFontName.Text;
|
||||
Size := EditStrToInt(Self.Handle, EDFontSize, cFontSizeMin, cFontSizeMax, cFontSizeDef, Ok);
|
||||
FontStyle := [];
|
||||
if CBFontStyleBold.Checked then Include(FontStyle, fsBold);
|
||||
if CBFontStyleItalic.Checked then Include(FontStyle, fsItalic);
|
||||
Style := FontStyle;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.CoBFontNameClick(Sender: TObject);
|
||||
begin
|
||||
UpdateFontSample;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.EDFontSizeExit(Sender: TObject);
|
||||
begin
|
||||
UpdateFontSample;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.BUDefaultClick(Sender: TObject);
|
||||
var
|
||||
AEnv: TEnvironment;
|
||||
AColors: TKColorArray;
|
||||
begin
|
||||
InitEnvironment(AEnv);
|
||||
InitColors(AColors);
|
||||
SetData(AEnv, AColors);
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.BUColorChangeClick(Sender: TObject);
|
||||
begin
|
||||
CDChange.Color := FColors[TKHexEditorColorIndex(LiBColors.ItemIndex)];
|
||||
if CDChange.Execute then
|
||||
begin
|
||||
FColors[TKHexEditorColorIndex(LiBColors.ItemIndex)] := CDChange.Color;
|
||||
LiBColors.Invalidate;
|
||||
LiBColorsClick(nil);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.LiBColorsClick(Sender: TObject);
|
||||
begin
|
||||
SHColor.Brush.Color := FColors[TKHexEditorColorIndex(LiBColors.ItemIndex)];
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.LiBColorsDrawItem(Control: TWinControl;
|
||||
Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
||||
begin
|
||||
with (Control as TListBox).Canvas do
|
||||
begin
|
||||
FillRect(Rect);
|
||||
Brush.Color := FColors[TKHexEditorColorIndex(Index)];
|
||||
Pen.Color := clWindowText;
|
||||
Rectangle(Rect.Left + 2, Rect.Top + 1, Rect.Left + 16, Rect.Bottom - 1);
|
||||
SetBKMode(Handle, TRANSPARENT);
|
||||
TextOut(Rect.Left + 20, Rect.Top, LiBColors.Items[Index]);
|
||||
// to ensure coming DrawFocusRect will be painted correctly:
|
||||
SetBkColor(Handle, ColorToRGB(clWindow));
|
||||
SetTextColor(Handle, ColorToRGB(clWindowText));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.LiBColorsMouseMove(Sender: TObject;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if (ssLeft in Shift) then
|
||||
LiBColorsClick(nil);
|
||||
end;
|
||||
|
||||
procedure TOptionsForm.FormCloseQuery(Sender: TObject;
|
||||
var CanClose: Boolean);
|
||||
var
|
||||
Ok: Boolean;
|
||||
begin
|
||||
if ModalResult = mrOk then
|
||||
begin
|
||||
Ok := True;
|
||||
EditStrToInt(Handle, EDAddressSize, cAddressSizeMin, cAddressSizeMax, cAddressSizeDef, Ok);
|
||||
EditStrToInt(Handle, EDCharSpacing, cCharSpacingMin, cCharSpacingMax, cCharSpacingDef, Ok);
|
||||
EditStrToInt(Handle, EDDigitGrouping, cDigitGroupingMin, cDigitGroupingMax, cDigitGroupingDef, Ok);
|
||||
EditStrToInt(Handle, EDLineHeightPercent, cLineHeightPercentMin, cLineHeightPercentMax, cLineHeightPercentDef, Ok);
|
||||
EditStrToInt(Handle, EDLineSize, cLineSizeMin, cLineSizeMax, cLineSizeDef, Ok);
|
||||
EditStrToInt(Handle, EDUndoLimit, cUndoLimitMin, cUndoLimitMax, cUndoLimitDef, Ok);
|
||||
EditStrToInt(Handle, EDFontSize, cFontSizeMin, cFontSizeMax, cFontSizeDef, Ok);
|
||||
CanClose := Ok;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i options.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
||||
|
33
applications/khexeditor/printstatus.lfm
Normal file
33
applications/khexeditor/printstatus.lfm
Normal file
@ -0,0 +1,33 @@
|
||||
object PrintStatusForm: TPrintStatusForm
|
||||
Left = 1299
|
||||
Height = 80
|
||||
Top = 933
|
||||
Width = 248
|
||||
BorderIcons = []
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Print status'
|
||||
ClientHeight = 80
|
||||
ClientWidth = 248
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
FormStyle = fsStayOnTop
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
object LBPage: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 16
|
||||
Width = 36
|
||||
Caption = 'LBPage'
|
||||
ParentColor = False
|
||||
end
|
||||
object BUAbort: TButton
|
||||
Left = 88
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 75
|
||||
Caption = '&Abort'
|
||||
OnClick = BUAbortClick
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
13
applications/khexeditor/printstatus.lrs
Normal file
13
applications/khexeditor/printstatus.lrs
Normal file
@ -0,0 +1,13 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TPrintStatusForm','FORMDATA',[
|
||||
'TPF0'#16'TPrintStatusForm'#15'PrintStatusForm'#4'Left'#3#19#5#6'Height'#2'P'
|
||||
+#3'Top'#3#165#3#5'Width'#3#248#0#11'BorderIcons'#11#0#11'BorderStyle'#7#8'bs'
|
||||
+'Dialog'#7'Caption'#6#12'Print status'#12'ClientHeight'#2'P'#11'ClientWidth'
|
||||
+#3#248#0#11'Font.Height'#2#245#9'Font.Name'#6#6'Tahoma'#9'FormStyle'#7#11'fs'
|
||||
+'StayOnTop'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#6
|
||||
+'TLabel'#6'LBPage'#4'Left'#2#8#6'Height'#2#14#3'Top'#2#16#5'Width'#2'$'#7'Ca'
|
||||
+'ption'#6#6'LBPage'#11'ParentColor'#8#0#0#7'TButton'#7'BUAbort'#4'Left'#2'X'
|
||||
+#6'Height'#2#25#3'Top'#2'0'#5'Width'#2'K'#7'Caption'#6#6'&Abort'#7'OnClick'#7
|
||||
+#12'BUAbortClick'#8'TabOrder'#2#0#0#0#0
|
||||
]);
|
44
applications/khexeditor/printstatus.pas
Normal file
44
applications/khexeditor/printstatus.pas
Normal file
@ -0,0 +1,44 @@
|
||||
unit PrintStatus;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls;
|
||||
|
||||
type
|
||||
TPrintStatusForm = class(TForm)
|
||||
BUAbort: TButton;
|
||||
LBPage: TLabel;
|
||||
procedure BUAbortClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
Aborted: Boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
PrintStatusForm: TPrintStatusForm;
|
||||
|
||||
implementation
|
||||
|
||||
procedure TPrintStatusForm.BUAbortClick(Sender: TObject);
|
||||
begin
|
||||
Aborted := True;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i printstatus.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
82
applications/khexeditor/replace.lfm
Normal file
82
applications/khexeditor/replace.lfm
Normal file
@ -0,0 +1,82 @@
|
||||
inherited ReplaceForm: TReplaceForm
|
||||
Left = 1582
|
||||
Height = 269
|
||||
Top = 808
|
||||
Caption = 'Replace Text'
|
||||
ClientHeight = 269
|
||||
OnShow = FormShow
|
||||
inherited CBTextToFind: TComboBox
|
||||
Left = 80
|
||||
Width = 241
|
||||
OnChange = CBTextToFindChange
|
||||
end
|
||||
inherited GBOptions: TGroupBox
|
||||
Height = 85
|
||||
Top = 72
|
||||
ClientHeight = 67
|
||||
TabOrder = 2
|
||||
object CBPromptOnReplace: TCheckBox[2]
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 44
|
||||
Width = 105
|
||||
Caption = '&Prompt on replace'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
inherited BUFind: TButton
|
||||
Left = 60
|
||||
Top = 236
|
||||
Caption = '&Replace'
|
||||
OnClick = CBTextToReplaceClick
|
||||
TabOrder = 6
|
||||
end
|
||||
inherited BUCancel: TButton
|
||||
Left = 244
|
||||
Top = 236
|
||||
TabOrder = 8
|
||||
end
|
||||
inherited GBDirection: TGroupBox
|
||||
Height = 65
|
||||
Top = 72
|
||||
ClientHeight = 47
|
||||
TabOrder = 3
|
||||
end
|
||||
inherited GBScope: TGroupBox
|
||||
Top = 164
|
||||
TabOrder = 4
|
||||
end
|
||||
inherited GBOrigin: TGroupBox
|
||||
Top = 164
|
||||
TabOrder = 5
|
||||
end
|
||||
object LBReplaceText: TLabel[8]
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 44
|
||||
Width = 66
|
||||
Caption = 'Rep&lace with:'
|
||||
FocusControl = CBTextToReplace
|
||||
ParentColor = False
|
||||
end
|
||||
object CBTextToReplace: TComboBox[9]
|
||||
Left = 80
|
||||
Height = 21
|
||||
Top = 40
|
||||
Width = 241
|
||||
ItemHeight = 13
|
||||
OnSelect = CBTextToReplaceClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object BUReplaceAll: TButton[10]
|
||||
Left = 144
|
||||
Height = 25
|
||||
Top = 236
|
||||
Width = 89
|
||||
Caption = 'Replace &All'
|
||||
ModalResult = 10
|
||||
TabOrder = 7
|
||||
end
|
||||
end
|
25
applications/khexeditor/replace.lrs
Normal file
25
applications/khexeditor/replace.lrs
Normal file
@ -0,0 +1,25 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TReplaceForm','FORMDATA',[
|
||||
'TPF0'#241#12'TReplaceForm'#11'ReplaceForm'#4'Left'#3'.'#6#6'Height'#3#13#1#3
|
||||
+'Top'#3'('#3#7'Caption'#6#12'Replace Text'#12'ClientHeight'#3#13#1#6'OnShow'
|
||||
+#7#8'FormShow'#0#241#9'TComboBox'#12'CBTextToFind'#4'Left'#2'P'#5'Width'#3
|
||||
+#241#0#8'OnChange'#7#18'CBTextToFindChange'#0#0#241#9'TGroupBox'#9'GBOptions'
|
||||
+#6'Height'#2'U'#3'Top'#2'H'#12'ClientHeight'#2'C'#8'TabOrder'#2#2#0#242#2#2#9
|
||||
+'TCheckBox'#17'CBPromptOnReplace'#4'Left'#2#8#6'Height'#2#17#3'Top'#2','#5'W'
|
||||
+'idth'#2'i'#7'Caption'#6#18'&Prompt on replace'#7'Checked'#9#5'State'#7#9'cb'
|
||||
+'Checked'#8'TabOrder'#2#2#0#0#0#241#7'TButton'#6'BUFind'#4'Left'#2'<'#3'Top'
|
||||
+#3#236#0#7'Caption'#6#8'&Replace'#7'OnClick'#7#20'CBTextToReplaceClick'#8'Ta'
|
||||
+'bOrder'#2#6#0#0#241#7'TButton'#8'BUCancel'#4'Left'#3#244#0#3'Top'#3#236#0#8
|
||||
+'TabOrder'#2#8#0#0#241#9'TGroupBox'#11'GBDirection'#6'Height'#2'A'#3'Top'#2
|
||||
+'H'#12'ClientHeight'#2'/'#8'TabOrder'#2#3#0#0#241#9'TGroupBox'#7'GBScope'#3
|
||||
+'Top'#3#164#0#8'TabOrder'#2#4#0#0#241#9'TGroupBox'#8'GBOrigin'#3'Top'#3#164#0
|
||||
+#8'TabOrder'#2#5#0#0#242#2#8#6'TLabel'#13'LBReplaceText'#4'Left'#2#8#6'Heigh'
|
||||
+'t'#2#14#3'Top'#2','#5'Width'#2'B'#7'Caption'#6#14'Rep&lace with:'#12'FocusC'
|
||||
+'ontrol'#7#15'CBTextToReplace'#11'ParentColor'#8#0#0#242#2#9#9'TComboBox'#15
|
||||
+'CBTextToReplace'#4'Left'#2'P'#6'Height'#2#21#3'Top'#2'('#5'Width'#3#241#0#10
|
||||
+'ItemHeight'#2#13#8'OnSelect'#7#20'CBTextToReplaceClick'#8'TabOrder'#2#1#0#0
|
||||
+#242#2#10#7'TButton'#12'BUReplaceAll'#4'Left'#3#144#0#6'Height'#2#25#3'Top'#3
|
||||
+#236#0#5'Width'#2'Y'#7'Caption'#6#12'Replace &All'#11'ModalResult'#2#10#8'Ta'
|
||||
+'bOrder'#2#7#0#0#0
|
||||
]);
|
83
applications/khexeditor/replace.pas
Normal file
83
applications/khexeditor/replace.pas
Normal file
@ -0,0 +1,83 @@
|
||||
unit Replace;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
StdCtrls, KEditCommon, Search;
|
||||
|
||||
type
|
||||
|
||||
{ TReplaceForm }
|
||||
|
||||
TReplaceForm = class(TSearchForm)
|
||||
LBReplaceText: TLabel;
|
||||
CBTextToReplace: TComboBox;
|
||||
BUReplaceAll: TButton;
|
||||
CBPromptOnReplace: TCheckBox;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure CBTextToReplaceClick(Sender: TObject);
|
||||
procedure CBTextToFindChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
procedure GetData(var Data: TKEditSearchData); override;
|
||||
procedure SetData(const Data: TKEditSearchData; SelAvail: Boolean); override;
|
||||
end;
|
||||
|
||||
var
|
||||
ReplaceForm: TReplaceForm;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
procedure TReplaceForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
CBTextToFindChange(Sender);
|
||||
end;
|
||||
|
||||
procedure TReplaceForm.CBTextToFindChange(Sender: TObject);
|
||||
begin
|
||||
BUFind.Enabled := (CBTextToFind.Text <> '');
|
||||
BUReplaceAll.Enabled := BUFind.Enabled;
|
||||
end;
|
||||
|
||||
procedure TReplaceForm.CBTextToReplaceClick(Sender: TObject);
|
||||
begin
|
||||
if (CBTextToReplace.Text <> '') and
|
||||
(CBTextToReplace.Items.IndexOf(CBTextToReplace.Text) < 0) then
|
||||
CBTextToReplace.Items.Insert(0, CBTextToReplace.Text);
|
||||
end;
|
||||
|
||||
procedure TReplaceForm.GetData(var Data: TKEditSearchData);
|
||||
begin
|
||||
inherited;
|
||||
with Data do
|
||||
begin
|
||||
if CBPromptOnReplace.Checked then Include(Options, esoPrompt);
|
||||
TextToReplace := CBTextToReplace.Text;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TReplaceForm.SetData(const Data: TKEditSearchData; SelAvail: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
with Data do
|
||||
CBPromptOnReplace.Checked := esoPrompt in Options;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i replace.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
58
applications/khexeditor/replaceprompt.lfm
Normal file
58
applications/khexeditor/replaceprompt.lfm
Normal file
@ -0,0 +1,58 @@
|
||||
object ReplacePromptForm: TReplacePromptForm
|
||||
Left = 1530
|
||||
Height = 90
|
||||
Top = 1046
|
||||
Width = 365
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Confirm'
|
||||
ClientHeight = 90
|
||||
ClientWidth = 365
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
object LBText: TLabel
|
||||
Left = 16
|
||||
Height = 14
|
||||
Top = 16
|
||||
Width = 8
|
||||
Caption = 'A'
|
||||
ParentColor = False
|
||||
end
|
||||
object BUYes: TButton
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 75
|
||||
Caption = 'Yes'
|
||||
ModalResult = 6
|
||||
TabOrder = 0
|
||||
end
|
||||
object BuNo: TButton
|
||||
Left = 104
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 75
|
||||
Caption = 'No'
|
||||
ModalResult = 7
|
||||
TabOrder = 1
|
||||
end
|
||||
object BUAll: TButton
|
||||
Left = 192
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 75
|
||||
Caption = 'All'
|
||||
ModalResult = 10
|
||||
TabOrder = 2
|
||||
end
|
||||
object BUCancel: TButton
|
||||
Left = 280
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 75
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
17
applications/khexeditor/replaceprompt.lrs
Normal file
17
applications/khexeditor/replaceprompt.lrs
Normal file
@ -0,0 +1,17 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TReplacePromptForm','FORMDATA',[
|
||||
'TPF0'#18'TReplacePromptForm'#17'ReplacePromptForm'#4'Left'#3#250#5#6'Height'
|
||||
+#2'Z'#3'Top'#3#22#4#5'Width'#3'm'#1#11'BorderStyle'#7#8'bsDialog'#7'Caption'
|
||||
+#6#7'Confirm'#12'ClientHeight'#2'Z'#11'ClientWidth'#3'm'#1#11'Font.Height'#2
|
||||
+#245#9'Font.Name'#6#6'Tahoma'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'
|
||||
+#6#6'0.9.29'#0#6'TLabel'#6'LBText'#4'Left'#2#16#6'Height'#2#14#3'Top'#2#16#5
|
||||
+'Width'#2#8#7'Caption'#6#1'A'#11'ParentColor'#8#0#0#7'TButton'#5'BUYes'#4'Le'
|
||||
+'ft'#2#16#6'Height'#2#25#3'Top'#2'0'#5'Width'#2'K'#7'Caption'#6#3'Yes'#11'Mo'
|
||||
+'dalResult'#2#6#8'TabOrder'#2#0#0#0#7'TButton'#4'BuNo'#4'Left'#2'h'#6'Height'
|
||||
+#2#25#3'Top'#2'0'#5'Width'#2'K'#7'Caption'#6#2'No'#11'ModalResult'#2#7#8'Tab'
|
||||
+'Order'#2#1#0#0#7'TButton'#5'BUAll'#4'Left'#3#192#0#6'Height'#2#25#3'Top'#2
|
||||
+'0'#5'Width'#2'K'#7'Caption'#6#3'All'#11'ModalResult'#2#10#8'TabOrder'#2#2#0
|
||||
+#0#7'TButton'#8'BUCancel'#4'Left'#3#24#1#6'Height'#2#25#3'Top'#2'0'#5'Width'
|
||||
+#2'K'#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#3#0#0#0
|
||||
]);
|
40
applications/khexeditor/replaceprompt.pas
Normal file
40
applications/khexeditor/replaceprompt.pas
Normal file
@ -0,0 +1,40 @@
|
||||
unit ReplacePrompt;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls;
|
||||
|
||||
type
|
||||
TReplacePromptForm = class(TForm)
|
||||
LBText: TLabel;
|
||||
BUYes: TButton;
|
||||
BuNo: TButton;
|
||||
BUAll: TButton;
|
||||
BUCancel: TButton;
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
ReplacePromptForm: TReplacePromptForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i replaceprompt.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
36
applications/khexeditor/res.pas
Normal file
36
applications/khexeditor/res.pas
Normal file
@ -0,0 +1,36 @@
|
||||
unit Res;
|
||||
|
||||
interface
|
||||
|
||||
resourcestring
|
||||
{main}
|
||||
sAppName = 'Hex Editor';
|
||||
sNeedSaveQuestion = 'File "%s" has been changed. Do you want to save it?';
|
||||
sStatusDigit = 'Digit: %d';
|
||||
sStatusPosDec = 'Pos: %d';
|
||||
sStatusPosHex = 'Pos: %x';
|
||||
sModified = 'Modified';
|
||||
sOverwrite = 'Overwrite';
|
||||
sInsert = 'Insert';
|
||||
sNoname = 'new file';
|
||||
sReplaceQuestion = 'Replace this occurence of "%s"?';
|
||||
sReplace = '&Replace';
|
||||
sReplaceAll = 'Replace &all';
|
||||
sReplaceSkip = '&Skip';
|
||||
sPrintedPageAndCopy = 'Printing page %d from %d. Actual copy: %d from %d.';
|
||||
|
||||
{printsetup}
|
||||
sPSAllPages = 'All pages (%d)';
|
||||
|
||||
{errors}
|
||||
sErrOpenError = 'Can''t open file "%s".';
|
||||
sErrSaveError = 'Can''t save file "%s".';
|
||||
sErrTextNotFound = 'The text "%s" was not found.';
|
||||
sErrNoDigitsInText = 'The text "%s" can''t be interpreted as hexadecimal digits.';
|
||||
sErrIntegerValue = 'Bad integer value.';
|
||||
sErrIntegerValueOutOfRange = 'Integer value out of range %d to %d.';
|
||||
sErrNoPrinterInstalled = 'No printer is installed on this computer.';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
167
applications/khexeditor/search.lfm
Normal file
167
applications/khexeditor/search.lfm
Normal file
@ -0,0 +1,167 @@
|
||||
object SearchForm: TSearchForm
|
||||
Left = 1005
|
||||
Height = 204
|
||||
Top = 825
|
||||
Width = 330
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Find Text'
|
||||
ClientHeight = 204
|
||||
ClientWidth = 330
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
object LBFindText: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 12
|
||||
Width = 61
|
||||
Caption = '&Text to find:'
|
||||
FocusControl = CBTextToFind
|
||||
ParentColor = False
|
||||
end
|
||||
object CBTextToFind: TComboBox
|
||||
Left = 72
|
||||
Height = 21
|
||||
Top = 8
|
||||
Width = 249
|
||||
ItemHeight = 13
|
||||
OnChange = CBTextToFindChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object GBOptions: TGroupBox
|
||||
Left = 8
|
||||
Height = 61
|
||||
Top = 36
|
||||
Width = 173
|
||||
Caption = 'Options'
|
||||
ClientHeight = 43
|
||||
ClientWidth = 169
|
||||
TabOrder = 1
|
||||
object CBMatchCase: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 4
|
||||
Width = 87
|
||||
Caption = '&Case sensitive'
|
||||
TabOrder = 0
|
||||
end
|
||||
object CBHexaSearch: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 24
|
||||
Width = 120
|
||||
Caption = 'As he&xadecimal digits'
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object BUFind: TButton
|
||||
Left = 164
|
||||
Height = 25
|
||||
Top = 172
|
||||
Width = 75
|
||||
Caption = '&Find'
|
||||
Default = True
|
||||
ModalResult = 6
|
||||
OnClick = BUFindClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object BUCancel: TButton
|
||||
Left = 248
|
||||
Height = 25
|
||||
Top = 172
|
||||
Width = 75
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object GBDirection: TGroupBox
|
||||
Left = 192
|
||||
Height = 61
|
||||
Top = 36
|
||||
Width = 129
|
||||
Caption = 'Direction'
|
||||
ClientHeight = 43
|
||||
ClientWidth = 125
|
||||
TabOrder = 4
|
||||
object RBForward: TRadioButton
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 4
|
||||
Width = 58
|
||||
Caption = 'Forwar&d'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 0
|
||||
end
|
||||
object RBBackward: TRadioButton
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 24
|
||||
Width = 64
|
||||
Caption = '&Backward'
|
||||
TabOrder = 1
|
||||
TabStop = False
|
||||
end
|
||||
end
|
||||
object GBScope: TGroupBox
|
||||
Left = 8
|
||||
Height = 61
|
||||
Top = 104
|
||||
Width = 173
|
||||
Caption = 'Scope'
|
||||
ClientHeight = 43
|
||||
ClientWidth = 169
|
||||
TabOrder = 5
|
||||
object RBGlobal: TRadioButton
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 4
|
||||
Width = 47
|
||||
Caption = '&Global'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 0
|
||||
end
|
||||
object RBSelectedOnly: TRadioButton
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 24
|
||||
Width = 82
|
||||
Caption = '&Selected only'
|
||||
TabOrder = 1
|
||||
TabStop = False
|
||||
end
|
||||
end
|
||||
object GBOrigin: TGroupBox
|
||||
Left = 192
|
||||
Height = 61
|
||||
Top = 104
|
||||
Width = 129
|
||||
Caption = 'Origin'
|
||||
ClientHeight = 43
|
||||
ClientWidth = 125
|
||||
TabOrder = 6
|
||||
object RBFromCursor: TRadioButton
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 4
|
||||
Width = 75
|
||||
Caption = 'Fro&m cursor'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 0
|
||||
end
|
||||
object RBEntireScope: TRadioButton
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 24
|
||||
Width = 77
|
||||
Caption = '&Entire scope'
|
||||
TabOrder = 1
|
||||
TabStop = False
|
||||
end
|
||||
end
|
||||
end
|
43
applications/khexeditor/search.lrs
Normal file
43
applications/khexeditor/search.lrs
Normal file
@ -0,0 +1,43 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TSearchForm','FORMDATA',[
|
||||
'TPF0'#11'TSearchForm'#10'SearchForm'#4'Left'#3#237#3#6'Height'#3#204#0#3'Top'
|
||||
+#3'9'#3#5'Width'#3'J'#1#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#9'Find Te'
|
||||
+'xt'#12'ClientHeight'#3#204#0#11'ClientWidth'#3'J'#1#11'Font.Height'#2#245#9
|
||||
+'Font.Name'#6#6'Tahoma'#6'OnShow'#7#8'FormShow'#8'Position'#7#14'poScreenCen'
|
||||
+'ter'#10'LCLVersion'#6#6'0.9.29'#0#6'TLabel'#10'LBFindText'#4'Left'#2#8#6'He'
|
||||
+'ight'#2#14#3'Top'#2#12#5'Width'#2'='#7'Caption'#6#14'&Text to find:'#12'Foc'
|
||||
+'usControl'#7#12'CBTextToFind'#11'ParentColor'#8#0#0#9'TComboBox'#12'CBTextT'
|
||||
+'oFind'#4'Left'#2'H'#6'Height'#2#21#3'Top'#2#8#5'Width'#3#249#0#10'ItemHeigh'
|
||||
+'t'#2#13#8'OnChange'#7#18'CBTextToFindChange'#8'TabOrder'#2#0#0#0#9'TGroupBo'
|
||||
+'x'#9'GBOptions'#4'Left'#2#8#6'Height'#2'='#3'Top'#2'$'#5'Width'#3#173#0#7'C'
|
||||
+'aption'#6#7'Options'#12'ClientHeight'#2'+'#11'ClientWidth'#3#169#0#8'TabOrd'
|
||||
+'er'#2#1#0#9'TCheckBox'#11'CBMatchCase'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#4
|
||||
+#5'Width'#2'W'#7'Caption'#6#15'&Case sensitive'#8'TabOrder'#2#0#0#0#9'TCheck'
|
||||
+'Box'#12'CBHexaSearch'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#24#5'Width'#2'x'#7
|
||||
+'Caption'#6#22'As he&xadecimal digits'#8'TabOrder'#2#1#0#0#0#7'TButton'#6'BU'
|
||||
+'Find'#4'Left'#3#164#0#6'Height'#2#25#3'Top'#3#172#0#5'Width'#2'K'#7'Caption'
|
||||
+#6#5'&Find'#7'Default'#9#11'ModalResult'#2#6#7'OnClick'#7#11'BUFindClick'#8
|
||||
+'TabOrder'#2#2#0#0#7'TButton'#8'BUCancel'#4'Left'#3#248#0#6'Height'#2#25#3'T'
|
||||
+'op'#3#172#0#5'Width'#2'K'#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'
|
||||
+#2#2#8'TabOrder'#2#3#0#0#9'TGroupBox'#11'GBDirection'#4'Left'#3#192#0#6'Heig'
|
||||
+'ht'#2'='#3'Top'#2'$'#5'Width'#3#129#0#7'Caption'#6#9'Direction'#12'ClientHe'
|
||||
+'ight'#2'+'#11'ClientWidth'#2'}'#8'TabOrder'#2#4#0#12'TRadioButton'#9'RBForw'
|
||||
+'ard'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#4#5'Width'#2':'#7'Caption'#6#8'For'
|
||||
+'war&d'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioBu'
|
||||
+'tton'#10'RBBackward'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#24#5'Width'#2'@'#7
|
||||
+'Caption'#6#9'&Backward'#8'TabOrder'#2#1#7'TabStop'#8#0#0#0#9'TGroupBox'#7'G'
|
||||
+'BScope'#4'Left'#2#8#6'Height'#2'='#3'Top'#2'h'#5'Width'#3#173#0#7'Caption'#6
|
||||
+#5'Scope'#12'ClientHeight'#2'+'#11'ClientWidth'#3#169#0#8'TabOrder'#2#5#0#12
|
||||
+'TRadioButton'#8'RBGlobal'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#4#5'Width'#2
|
||||
+'/'#7'Caption'#6#7'&Global'#7'Checked'#9#5'State'#7#9'cbChecked'#8'TabOrder'
|
||||
+#2#0#0#0#12'TRadioButton'#14'RBSelectedOnly'#4'Left'#2#8#6'Height'#2#17#3'To'
|
||||
+'p'#2#24#5'Width'#2'R'#7'Caption'#6#14'&Selected only'#8'TabOrder'#2#1#7'Tab'
|
||||
+'Stop'#8#0#0#0#9'TGroupBox'#8'GBOrigin'#4'Left'#3#192#0#6'Height'#2'='#3'Top'
|
||||
+#2'h'#5'Width'#3#129#0#7'Caption'#6#6'Origin'#12'ClientHeight'#2'+'#11'Clien'
|
||||
+'tWidth'#2'}'#8'TabOrder'#2#6#0#12'TRadioButton'#12'RBFromCursor'#4'Left'#2#8
|
||||
+#6'Height'#2#17#3'Top'#2#4#5'Width'#2'K'#7'Caption'#6#12'Fro&m cursor'#7'Che'
|
||||
+'cked'#9#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioButton'#13'RBE'
|
||||
+'ntireScope'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#24#5'Width'#2'M'#7'Caption'
|
||||
+#6#13'&Entire scope'#8'TabOrder'#2#1#7'TabStop'#8#0#0#0#0
|
||||
]);
|
130
applications/khexeditor/search.pas
Normal file
130
applications/khexeditor/search.pas
Normal file
@ -0,0 +1,130 @@
|
||||
unit Search;
|
||||
|
||||
{$include kcontrols.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLType, LCLIntf, LResources,
|
||||
{$ELSE}
|
||||
Windows, Messages,
|
||||
{$ENDIF}
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
StdCtrls, KEditCommon;
|
||||
|
||||
type
|
||||
TSearchForm = class(TForm)
|
||||
CBTextToFind: TComboBox;
|
||||
GBOptions: TGroupBox;
|
||||
LBFindText: TLabel;
|
||||
BUFind: TButton;
|
||||
BUCancel: TButton;
|
||||
CBMatchCase: TCheckBox;
|
||||
CBHexaSearch: TCheckBox;
|
||||
GBDirection: TGroupBox;
|
||||
RBForward: TRadioButton;
|
||||
RBBackward: TRadioButton;
|
||||
GBScope: TGroupBox;
|
||||
RBGlobal: TRadioButton;
|
||||
RBSelectedOnly: TRadioButton;
|
||||
GBOrigin: TGroupBox;
|
||||
RBFromCursor: TRadioButton;
|
||||
RBEntireScope: TRadioButton;
|
||||
procedure BUFindClick(Sender: TObject);
|
||||
procedure CBTextToFindChange(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
procedure GetData(var Data: TKEditSearchData); virtual;
|
||||
procedure SetData(const Data: TKEditSearchData; SelAvail: Boolean); virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
SearchForm: TSearchForm;
|
||||
|
||||
function TrimToSize(const Text: string; Size: Integer): string;
|
||||
|
||||
implementation
|
||||
|
||||
uses Options;
|
||||
|
||||
function TrimToSize(const Text: string; Size: Integer): string;
|
||||
begin
|
||||
Result := Text;
|
||||
if (Size > 0) and (Length(Result) > Size) then
|
||||
begin
|
||||
SetLength(Result, Size);
|
||||
Result := Format('%s...', [Result]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSearchForm.BUFindClick(Sender: TObject);
|
||||
begin
|
||||
if CBTextToFind.Items.IndexOf(CBTextToFind.Text) < 0 then
|
||||
CBTextToFind.Items.Insert(0, CBTextToFind.Text);
|
||||
end;
|
||||
|
||||
procedure TSearchForm.CBTextToFindChange(Sender: TObject);
|
||||
begin
|
||||
BUFind.Enabled := CBTextToFind.Text <> '';
|
||||
end;
|
||||
|
||||
procedure TSearchForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
CBTextToFindChange(Sender);
|
||||
end;
|
||||
|
||||
procedure TSearchForm.GetData(var Data: TKEditSearchData);
|
||||
begin
|
||||
with Data do
|
||||
begin
|
||||
Options := [];
|
||||
if CBMatchCase.Checked then Include(Options, esoMatchCase);
|
||||
if CBHexaSearch.Checked then Include(Options, esoTreatAsDigits);
|
||||
if RBBackward.Checked then Include(Options, esoBackwards);
|
||||
if RBEntireScope.Checked then Include(Options, esoEntireScope);
|
||||
if RBSelectedOnly.Checked then Include(Options, esoSelectedOnly);
|
||||
TextToFind := CBTextToFind.Text;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSearchForm.SetData(const Data: TKEditSearchData; SelAvail: Boolean);
|
||||
begin
|
||||
ActiveControl := CBTextToFind;
|
||||
with Data do
|
||||
begin
|
||||
CBMatchCase.Checked := esoMatchCase in Options;
|
||||
CBHexaSearch.Checked := esoTreatAsDigits in Options;
|
||||
if esoBackwards in Options then
|
||||
RBBackward.Checked := True
|
||||
else
|
||||
RBForward.Checked := True;
|
||||
if esoEntireScope in Options then
|
||||
RBEntireScope.Checked := True
|
||||
else
|
||||
RBFromCursor.Checked := True;
|
||||
if SelAvail then
|
||||
begin
|
||||
RBSelectedOnly.Enabled := True;
|
||||
if esoSelectedOnly in Options then
|
||||
RBSelectedOnly.Checked := True
|
||||
else
|
||||
RBGlobal.Checked := True
|
||||
end else
|
||||
begin
|
||||
RBGlobal.Checked := True;
|
||||
RBSelectedOnly.Enabled := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
initialization
|
||||
{$i search.lrs}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
end.
|
Reference in New Issue
Block a user