Changeset 473 for trunk/Packages
- Timestamp:
- Dec 4, 2023, 12:13:15 PM (12 months ago)
- Location:
- trunk/Packages
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r468 r473 104 104 procedure UnshareBitmap(Bitmap: TBitmap); 105 105 procedure Gtk2Fix; 106 procedure LoadConfig(Key: string); 107 procedure SaveConfig(Key: string); 106 108 107 109 const … … 193 195 UniFont: array [TFontType] of TFont; 194 196 Gamma: Integer; // global gamma correction (cent) 197 CustomDpiEnabled: Boolean; 198 CustomDpi: Integer; 195 199 196 200 procedure LoadAssets; … … 204 208 uses 205 209 {$IFDEF DPI}Dpi.PixelPointer,{$ELSE}PixelPointer,{$ENDIF} 206 Directories, Sound ;210 Directories, Sound, Registry; 207 211 208 212 var … … 1550 1554 procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer); 1551 1555 begin 1556 if not Assigned(LogoBuffer) then Exit; 1552 1557 UnshareBitmap(LogoBuffer); 1553 1558 BitBltCanvas(LogoBuffer.Canvas, 0, 0, Logo.Width, Logo.Height, Canvas, X, Y); … … 1732 1737 end; 1733 1738 1739 procedure LoadConfig(Key: string); 1740 var 1741 Reg: TRegistry; 1742 begin 1743 Reg := TRegistry.Create; 1744 with Reg do try 1745 OpenKey(Key, True); 1746 if ValueExists('Gamma') then Gamma := ReadInteger('Gamma') 1747 else Gamma := 100; 1748 if Gamma <> 100 then InitGammaLookupTable; 1749 if ValueExists('CustomDpiEnabled') then CustomDpiEnabled := Reg.ReadBool('CustomDpiEnabled') 1750 else CustomDpiEnabled := False; 1751 if ValueExists('CustomDpi') then CustomDpi := Reg.ReadInteger('CustomDpi') 1752 else CustomDpi := 96; 1753 {$IFDEF DPI} 1754 if CustomDpiEnabled then Screen.Dpi := CustomDpi 1755 else Screen.Dpi := Screen.GetSystemDpi; 1756 {$ENDIF} 1757 finally 1758 Reg.Free; 1759 end; 1760 end; 1761 1762 procedure SaveConfig(Key: string); 1763 var 1764 Reg: TRegistry; 1765 begin 1766 Reg := TRegistry.Create; 1767 with Reg do try 1768 OpenKey(Key, True); 1769 WriteInteger('Gamma', Gamma); 1770 WriteBool('CustomDpiEnabled', CustomDpiEnabled); 1771 WriteInteger('CustomDpi', CustomDpi); 1772 finally 1773 Free; 1774 end; 1775 end; 1776 1734 1777 procedure LoadAssets; 1735 1778 begin … … 1752 1795 end; 1753 1796 1797 LogoBuffer := TBitmap.Create; 1798 LogoBuffer.PixelFormat := TPixelFormat.pf24bit; 1799 LogoBuffer.SetSize(BigBook.Width, BigBook.Height); 1800 1754 1801 LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png'); 1755 1802 LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg'); … … 1801 1848 1802 1849 LoadAssets; 1803 1804 LogoBuffer := TBitmap.Create;1805 LogoBuffer.PixelFormat := TPixelFormat.pf24bit;1806 LogoBuffer.SetSize(BigBook.Width, BigBook.Height);1807 1850 end; 1808 1851 … … 1814 1857 FreeAndNil(Phrases); 1815 1858 FreeAndNil(Phrases2); 1816 FreeAndNil(LogoBuffer);1859 if Assigned(LogoBuffer) then FreeAndNil(LogoBuffer); 1817 1860 FreeAndNil(BigImp); 1818 1861 FreeAndNil(Paper); -
trunk/Packages/DpiControls/Dpi.Common.pas
r468 r473 7 7 8 8 const 9 FixedDpi = 2*96;10 9 DpiControlsComponentPaletteName = 'DpiControls'; 11 10 -
trunk/Packages/DpiControls/Dpi.Forms.pas
r468 r473 228 228 constructor Create; 229 229 destructor Destroy; override; 230 procedure UpdateScreen;231 230 procedure UpdateActiveFormFromNativeScreen; 232 231 function DisableForms(SkipForm: TForm; DisabledList: Classes.TList = nil): Classes.TList; 233 232 procedure EnableForms(var AFormList: Classes.TList); 233 function GetSystemDpi: Integer; 234 234 property FormCount: Integer read GetFormCount; 235 235 property Forms[Index: Integer]: TForm read GetForms; … … 400 400 begin 401 401 GetNativeApplication.Initialize; 402 Screen.UpdateScreen;403 402 end; 404 403 … … 442 441 FCreatingForm := TForm(Instance); 443 442 Instance.Create(Self); 444 Ok := true;443 Ok := True; 445 444 finally 446 445 if not Ok then begin … … 978 977 end; 979 978 979 function TScreen.GetSystemDpi: Integer; 980 begin 981 Result := LCLScreen.PixelsPerInch; 982 end; 983 980 984 constructor TScreen.Create; 981 985 begin … … 993 997 FreeAndNil(FPrevActiveForms); 994 998 inherited; 995 end;996 997 procedure TScreen.UpdateScreen;998 begin999 if FixedDpi = -1 then Dpi := LCLScreen.PixelsPerInch1000 else Dpi := FixedDpi;1001 999 end; 1002 1000
Note:
See TracChangeset
for help on using the changeset viewer.