Skip to content

Commit eb4a0b4

Browse files
committed
style: remove dead code which is unlikely to get re-enabled in the future
1 parent b1122c5 commit eb4a0b4

File tree

4 files changed

+1
-234
lines changed

4 files changed

+1
-234
lines changed

source/apphelpers.pas

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,10 @@ TAppSettings = class(TObject)
266266
constructor Create;
267267
destructor Destroy; override;
268268
function ReadInt(Index: TAppSettingIndex; FormatName: String=''; Default: Integer=0): Integer;
269-
//function ReadIntDpiAware(Index: TAppSettingIndex; AControl: TControl; FormatName: String=''; Default: Integer=0): Integer;
270269
function ReadBool(Index: TAppSettingIndex; FormatName: String=''; Default: Boolean=False): Boolean;
271270
function ReadString(Index: TAppSettingIndex; FormatName: String=''; Default: String=''): String; overload;
272271
function ReadString(ValueName: String): String; overload;
273272
procedure WriteInt(Index: TAppSettingIndex; Value: Integer; FormatName: String='');
274-
//procedure WriteIntDpiAware(Index: TAppSettingIndex; AControl: TControl; Value: Integer; FormatName: String='');
275273
procedure WriteBool(Index: TAppSettingIndex; Value: Boolean; FormatName: String='');
276274
procedure WriteString(Index: TAppSettingIndex; Value: String; FormatName: String=''); overload;
277275
procedure WriteString(ValueName, Value: String); overload;
@@ -387,7 +385,6 @@ TAppSettings = class(TObject)
387385
//function ParamStrToBlob(out cbData: DWORD): Pointer;
388386
//function CheckForSecondInstance: Boolean;
389387
function GetParentFormOrFrame(Comp: TWinControl): TWinControl;
390-
//function KeyPressed(Code: Integer): Boolean;
391388
function GeneratePassword(Len: Integer): String;
392389
procedure InvalidateVT(VT: TLazVirtualStringTree; RefreshTag: Integer; ImmediateRepaint: Boolean);
393390
function CharAtPos(Str: String; Pos: Integer): Char;
@@ -2141,17 +2138,6 @@ function GetParentFormOrFrame(Comp: TWinControl): TWinControl;
21412138
end;
21422139

21432140

2144-
{function KeyPressed(Code: Integer): Boolean;
2145-
var
2146-
State: TKeyboardState;
2147-
begin
2148-
// Checks whether a key is pressed, defined by virtual key code
2149-
// Windows-only. Prefer "ssShift in GetKeyShiftState"
2150-
GetKeyboardState(State);
2151-
Result := (State[Code] and 128) <> 0;
2152-
end;}
2153-
2154-
21552141
function GeneratePassword(Len: Integer): String;
21562142
var
21572143
i: Integer;
@@ -2977,56 +2963,6 @@ function GetCommandLine: String;
29772963
Result := Trim(Result);
29782964
end;
29792965

