Skip to content

Commit abc838b

Browse files
committed
DIC - Added XE8 support
DIC - Fixed small bug in tcbCategoryGlyphClosed and tcbCategoryGlyphOpen DIC - Added support for TTrackBar DIC - Improved XE7, XE8 performance DIC - Removed unused hooks DIC - Added support for TCastaliaNavToolbarDropdown DIC - Code Refactoring
1 parent 52c55a5 commit abc838b

27 files changed

+5017
-124
lines changed

delphi-ide-theme-editor/Common/Vcl Styles Utils/Vcl.Styles.Utils.FlatMenus.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,7 @@ procedure TColorizerPopupStyleHook.WndProc(var Message: TMessage);
12871287

12881288
constructor TColorizerPopupStyleHook.TSysPopupItem.Create(SysPopupStyleHook: TColorizerPopupStyleHook; SysParent: TSysControl; const Index: integer; const Menu: HMENU);
12891289
begin
1290+
inherited Create;
12901291
FSysPopupStyleHook := SysPopupStyleHook;
12911292
FMenu := Menu;
12921293
FHandle := SysParent.Handle;

delphi-ide-theme-editor/Common/Vcl Styles Utils/Vcl.Styles.Utils.FlatStyleHook.pas

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ function IsControlHooked(Handle: HWND): Boolean;
297297

298298
constructor TSysControl.Create(AHandle: THandle);
299299
begin
300+
inherited Create;
300301
FFont := nil;
301302
FParent := nil;
302303
Handle := AHandle;
@@ -1035,17 +1036,17 @@ function TSysStyleHook.CheckIfParentBkGndPainted: Boolean;
10351036
var
10361037
Test: Integer;
10371038
PTest: PInteger;
1038-
ParentHandle: HWND;
1039+
LParentHandle: HWND;
10391040
begin
10401041
Test := $93;
10411042
PTest := @Test;
10421043
Result := False;
1043-
ParentHandle := GetParent(Handle);
1044-
if ParentHandle > 0 then
1044+
LParentHandle := GetParent(Handle);
1045+
if LParentHandle > 0 then
10451046
begin
1046-
if not IsControlHooked(ParentHandle) then
1047+
if not IsControlHooked(LParentHandle) then
10471048
Exit(False);
1048-
SendMessage(ParentHandle, WM_ERASEBKGND, 0, lParam(PTest));
1049+
SendMessage(LParentHandle, WM_ERASEBKGND, 0, lParam(PTest));
10491050
Result := (PTest^ = $11);
10501051
end;
10511052
end;

