mirror of
https://github.com/ngeor/Chameleon.git
synced 2025-12-19 09:53:43 +01:00
refactor: Hide implementation details of StrConsts
This commit is contained in:
parent
196462f11c
commit
810bf694b3
@ -4,7 +4,7 @@ root = true
|
|||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 2
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
max_line_length = 120
|
max_line_length = 120
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@
|
|||||||
*.compiled
|
*.compiled
|
||||||
*.bak
|
*.bak
|
||||||
*.lps
|
*.lps
|
||||||
|
backup/
|
||||||
|
|||||||
113
Chameleon.lpi
113
Chameleon.lpi
@ -1,124 +1,125 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="11" />
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\" />
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<MainUnitHasUsesSectionForAllUnits Value="False" />
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||||
<MainUnitHasCreateFormStatements Value="False" />
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
<MainUnitHasTitleStatement Value="False" />
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir" />
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0" />
|
<Title Value="Chameleon"/>
|
||||||
<Title Value="Chameleon" />
|
<UseAppBundle Value="False"/>
|
||||||
<UseAppBundle Value="False" />
|
<ResourceType Value="res"/>
|
||||||
<ResourceType Value="res" />
|
<UseXPManifest Value="True"/>
|
||||||
<UseXPManifest Value="True" />
|
|
||||||
<XPManifest>
|
<XPManifest>
|
||||||
<DpiAware Value="True" />
|
<DpiAware Value="True"/>
|
||||||
</XPManifest>
|
</XPManifest>
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N LFM="False" />
|
<EnableI18N LFM="False"/>
|
||||||
</i18n>
|
</i18n>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<UseVersionInfo Value="True" />
|
<UseVersionInfo Value="True"/>
|
||||||
<AutoIncrementBuild Value="True" />
|
<AutoIncrementBuild Value="True"/>
|
||||||
<RevisionNr Value="0" />
|
<MinorVersionNr Value="1"/>
|
||||||
<BuildNr Value="2" />
|
<BuildNr Value="2"/>
|
||||||
<MajorVersionNr Value="0" />
|
|
||||||
<MinorVersionNr Value="1" />
|
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="1">
|
||||||
<Item1 Name="Default" Default="True" />
|
<Item1 Name="Default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2" />
|
<Version Value="2"/>
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2" />
|
<FormatVersion Value="2"/>
|
||||||
<Modes Count="1">
|
<Modes Count="1">
|
||||||
<Mode0 Name="default" />
|
<Mode0 Name="default"/>
|
||||||
</Modes>
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="1">
|
<RequiredPackages Count="1">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="LCL" />
|
<PackageName Value="LCL"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="7">
|
<Units Count="7">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="Chameleon.lpr" />
|
<Filename Value="Chameleon.lpr"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="frmMain.pas" />
|
<Filename Value="frmMain.pas"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="MainForm" />
|
<ComponentName Value="MainForm"/>
|
||||||
<HasResources Value="True" />
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form" />
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="frmResults.pas" />
|
<Filename Value="frmResults.pas"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Results" />
|
<ComponentName Value="Results"/>
|
||||||
<HasResources Value="True" />
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form" />
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="Writers.pas" />
|
<Filename Value="Writers.pas"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="DfmEngine.pas" />
|
<Filename Value="DfmEngine.pas"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="StrConsts.pas" />
|
<Filename Value="StrConsts.pas"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="about1.pas" />
|
<Filename Value="about1.pas"/>
|
||||||
<IsPartOfProject Value="True" />
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="AboutBox" />
|
<ComponentName Value="AboutBox"/>
|
||||||
<HasResources Value="True" />
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form" />
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit6>
|
</Unit6>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="11" />
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\" />
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)" />
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
<SyntaxOptions>
|
<SyntaxOptions>
|
||||||
<SyntaxMode Value="Delphi" />
|
<SyntaxMode Value="Delphi"/>
|
||||||
</SyntaxOptions>
|
</SyntaxOptions>
|
||||||
</Parsing>
|
</Parsing>
|
||||||
<Linking>
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf2Set"/>
|
||||||
|
</Debugging>
|
||||||
<Options>
|
<Options>
|
||||||
<Win32>
|
<Win32>
|
||||||
<GraphicApplication Value="True" />
|
<GraphicApplication Value="True"/>
|
||||||
</Win32>
|
</Win32>
|
||||||
</Options>
|
</Options>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL" />
|
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions Count="3">
|
<Exceptions Count="3">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Name Value="EAbort" />
|
<Name Value="EAbort"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<Name Value="ECodetoolError" />
|
<Name Value="ECodetoolError"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
<Item3>
|
<Item3>
|
||||||
<Name Value="EFOpenError" />
|
<Name Value="EFOpenError"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
|
|||||||
BIN
Chameleon.res
BIN
Chameleon.res
Binary file not shown.
@ -4,6 +4,13 @@ unit StrConsts;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
uses Classes;
|
||||||
|
|
||||||
|
function GetWindowStyleNames(style: Integer): TStringList;
|
||||||
|
function GetExtendedWindowStyleNames(style: Integer): TStringList;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
uses Windows;
|
uses Windows;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -101,6 +108,28 @@ const
|
|||||||
'Transparent',
|
'Transparent',
|
||||||
'Raised edge');
|
'Raised edge');
|
||||||
|
|
||||||
implementation
|
function GetWindowStyleNames(style: Integer): TStringList;
|
||||||
|
var
|
||||||
|
list: TStringList;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
list := TStringList.Create();
|
||||||
|
for i := Low(WindowStyle) to High(WindowStyle) do
|
||||||
|
if ((style and WindowStyle[i]) = WindowStyle[i]) then
|
||||||
|
list.Add(WindowStyleName[i]);
|
||||||
|
Result := list;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetExtendedWindowStyleNames(style: Integer): TStringList;
|
||||||
|
var
|
||||||
|
list: TStringList;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
list := TStringList.Create();
|
||||||
|
for i := Low(ExtendedWindowStyle) to High(ExtendedWindowStyle) do
|
||||||
|
if ((style and ExtendedWindowStyle[i]) = ExtendedWindowStyle[i]) then
|
||||||
|
list.Add(ExtendedWindowStyleName[i]);
|
||||||
|
Result := list;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
13
frmMain.lfm
13
frmMain.lfm
@ -11,14 +11,13 @@ object MainForm: TMainForm
|
|||||||
Font.Color = clWindowText
|
Font.Color = clWindowText
|
||||||
Font.Height = -14
|
Font.Height = -14
|
||||||
Font.Name = 'Tahoma'
|
Font.Name = 'Tahoma'
|
||||||
LCLVersion = '2.0.6.0'
|
LCLVersion = '2.2.0.4'
|
||||||
object lblDelayTime: TLabel
|
object lblDelayTime: TLabel
|
||||||
Left = 21
|
Left = 21
|
||||||
Height = 17
|
Height = 17
|
||||||
Top = 11
|
Top = 11
|
||||||
Width = 168
|
Width = 168
|
||||||
Caption = 'Time until restoring control:'
|
Caption = 'Time until restoring control:'
|
||||||
ParentColor = False
|
|
||||||
end
|
end
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 273
|
Left = 273
|
||||||
@ -26,14 +25,12 @@ object MainForm: TMainForm
|
|||||||
Top = 11
|
Top = 11
|
||||||
Width = 32
|
Width = 32
|
||||||
Caption = 'msec'
|
Caption = 'msec'
|
||||||
ParentColor = False
|
|
||||||
end
|
end
|
||||||
object DelayTime: TSpinEdit
|
object DelayTime: TSpinEdit
|
||||||
Left = 206
|
Left = 206
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 11
|
Top = 11
|
||||||
Width = 63
|
Width = 63
|
||||||
MaxValue = 0
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Value = 3000
|
Value = 3000
|
||||||
end
|
end
|
||||||
@ -60,7 +57,6 @@ object MainForm: TMainForm
|
|||||||
Width = 78
|
Width = 78
|
||||||
Caption = 'HWND value'
|
Caption = 'HWND value'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ParentColor = False
|
|
||||||
end
|
end
|
||||||
object Information: TButton
|
object Information: TButton
|
||||||
Left = 21
|
Left = 21
|
||||||
@ -114,7 +110,6 @@ object MainForm: TMainForm
|
|||||||
Top = 11
|
Top = 11
|
||||||
Width = 81
|
Width = 81
|
||||||
Caption = 'Unit file name'
|
Caption = 'Unit file name'
|
||||||
ParentColor = False
|
|
||||||
end
|
end
|
||||||
object Label4: TLabel
|
object Label4: TLabel
|
||||||
Left = 21
|
Left = 21
|
||||||
@ -122,7 +117,6 @@ object MainForm: TMainForm
|
|||||||
Top = 80
|
Top = 80
|
||||||
Width = 70
|
Width = 70
|
||||||
Caption = 'Form name'
|
Caption = 'Form name'
|
||||||
ParentColor = False
|
|
||||||
end
|
end
|
||||||
object PasFileName: TEdit
|
object PasFileName: TEdit
|
||||||
Left = 21
|
Left = 21
|
||||||
@ -174,7 +168,6 @@ object MainForm: TMainForm
|
|||||||
Top = 11
|
Top = 11
|
||||||
Width = 75
|
Width = 75
|
||||||
Caption = 'RC file name'
|
Caption = 'RC file name'
|
||||||
ParentColor = False
|
|
||||||
end
|
end
|
||||||
object RCFileName: TEdit
|
object RCFileName: TEdit
|
||||||
Left = 21
|
Left = 21
|
||||||
@ -232,7 +225,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object SaveDialog1: TSaveDialog
|
object SaveDialog1: TSaveDialog
|
||||||
Options = [ofOverwritePrompt, ofHideReadOnly]
|
Options = [ofOverwritePrompt, ofHideReadOnly]
|
||||||
left = 366
|
Left = 366
|
||||||
top = 240
|
Top = 240
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
62
frmMain.pas
62
frmMain.pas
@ -52,6 +52,8 @@ type
|
|||||||
PasList: TStrings);
|
PasList: TStrings);
|
||||||
procedure GeneratePasFile(const filename, frmname: string; PasList: TStrings);
|
procedure GeneratePasFile(const filename, frmname: string; PasList: TStrings);
|
||||||
procedure GetWinInfo(wnd: HWND; ParentNode: TTreeNode);
|
procedure GetWinInfo(wnd: HWND; ParentNode: TTreeNode);
|
||||||
|
procedure GetWinInfoStyle(wnd: HWND; ParentNode: TTreeNode);
|
||||||
|
procedure GetWinInfoExtendedStyle(wnd: HWND; ParentNode: TTreeNode);
|
||||||
procedure EnableSavePas;
|
procedure EnableSavePas;
|
||||||
procedure EnableWndInput;
|
procedure EnableWndInput;
|
||||||
public
|
public
|
||||||
@ -76,7 +78,6 @@ var
|
|||||||
node1, node2: TTreeNode;
|
node1, node2: TTreeNode;
|
||||||
childlist: TList;
|
childlist: TList;
|
||||||
EnumParams: TEnumParams;
|
EnumParams: TEnumParams;
|
||||||
style, exstyle: integer;
|
|
||||||
parentWnd: HWND;
|
parentWnd: HWND;
|
||||||
itemtext: array [0..300] of char;
|
itemtext: array [0..300] of char;
|
||||||
begin
|
begin
|
||||||
@ -92,8 +93,6 @@ begin
|
|||||||
GetWindowRect(wnd, R1);
|
GetWindowRect(wnd, R1);
|
||||||
Windows.GetClientRect(wnd, R2);
|
Windows.GetClientRect(wnd, R2);
|
||||||
GetClassName(wnd, class_name, 100);
|
GetClassName(wnd, class_name, 100);
|
||||||
style := GetWindowLong(wnd, GWL_STYLE);
|
|
||||||
exstyle := GetWindowLong(wnd, GWL_EXSTYLE);
|
|
||||||
parentWnd := GetParent(wnd);
|
parentWnd := GetParent(wnd);
|
||||||
EnumParams.List := childlist;
|
EnumParams.List := childlist;
|
||||||
EnumParams.ParentWnd := wnd;
|
EnumParams.ParentWnd := wnd;
|
||||||
@ -105,17 +104,8 @@ begin
|
|||||||
AddChild(ParentNode, 'Caption = ' + Text);
|
AddChild(ParentNode, 'Caption = ' + Text);
|
||||||
AddChild(ParentNode, 'Class name = ' + class_name);
|
AddChild(ParentNode, 'Class name = ' + class_name);
|
||||||
AddChild(ParentNode, 'Parent Handle = ' + IntToStr(parentWnd));
|
AddChild(ParentNode, 'Parent Handle = ' + IntToStr(parentWnd));
|
||||||
node1 := AddChild(ParentNode, 'Style');
|
GetWinInfoStyle(wnd, ParentNode);
|
||||||
AddChild(node1, 'Value = ' + IntToStr(style));
|
GetWinInfoExtendedStyle(wnd, ParentNode);
|
||||||
for i := Low(WindowStyle) to High(WindowStyle) do
|
|
||||||
if ((style and WindowStyle[i]) = WindowStyle[i]) then
|
|
||||||
AddChild(node1, WindowStyleName[i]);
|
|
||||||
|
|
||||||
node1 := AddChild(ParentNode, 'Extended Style');
|
|
||||||
AddChild(node1, 'Value = ' + IntToStr(exstyle));
|
|
||||||
for i := Low(WindowStyle) to High(WindowStyle) do
|
|
||||||
if ((style and ExtendedWindowStyle[i]) = ExtendedWindowStyle[i]) then
|
|
||||||
AddChild(node1, ExtendedWindowStyleName[i]);
|
|
||||||
node1 := AddChild(ParentNode, 'Placement');
|
node1 := AddChild(ParentNode, 'Placement');
|
||||||
AddChild(node1, 'Left = ' + IntToStr(R1.Left));
|
AddChild(node1, 'Left = ' + IntToStr(R1.Left));
|
||||||
AddChild(node1, 'Top = ' + IntToStr(R1.Top));
|
AddChild(node1, 'Top = ' + IntToStr(R1.Top));
|
||||||
@ -150,6 +140,50 @@ begin
|
|||||||
childlist.Free;
|
childlist.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.GetWinInfoStyle(wnd: HWND; ParentNode: TTreeNode);
|
||||||
|
var
|
||||||
|
style: Integer;
|
||||||
|
list: TStringList;
|
||||||
|
node1: TTreeNode;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
style := GetWindowLong(wnd, GWL_STYLE);
|
||||||
|
list := GetWindowStyleNames(style);
|
||||||
|
|
||||||
|
with Results.TreeView1.Items do
|
||||||
|
begin
|
||||||
|
node1 := AddChild(ParentNode, 'Style');
|
||||||
|
AddChild(node1, 'Value = ' + IntToStr(style));
|
||||||
|
|
||||||
|
for i := 0 to list.Count - 1 do
|
||||||
|
AddChild(node1, list[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
list.Free();
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.GetWinInfoExtendedStyle(wnd: HWND; ParentNode: TTreeNode);
|
||||||
|
var
|
||||||
|
style: Integer;
|
||||||
|
list: TStringList;
|
||||||
|
node1: TTreeNode;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
style := GetWindowLong(wnd, GWL_EXSTYLE);
|
||||||
|
list := GetExtendedWindowStyleNames(style);
|
||||||
|
|
||||||
|
with Results.TreeView1.Items do
|
||||||
|
begin
|
||||||
|
node1 := AddChild(ParentNode, 'Extended Style');
|
||||||
|
AddChild(node1, 'Value = ' + IntToStr(style));
|
||||||
|
|
||||||
|
for i := 0 to list.Count - 1 do
|
||||||
|
AddChild(node1, list[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
list.Free();
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.InformationClick(Sender: TObject);
|
procedure TMainForm.InformationClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
wnd: HWND;
|
wnd: HWND;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user