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/
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
<?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"/>
|
||||||
@ -25,10 +25,8 @@
|
|||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<UseVersionInfo Value="True"/>
|
<UseVersionInfo Value="True"/>
|
||||||
<AutoIncrementBuild Value="True"/>
|
<AutoIncrementBuild Value="True"/>
|
||||||
<RevisionNr Value="0" />
|
|
||||||
<BuildNr Value="2" />
|
|
||||||
<MajorVersionNr Value="0" />
|
|
||||||
<MinorVersionNr Value="1"/>
|
<MinorVersionNr Value="1"/>
|
||||||
|
<BuildNr Value="2"/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="1">
|
||||||
<Item1 Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
@ -99,6 +97,9 @@
|
|||||||
</SyntaxOptions>
|
</SyntaxOptions>
|
||||||
</Parsing>
|
</Parsing>
|
||||||
<Linking>
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf2Set"/>
|
||||||
|
</Debugging>
|
||||||
<Options>
|
<Options>
|
||||||
<Win32>
|
<Win32>
|
||||||
<GraphicApplication Value="True"/>
|
<GraphicApplication Value="True"/>
|
||||||
|
|||||||
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