delphi-ide-theme-editor/IDE PlugIn/Colorizer.Hook.Forms.pas

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,26 @@ function HandleColorizerStyleMessage(Self : TWinControl;var Message: TMessage; W
170170
begin
171171
HookedControls.Add(Self, TColorizerEditStyleHook.Create(Self));
172172
LHook:=HookedControls[Self];
173-
end;
174-
173+
end
174+
else
175+
if Self is TListBox then
176+
begin
177+
HookedControls.Add(Self, TColorizerListBoxStyleHook.Create(Self));
178+
LHook:=HookedControls[Self];
179+
end
180+
else
181+
if Self is TTrackBar then
182+
begin
183+
HookedControls.Add(Self, TColorizerTrackBarStyleHook.Create(Self));
184+
LHook:=HookedControls[Self];
185+
end
186+
// else
187+
// if (Self is TComboBox) or (Self is TCustomComboBox) then
188+
// begin
189+
// HookedControls.Add(Self, TColorizerComboBoxStyleHook.Create(Self));
190+
// LHook:=HookedControls[Self];
191+
// end
192+
// ;
175193

176194
end;
177195

delphi-ide-theme-editor/IDE PlugIn/Colorizer.Hooks.GDIPOBJ.pas

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,16 @@ function Detour_TGPGraphics_FillPath(Self : TGPGraphics; brush: TGPBrush; path:
160160
begin
161161
if LActive then
162162
begin
163-
try color1 := ColorRefToARGB(ColorToRGB(TryStrToColor(TColorizerLocalSettings.Settings.TabIDEStartGradActive, TColorizerLocalSettings.ColorMap.Color))); except end;
164-
try color2 := ColorRefToARGB(ColorToRGB(TryStrToColor(TColorizerLocalSettings.Settings.TabIDEEndGradActive, TColorizerLocalSettings.ColorMap.SelectedColor))); except end;
163+
try
164+
color1 := ColorRefToARGB(ColorToRGB(TryStrToColor(TColorizerLocalSettings.Settings.TabIDEStartGradActive, TColorizerLocalSettings.ColorMap.Color)));
165+
except
166+
color1 := ColorRefToARGB(ColorToRGB(TColorizerLocalSettings.ColorMap.Color));
167+
end;
168+
try
169+
color2 := ColorRefToARGB(ColorToRGB(TryStrToColor(TColorizerLocalSettings.Settings.TabIDEEndGradActive, TColorizerLocalSettings.ColorMap.SelectedColor)));
170+
except
171+
color2 := ColorRefToARGB(ColorToRGB(TColorizerLocalSettings.ColorMap.SelectedColor));
172+
end;
165173
end
166174
else
167175
begin

delphi-ide-theme-editor/IDE PlugIn/Colorizer.Hooks.UxTheme.pas

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -101,36 +101,36 @@ THThemesClasses = class
101101
SetScrollRange
102102
ShowScrollBar
103103
}
104-
TrampolineSetScrollPos : function (hWnd: HWND; nBar, nPos: Integer; bRedraw: BOOL): Integer; stdcall = nil;
105-
TrampolineSetScrollInfo : function (hWnd: HWND; BarFlag: Integer; const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall = nil;
104+
// TrampolineSetScrollPos : function (hWnd: HWND; nBar, nPos: Integer; bRedraw: BOOL): Integer; stdcall = nil;
105+
// TrampolineSetScrollInfo : function (hWnd: HWND; BarFlag: Integer; const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall = nil;
106106

107107
function Detour_UxTheme_DrawThemeText(hTheme: HTHEME; hdc: HDC; iPartId, iStateId: Integer; pszText: LPCWSTR; iCharCount: Integer; dwTextFlags, dwTextFlags2: DWORD; const pRect: TRect): HRESULT; stdcall;
108108
begin
109109
//AddLog('Detour_UxTheme_DrawThemeText', string(pszText));
110110
Exit(Trampoline_DrawThemeText(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect));
111111
end;
112112

113-
function Detour_WinApi_SetScrollPos(hWnd: HWND; nBar, nPos: Integer; bRedraw: BOOL): Integer; stdcall;
114-
begin
115-
ColorizerLock.Enter;
116-
try
117-
LastScrollWinControl:=FindControl(hWnd);
118-
finally
119-
ColorizerLock.Leave;
120-
end;
121-
Exit(TrampolineSetScrollPos(hWnd, nBar, nPos, bRedraw));
122-
end;
123-
124-
function Detour_WinApi_SetScrollInfo(hWnd: HWND; BarFlag: Integer; const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall;
125-
begin
126-
ColorizerLock.Enter;
127-
try
128-
LastScrollWinControl:=FindControl(hWnd);
129-
finally
130-
ColorizerLock.Leave;
131-
end;
132-
Exit(TrampolineSetScrollInfo(hWnd, BarFlag, ScrollInfo, Redraw));
133-
end;
113+
//function Detour_WinApi_SetScrollPos(hWnd: HWND; nBar, nPos: Integer; bRedraw: BOOL): Integer; stdcall;
114+
//begin
115+
// ColorizerLock.Enter;
116+
// try
117+
// LastScrollWinControl:=FindControl(hWnd);
118+
// finally
119+
// ColorizerLock.Leave;
120+
// end;
121+
// Exit(TrampolineSetScrollPos(hWnd, nBar, nPos, bRedraw));
122+
//end;
123+
//
124+
//function Detour_WinApi_SetScrollInfo(hWnd: HWND; BarFlag: Integer; const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall;
125+
//begin
126+
// ColorizerLock.Enter;
127+
// try
128+
// LastScrollWinControl:=FindControl(hWnd);
129+
// finally
130+
// ColorizerLock.Leave;
131+
// end;
132+
// Exit(TrampolineSetScrollInfo(hWnd, BarFlag, ScrollInfo, Redraw));
133+
//end;
134134

135135
type
136136
TWinControlClass = class(TWinControl);
@@ -759,6 +759,10 @@ function Detour_UxTheme_DrawThemeBackground(THEME: HTHEME; dc: HDC; iPartId, iS
759759
LSize.cy:=10;
760760
//LRect := Rect(0, 0, pRect.Width, pRect.Height);
761761
LRect := Rect(0, 0, LSize.Width, LSize.Height);
762+
763+
LBuffer.Canvas.Brush.Color:=LStyleServices.GetSystemColor(clWindow);
764+
LBuffer.Canvas.FillRect(LRect);
765+
762766
LBuffer.SetSize(LRect.Width, LRect.Height);
763767
LStyleServices.DrawElement(LBuffer.Canvas.Handle, LDetails, LRect);
764768
BitBlt(dc, pRect.Left, pRect.Top, LRect.Width, LRect.Height, LBuffer.Canvas.Handle, 0, 0, SRCCOPY);
@@ -832,6 +836,10 @@ function Detour_UxTheme_DrawThemeBackground(THEME: HTHEME; dc: HDC; iPartId, iS
832836
LSize.cy:=10;
833837
//LRect := Rect(0, 0, pRect.Width, pRect.Height);
834838
LRect := Rect(0, 0, LSize.Width, LSize.Height);
839+
840+
LBuffer.Canvas.Brush.Color:=LStyleServices.GetSystemColor(clWindow);
841+
LBuffer.Canvas.FillRect(LRect);
842+
835843
LBuffer.SetSize(LRect.Width, LRect.Height);
836844
LStyleServices.DrawElement(LBuffer.Canvas.Handle, LDetails, LRect);
837845
BitBlt(dc, pRect.Left, pRect.Top, LRect.Width, LRect.Height, LBuffer.Canvas.Handle, 0, 0, SRCCOPY);
@@ -1181,8 +1189,8 @@ procedure InstallHooksUXTheme;
11811189
TrampolineOpenThemeData := InterceptCreate(themelib, 'OpenThemeData', @Detour_UxTheme_OpenThemeData);
11821190
TrampolineDrawThemeBackground := InterceptCreate(themelib, 'DrawThemeBackground', @Detour_UxTheme_DrawThemeBackground);
11831191
TrampolineBaseVirtualTreeOriginalWMNCPaint := InterceptCreate(sVclIDEModule, sBaseVirtualTreeOriginalWMNCPaint, @Detour_TBaseVirtualTree_OriginalWMNCPaint);
1184-
TrampolineSetScrollPos := InterceptCreate(user32, 'SetScrollPos', @Detour_WinApi_SetScrollPos);
1185-
TrampolineSetScrollInfo := InterceptCreate(user32, 'SetScrollInfo', @Detour_WinApi_SetScrollInfo);
1192+
// TrampolineSetScrollPos := InterceptCreate(user32, 'SetScrollPos', @Detour_WinApi_SetScrollPos);
1193+
// TrampolineSetScrollInfo := InterceptCreate(user32, 'SetScrollInfo', @Detour_WinApi_SetScrollInfo);
11861194
end;
11871195

11881196
end;
@@ -1194,8 +1202,8 @@ procedure RemoveHooksUXTheme;
11941202
InterceptRemove(@TrampolineBaseVirtualTreeOriginalWMNCPaint);
11951203
InterceptRemove(@TrampolineDrawThemeBackground);
11961204
InterceptRemove(@Trampoline_DrawThemeText);
1197-
InterceptRemove(@TrampolineSetScrollPos);
1198-
InterceptRemove(@TrampolineSetScrollInfo);
1205+
// InterceptRemove(@TrampolineSetScrollPos);
1206+
// InterceptRemove(@TrampolineSetScrollInfo);
11991207

12001208
if {$IFDEF DELPHIXE2_UP}StyleServices.Available {$ELSE} ThemeServices.ThemesAvailable {$ENDIF} then
12011209
begin

0 commit comments

Comments
 (0)