diff --git a/source/apphelpers.pas b/source/apphelpers.pas index 9d03a9b6..2ba269d9 100644 --- a/source/apphelpers.pas +++ b/source/apphelpers.pas @@ -266,12 +266,10 @@ type constructor Create; destructor Destroy; override; function ReadInt(Index: TAppSettingIndex; FormatName: String=''; Default: Integer=0): Integer; - //function ReadIntDpiAware(Index: TAppSettingIndex; AControl: TControl; FormatName: String=''; Default: Integer=0): Integer; function ReadBool(Index: TAppSettingIndex; FormatName: String=''; Default: Boolean=False): Boolean; function ReadString(Index: TAppSettingIndex; FormatName: String=''; Default: String=''): String; overload; function ReadString(ValueName: String): String; overload; procedure WriteInt(Index: TAppSettingIndex; Value: Integer; FormatName: String=''); - //procedure WriteIntDpiAware(Index: TAppSettingIndex; AControl: TControl; Value: Integer; FormatName: String=''); procedure WriteBool(Index: TAppSettingIndex; Value: Boolean; FormatName: String=''); procedure WriteString(Index: TAppSettingIndex; Value: String; FormatName: String=''); overload; procedure WriteString(ValueName, Value: String); overload; @@ -387,7 +385,6 @@ type //function ParamStrToBlob(out cbData: DWORD): Pointer; //function CheckForSecondInstance: Boolean; function GetParentFormOrFrame(Comp: TWinControl): TWinControl; - //function KeyPressed(Code: Integer): Boolean; function GeneratePassword(Len: Integer): String; procedure InvalidateVT(VT: TLazVirtualStringTree; RefreshTag: Integer; ImmediateRepaint: Boolean); function CharAtPos(Str: String; Pos: Integer): Char; @@ -2141,17 +2138,6 @@ begin end; -{function KeyPressed(Code: Integer): Boolean; -var - State: TKeyboardState; -begin - // Checks whether a key is pressed, defined by virtual key code - // Windows-only. Prefer "ssShift in GetKeyShiftState" - GetKeyboardState(State); - Result := (State[Code] and 128) <> 0; -end;} - - function GeneratePassword(Len: Integer): String; var i: Integer; @@ -2977,56 +2963,6 @@ begin Result := Trim(Result); end; - -{ Get SID of current Windows user, probably useful in the future -{function GetCurrentUserSID: string; -type - PTOKEN_USER = ^TOKEN_USER; - _TOKEN_USER = record - User: TSidAndAttributes; - end; - TOKEN_USER = _TOKEN_USER; -var - hToken: THandle; - cbBuf: Cardinal; - ptiUser: PTOKEN_USER; - bSuccess: Boolean; - StrSid: PWideChar; -begin - // Taken from https://stackoverflow.com/a/71730865/4110077 - // SidToString does not exist, prefer WinApi.Windows.ConvertSidToStringSid() - Result := ''; - - // Get the calling thread's access token. - if not OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, True, hToken) then - begin - if (GetLastError <> ERROR_NO_TOKEN) then - Exit; - - // Retry against process token if no thread token exists. - if not OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hToken) then - Exit; - end; - try - // Obtain the size of the user information in the token. - bSuccess := GetTokenInformation(hToken, TokenUser, nil, 0, cbBuf); - ptiUser := nil; - try - while (not bSuccess) and (GetLastError = ERROR_INSUFFICIENT_BUFFER) do - begin - ReallocMem(ptiUser, cbBuf); - bSuccess := GetTokenInformation(hToken, TokenUser, ptiUser, cbBuf, cbBuf); - end; - ConvertSidToStringSid(ptiUser.User.Sid, StrSid); - Result := StrSid; - finally - FreeMem(ptiUser); - end; - finally - CloseHandle(hToken); - end; -end;} - function GetApplicationName: String; begin Result := LowerCase(APPNAME); @@ -4141,14 +4077,6 @@ begin end; -{function TAppSettings.ReadIntDpiAware(Index: TAppSettingIndex; AControl: TControl; FormatName: String=''; Default: Integer=0): Integer; -begin - // take a forms DesignTimePPI into account - Result := ReadInt(Index, FormatName, Default); - Result := AControl.ScaleDesignToForm(Result); -end;} - - function TAppSettings.ReadBool(Index: TAppSettingIndex; FormatName: String=''; Default: Boolean=False): Boolean; var I: Integer; @@ -4229,13 +4157,6 @@ begin end; -{procedure TAppSettings.WriteIntDpiAware(Index: TAppSettingIndex; AControl: TControl; Value: Integer; FormatName: String=''); -begin - Value := AControl.ScaleFormToDesign(Value); - WriteInt(Index, Value, FormatName); -end;} - - procedure TAppSettings.WriteBool(Index: TAppSettingIndex; Value: Boolean; FormatName: String=''); begin Write(Index, FormatName, adBool, 0, Value, ''); diff --git a/source/extra_controls.pas b/source/extra_controls.pas index 42d855a7..3e8d3cf9 100644 --- a/source/extra_controls.pas +++ b/source/extra_controls.pas @@ -34,22 +34,6 @@ type class procedure ShowPopup(ClickedControl: TControl; PopupMenu: TPopupMenu); end; - {TExtSynHotKey = class(TSynHotKey) - private - FOnChange: TNotifyEvent; - FOnEnter: TNotifyEvent; - FOnExit: TNotifyEvent; - procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; - procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; - protected - procedure KeyDown(var Key: Word; Shift: TShiftState); override; - procedure Paint; override; - published - property OnChange: TNotifyEvent read FOnChange write FOnChange; - property OnEnter: TNotifyEvent read FOnEnter write FOnEnter; - property OnExit: TNotifyEvent read FOnExit write FOnExit; - end;} - TExtComboBox = class(TComboBox) private FcbHintIndex: Integer; @@ -62,14 +46,6 @@ type procedure InitiateAction; override; end; - {TExtHintWindow = class(THintWindow) - private - const Padding: Integer = 8; - protected - procedure Paint; override; - public - function CalcHintRect(MaxWidth: Integer; const AHint: string; AData: TCustomData): TRect; override; - end;} implementation @@ -364,46 +340,6 @@ begin end; -{ TExtSynHotKey } - -{procedure TExtSynHotKey.WMKillFocus(var Msg: TWMKillFocus); -begin - inherited; - if Assigned(FOnExit) then - FOnExit(Self); -end; - -procedure TExtSynHotKey.WMSetFocus(var Msg: TWMSetFocus); -begin - inherited; - if Assigned(FOnEnter) then - FOnEnter(Self); -end; - -procedure TExtSynHotKey.KeyDown(var Key: Word; Shift: TShiftState); -begin - inherited; - if Assigned(FOnChange) then - FOnChange(Self); -end; - -procedure TExtSynHotKey.Paint; -var - r: TRect; -begin - r := ClientRect; - Canvas.Brush.Style := bsSolid; - Canvas.Brush.Color := Color; - InflateRect(r, -BorderWidth, -BorderWidth); - Canvas.FillRect(r); - if Enabled then - Canvas.Font.Color := clWindowText - else - Canvas.Font.Color := clGrayText; - SynUnicode.TextRect(Canvas, r, BorderWidth + 1, BorderWidth + 1, Text); -end;} - - { TExtComboBox } @@ -463,70 +399,4 @@ end; -{ TExtHintWindow } - - -{function TExtHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: string; AData: TCustomData): TRect; -begin - Result := inherited; - // Customized: enlarge surrounding rect to make space for padding - if AHint.Contains(SLineBreak) then begin - Result.Right := Result.Right + 2 * ScaleValue(Padding); - Result.Bottom := Result.Bottom + 2 * ScaleValue(Padding); - end; -end; - - -procedure TExtHintWindow.Paint; -var - R, ClipRect: TRect; - LColor: TColor; - LStyle: TCustomStyleServices; - LDetails: TThemedElementDetails; - LGradientStart, LGradientEnd, LTextColor: TColor; -begin - R := ClientRect; - LStyle := StyleServices(Screen.ActiveForm); - LTextColor := Screen.HintFont.Color; - if LStyle.Enabled then - begin - ClipRect := R; - InflateRect(R, 4, 4); - if TOSVersion.Check(6) and LStyle.IsSystemStyle then - begin - // Paint Windows gradient background - LStyle.DrawElement(Canvas.Handle, LStyle.GetElementDetails(tttStandardNormal), R, ClipRect); - end - else - begin - LDetails := LStyle.GetElementDetails(thHintNormal); - if LStyle.GetElementColor(LDetails, ecGradientColor1, LColor) and (LColor <> clNone) then - LGradientStart := LColor - else - LGradientStart := clInfoBk; - if LStyle.GetElementColor(LDetails, ecGradientColor2, LColor) and (LColor <> clNone) then - LGradientEnd := LColor - else - LGradientEnd := clInfoBk; - if LStyle.GetElementColor(LDetails, ecTextColor, LColor) and (LColor <> clNone) then - LTextColor := LColor - else - LTextColor := Screen.HintFont.Color; - GradientFillCanvas(Canvas, LGradientStart, LGradientEnd, R, gdVertical); - end; - R := ClipRect; - end; - Inc(R.Left, 2); - Inc(R.Top, 2); - // Customized: move inner rect right+down to add padding to outer edge - if String(Caption).Contains(SLineBreak) then begin - Inc(R.Left, ScaleValue(Padding)); - Inc(R.Top, ScaleValue(Padding)); - end; - Canvas.Font.Color := LTextColor; - DrawText(Canvas.Handle, Caption, -1, R, DT_LEFT or DT_NOPREFIX or - DT_WORDBREAK or DrawTextBiDiModeFlagsReadingOnly); -end;} - - end. diff --git a/source/tabletools.lfm b/source/tabletools.lfm index a4587b76..b419b33e 100644 --- a/source/tabletools.lfm +++ b/source/tabletools.lfm @@ -3,7 +3,7 @@ object frmTableTools: TfrmTableTools Height = 479 Top = 126 Width = 955 - BorderIcons = [biSystemMenu, biHelp] + BorderIcons = [biSystemMenu] Caption = 'Table tools' ClientHeight = 479 ClientWidth = 955 diff --git a/source/tabletools.pas b/source/tabletools.pas index e13a40f6..3202641d 100644 --- a/source/tabletools.pas +++ b/source/tabletools.pas @@ -179,8 +179,6 @@ type ToFile, ToDir, ToClipboard, ToDb, ToServer: Boolean; FObjectSizes, FObjectSizesDone, FObjectSizesDoneExact: Int64; FStartTimeAll: Cardinal; - //procedure WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ; message WM_NCLBUTTONDOWN; - //procedure WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ; message WM_NCLBUTTONUP; procedure SetToolMode(Value: TToolMode); procedure Output(SQL: String; IsEndOfQuery, ForFile, ForDir, ForDb, ForServer: Boolean); procedure AddResults(SQL: String; Connection: TDBConnection); @@ -231,28 +229,6 @@ var {$R *.lfm} -{procedure TfrmTableTools.WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ; -begin - if Msg.HitTest = HTHELP then - Msg.Result := 0 // "eat" the message - else - inherited; -end;} - - -{procedure TfrmTableTools.WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ; -begin - if Msg.HitTest = HTHELP then begin - Msg.Result := 0; - if tabsTools.ActivePage = tabSQLexport then - Help(Self, 'sqlexport') - else - ErrorDialog(_('No help available for this tab.')); - end else - inherited; -end;} - - procedure TfrmTableTools.FormCreate(Sender: TObject); var i: Integer;