2980-
2981-
{ Get SID of current Windows user, probably useful in the future
2982-
{function GetCurrentUserSID: string;
2983-
type
2984-
PTOKEN_USER = ^TOKEN_USER;
2985-
_TOKEN_USER = record
2986-
User: TSidAndAttributes;
2987-
end;
2988-
TOKEN_USER = _TOKEN_USER;
2989-
var
2990-
hToken: THandle;
2991-
cbBuf: Cardinal;
2992-
ptiUser: PTOKEN_USER;
2993-
bSuccess: Boolean;
2994-
StrSid: PWideChar;
2995-
begin
2996-
// Taken from https://stackoverflow.com/a/71730865/4110077
2997-
// SidToString does not exist, prefer WinApi.Windows.ConvertSidToStringSid()
2998-
Result := '';
2999-
3000-
// Get the calling thread's access token.
3001-
if not OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, True, hToken) then
3002-
begin
3003-
if (GetLastError <> ERROR_NO_TOKEN) then
3004-
Exit;
3005-
3006-
// Retry against process token if no thread token exists.
3007-
if not OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hToken) then
3008-
Exit;
3009-
end;
3010-
try
3011-
// Obtain the size of the user information in the token.
3012-
bSuccess := GetTokenInformation(hToken, TokenUser, nil, 0, cbBuf);
3013-
ptiUser := nil;
3014-
try
3015-
while (not bSuccess) and (GetLastError = ERROR_INSUFFICIENT_BUFFER) do
3016-
begin
3017-
ReallocMem(ptiUser, cbBuf);
3018-
bSuccess := GetTokenInformation(hToken, TokenUser, ptiUser, cbBuf, cbBuf);
3019-
end;
3020-
ConvertSidToStringSid(ptiUser.User.Sid, StrSid);
3021-
Result := StrSid;
3022-
finally
3023-
FreeMem(ptiUser);
3024-
end;
3025-
finally
3026-
CloseHandle(hToken);
3027-
end;
3028-
end;}
3029-
30302966
function GetApplicationName: String;
30312967
begin
30322968
Result := LowerCase(APPNAME);
@@ -4141,14 +4077,6 @@ function TAppSettings.ReadInt(Index: TAppSettingIndex; FormatName: String=''; De
41414077
end;
41424078

41434079

4144-
{function TAppSettings.ReadIntDpiAware(Index: TAppSettingIndex; AControl: TControl; FormatName: String=''; Default: Integer=0): Integer;
4145-
begin
4146-
// take a forms DesignTimePPI into account
4147-
Result := ReadInt(Index, FormatName, Default);
4148-
Result := AControl.ScaleDesignToForm(Result);
4149-
end;}
4150-
4151-
41524080
function TAppSettings.ReadBool(Index: TAppSettingIndex; FormatName: String=''; Default: Boolean=False): Boolean;
41534081
var
41544082
I: Integer;
@@ -4229,13 +4157,6 @@ procedure TAppSettings.WriteInt(Index: TAppSettingIndex; Value: Integer; FormatN
42294157
end;
42304158

42314159

4232-
{procedure TAppSettings.WriteIntDpiAware(Index: TAppSettingIndex; AControl: TControl; Value: Integer; FormatName: String='');
4233-
begin
4234-
Value := AControl.ScaleFormToDesign(Value);
4235-
WriteInt(Index, Value, FormatName);
4236-
end;}
4237-
4238-
42394160
procedure TAppSettings.WriteBool(Index: TAppSettingIndex; Value: Boolean; FormatName: String='');
42404161
begin
42414162
Write(Index, FormatName, adBool, 0, Value, '');

source/extra_controls.pas

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,6 @@ TExtForm = class(TForm)
3434
class procedure ShowPopup(ClickedControl: TControl; PopupMenu: TPopupMenu);
3535
end;
3636

37-
{TExtSynHotKey = class(TSynHotKey)
38-
private
39-
FOnChange: TNotifyEvent;
40-
FOnEnter: TNotifyEvent;
41-
FOnExit: TNotifyEvent;
42-
procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS;
43-
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
44-
protected
45-
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
46-
procedure Paint; override;
47-
published
48-
property OnChange: TNotifyEvent read FOnChange write FOnChange;
49-
property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
50-
property OnExit: TNotifyEvent read FOnExit write FOnExit;
51-
end;}
52-
5337
TExtComboBox = class(TComboBox)
5438
private
5539
FcbHintIndex: Integer;
@@ -62,14 +46,6 @@ TExtComboBox = class(TComboBox)
6246
procedure InitiateAction; override;
6347
end;
6448

65-
{TExtHintWindow = class(THintWindow)
66-
private
67-
const Padding: Integer = 8;
68-
protected
69-
procedure Paint; override;
70-
public
71-
function CalcHintRect(MaxWidth: Integer; const AHint: string; AData: TCustomData): TRect; override;
72-
end;}
7349

7450

7551
implementation
@@ -364,46 +340,6 @@ class procedure TExtForm.ShowPopup(ClickedControl: TControl; PopupMenu: TPopupMe
364340
end;
365341

366342

367-
{ TExtSynHotKey }
368-
369-
{procedure TExtSynHotKey.WMKillFocus(var Msg: TWMKillFocus);
370-
begin
371-
inherited;
372-
if Assigned(FOnExit) then
373-
FOnExit(Self);
374-
end;
375-
376-
procedure TExtSynHotKey.WMSetFocus(var Msg: TWMSetFocus);
377-
begin
378-
inherited;
379-
if Assigned(FOnEnter) then
380-
FOnEnter(Self);
381-
end;
382-
383-
procedure TExtSynHotKey.KeyDown(var Key: Word; Shift: TShiftState);
384-
begin
385-
inherited;
386-
if Assigned(FOnChange) then
387-
FOnChange(Self);
388-
end;
389-
390-
procedure TExtSynHotKey.Paint;
391-
var
392-
r: TRect;
393-
begin
394-
r := ClientRect;
395-
Canvas.Brush.Style := bsSolid;
396-
Canvas.Brush.Color := Color;
397-
InflateRect(r, -BorderWidth, -BorderWidth);
398-
Canvas.FillRect(r);
399-
if Enabled then
400-
Canvas.Font.Color := clWindowText
401-
else
402-
Canvas.Font.Color := clGrayText;
403-
SynUnicode.TextRect(Canvas, r, BorderWidth + 1, BorderWidth + 1, Text);
404-
end;}
405-
406-
407343

408344
{ TExtComboBox }
409345

@@ -463,70 +399,4 @@ procedure TExtComboBox.InitiateAction;
463399

464400

465401

466-
{ TExtHintWindow }
467-
468-
469-
{function TExtHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: string; AData: TCustomData): TRect;
470-
begin
471-
Result := inherited;
472-
// Customized: enlarge surrounding rect to make space for padding
473-
if AHint.Contains(SLineBreak) then begin
474-
Result.Right := Result.Right + 2 * ScaleValue(Padding);
475-
Result.Bottom := Result.Bottom + 2 * ScaleValue(Padding);
476-
end;
477-
end;
478-
479-
480-
procedure TExtHintWindow.Paint;
481-
var
482-
R, ClipRect: TRect;
483-
LColor: TColor;
484-
LStyle: TCustomStyleServices;
485-
LDetails: TThemedElementDetails;
486-
LGradientStart, LGradientEnd, LTextColor: TColor;
487-
begin
488-
R := ClientRect;
489-
LStyle := StyleServices(Screen.ActiveForm);
490-
LTextColor := Screen.HintFont.Color;
491-
if LStyle.Enabled then
492-
begin
493-
ClipRect := R;
494-
InflateRect(R, 4, 4);
495-
if TOSVersion.Check(6) and LStyle.IsSystemStyle then
496-
begin
497-
// Paint Windows gradient background
498-
LStyle.DrawElement(Canvas.Handle, LStyle.GetElementDetails(tttStandardNormal), R, ClipRect);
499-
end
500-
else
501-
begin
502-
LDetails := LStyle.GetElementDetails(thHintNormal);
503-
if LStyle.GetElementColor(LDetails, ecGradientColor1, LColor) and (LColor <> clNone) then
504-
LGradientStart := LColor
505-
else
506-
LGradientStart := clInfoBk;
507-
if LStyle.GetElementColor(LDetails, ecGradientColor2, LColor) and (LColor <> clNone) then
508-
LGradientEnd := LColor
509-
else
510-
LGradientEnd := clInfoBk;
511-
if LStyle.GetElementColor(LDetails, ecTextColor, LColor) and (LColor <> clNone) then
512-
LTextColor := LColor
513-
else
514-
LTextColor := Screen.HintFont.Color;
515-
GradientFillCanvas(Canvas, LGradientStart, LGradientEnd, R, gdVertical);
516-
end;
517-
R := ClipRect;
518-
end;
519-
Inc(R.Left, 2);
520-
Inc(R.Top, 2);
521-
// Customized: move inner rect right+down to add padding to outer edge
522-
if String(Caption).Contains(SLineBreak) then begin
523-
Inc(R.Left, ScaleValue(Padding));
524-
Inc(R.Top, ScaleValue(Padding));
525-
end;
526-
Canvas.Font.Color := LTextColor;
527-
DrawText(Canvas.Handle, Caption, -1, R, DT_LEFT or DT_NOPREFIX or
528-
DT_WORDBREAK or DrawTextBiDiModeFlagsReadingOnly);
529-
end;}
530-
531-
532402
end.

source/tabletools.lfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ object frmTableTools: TfrmTableTools
33
Height = 479
44
Top = 126
55
Width = 955
6-
BorderIcons = [biSystemMenu, biHelp]
6+
BorderIcons = [biSystemMenu]
77
Caption = 'Table tools'
88
ClientHeight = 479
99
ClientWidth = 955

source/tabletools.pas

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ TfrmTableTools = class(TExtForm)
179179
ToFile, ToDir, ToClipboard, ToDb, ToServer: Boolean;
180180
FObjectSizes, FObjectSizesDone, FObjectSizesDoneExact: Int64;
181181
FStartTimeAll: Cardinal;
182-
//procedure WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ; message WM_NCLBUTTONDOWN;
183-
//procedure WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ; message WM_NCLBUTTONUP;
184182
procedure SetToolMode(Value: TToolMode);
185183
procedure Output(SQL: String; IsEndOfQuery, ForFile, ForDir, ForDb, ForServer: Boolean);
186184
procedure AddResults(SQL: String; Connection: TDBConnection);
@@ -231,28 +229,6 @@ implementation
231229
{$R *.lfm}
232230

233231

234-
{procedure TfrmTableTools.WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ;
235-
begin
236-
if Msg.HitTest = HTHELP then
237-
Msg.Result := 0 // "eat" the message
238-
else
239-
inherited;
240-
end;}
241-
242-
243-
{procedure TfrmTableTools.WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ;
244-
begin
245-
if Msg.HitTest = HTHELP then begin
246-
Msg.Result := 0;
247-
if tabsTools.ActivePage = tabSQLexport then
248-
Help(Self, 'sqlexport')
249-
else
250-
ErrorDialog(_('No help available for this tab.'));
251-
end else
252-
inherited;
253-
end;}
254-
255-
256232
procedure TfrmTableTools.FormCreate(Sender: TObject);
257233
var
258234
i: Integer;

0 commit comments

Comments
 (0)