IDE.MainForm.FinalHelper.pas 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. unit IDE.MainForm.FinalHelper;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2025 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler form - final helper to be used by MainForm
  8. Includes some general functions
  9. }
  10. interface
  11. uses
  12. SysUtils,
  13. IDE.MainForm, IDE.MainForm.ScintHelper;
  14. type
  15. TMainFormFinalHelper = class helper(TMainFormScintHelper) for TMainForm
  16. class procedure AppOnException(Sender: TObject; E: Exception);
  17. function ToCurrentPPI(const XY: Integer): Integer;
  18. function FromCurrentPPI(const XY: Integer): Integer;
  19. end;
  20. implementation
  21. uses
  22. Windows,
  23. Shared.CommonFunc, Shared.CommonFunc.Vcl,
  24. IDE.Messages;
  25. class procedure TMainFormFinalHelper.AppOnException(Sender: TObject; E: Exception);
  26. begin
  27. MsgBox(AddPeriod(E.Message), SCompilerFormCaption, mbCriticalError, MB_OK);
  28. end;
  29. function TMainFormFinalHelper.ToCurrentPPI(const XY: Integer): Integer;
  30. begin
  31. Result := MulDiv(XY, CurrentPPI, 96);
  32. end;
  33. function TMainFormFinalHelper.FromCurrentPPI(const XY: Integer): Integer;
  34. begin
  35. Result := MulDiv(XY, 96, CurrentPPI);
  36. end;
  37. end.