Skip to content

Commit

Permalink
Restore multi line grid setup, broken in recent commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarbecker committed Dec 18, 2018
1 parent f2babc8 commit fe9c92a
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions source/apphelpers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1459,12 +1459,15 @@ procedure StreamToClipboard(Text, HTML: TStream; CreateHTMLHeader: Boolean);

procedure FixVT(VT: TVirtualStringTree; MultiLineCount: Word=1);
var
SingleLineHeight: Integer;
Node: PVirtualNode;
begin
// This is called either in some early stage, or from preferences dialog
VT.BeginUpdate;
SingleLineHeight := GetTextHeight(VT.Font) + 3;
// Multiline nodes?
if MultiLineCount > 1 then
VT.DefaultNodeHeight := VT.DefaultNodeHeight * MultiLineCount + 5;
VT.DefaultNodeHeight := SingleLineHeight * MultiLineCount;
VT.Header.Height := SingleLineHeight;
// Apply new height to multi line grid nodes
Node := VT.GetFirstInitialized;
while Assigned(Node) do begin
Expand Down Expand Up @@ -1774,36 +1777,36 @@ procedure ExplodeQuotedList(Text: String; var List: TStringList);

procedure InheritFont(AFont: TFont);
var
LogFont: TLogFont;
GUIFontName: String;
begin
// Set custom font if set, or default system font.
// In high-dpi mode, the font *size* is increased automatically somewhere in the VCL,
// caused by a form's .Scaled property. So we don't increase it here again.
// To test this, you really need to log off/on Windows!
GUIFontName := AppSettings.ReadString(asGUIFontName);
if not GUIFontName.IsEmpty then begin
LogFont: TLogFont;
GUIFontName: String;
begin
// Set custom font if set, or default system font.
// In high-dpi mode, the font *size* is increased automatically somewhere in the VCL,
// caused by a form's .Scaled property. So we don't increase it here again.
// To test this, you really need to log off/on Windows!
GUIFontName := AppSettings.ReadString(asGUIFontName);
if not GUIFontName.IsEmpty then begin
// Apply user specified font
AFont.Name := GUIFontName;
// Set size on top of automatic dpi-increased size
AFont.Size := AppSettings.ReadInt(asGUIFontSize);
end else begin
// Apply system font. See issue #3204.
// Code taken from http://www.gerixsoft.com/blog/delphi/system-font
if SystemParametersInfo(SPI_GETICONTITLELOGFONT, SizeOf(TLogFont), @LogFont, 0) then begin
AFont.Height := LogFont.lfHeight;
AFont.Orientation := LogFont.lfOrientation;
AFont.Charset := TFontCharset(LogFont.lfCharSet);
AFont.Name := PChar(@LogFont.lfFaceName);
case LogFont.lfPitchAndFamily and $F of
VARIABLE_PITCH: AFont.Pitch := fpVariable;
FIXED_PITCH: AFont.Pitch := fpFixed;
else AFont.Pitch := fpDefault;
end;
end;
end;
end;

// Apply system font. See issue #3204.
// Code taken from http://www.gerixsoft.com/blog/delphi/system-font
if SystemParametersInfo(SPI_GETICONTITLELOGFONT, SizeOf(TLogFont), @LogFont, 0) then begin
AFont.Height := LogFont.lfHeight;
AFont.Orientation := LogFont.lfOrientation;
AFont.Charset := TFontCharset(LogFont.lfCharSet);
AFont.Name := PChar(@LogFont.lfFaceName);
case LogFont.lfPitchAndFamily and $F of
VARIABLE_PITCH: AFont.Pitch := fpVariable;
FIXED_PITCH: AFont.Pitch := fpFixed;
else AFont.Pitch := fpDefault;
end;
end;
end;
end;


function GetLightness(AColor: TColor): Byte;
var
Expand Down

0 comments on commit fe9c92a

Please sign in to comment.