jvcllaz: Fix handling of some lfm default values.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8375 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-09 20:24:25 +00:00
parent 5ae03788b6
commit b7a192a723
2 changed files with 26 additions and 21 deletions

View File

@ -105,6 +105,7 @@ type
// Getters, setters
function GetFlat: Boolean;
function IsHtmlFontNameStored: Boolean;
procedure SetAutoSizeOptions(const Value: TJvAutoSizeOptions);
procedure SetBookMarkColor(const Value: TColor);
procedure SetBorderColor(const Value: TColor);
@ -124,7 +125,7 @@ type
procedure SetWeekendDays(const Value: TJvWeekDaySet);
procedure SetYear(const Value: Integer);
procedure SetYearAlignment(const Value: TAlignment);
// Event handlers
procedure DoShowHint(var HintStr: THintString; var CanShow: Boolean;
var HintInfo: THintInfo);
@ -228,8 +229,8 @@ type
procedure Find;
published
property HTMLBorder: Boolean read FHTMLBorder write SetHTMLBorder;
property HTMLFontName: string read FHTMLFontName write SetHTMLFontName;
property HTMLBorder: Boolean read FHTMLBorder write SetHTMLBorder default false;
property HTMLFontName: string read FHTMLFontName write SetHTMLFontName stored IsHtmlFontNameStored;
property BorderColor: TColor read FBorderColor write SetBorderColor default JvDefaultBorderColor;
property BookMarkColor: TColor read FBookMarkColor write SetBookMarkColor default JvDefaultBookmarkColor;
property WeekendColor: TColor read FWeekendColor write SetWeekendColor default JvDefaultWeekendColor;
@ -241,7 +242,8 @@ type
property YearFile: string read FYearFile write FYearFile;
property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
property AutoSizeOptions: TJvAutoSizeOptions read FAutoSizeOptions write SetAutoSizeOptions;
property AutoSizeOptions: TJvAutoSizeOptions read FAutoSizeOptions write SetAutoSizeOptions
default [aoGrid, aoFirstColumn, aoFirstRow, aoColumns, aoRows];
property FirstColWidth: Integer read GetFirstColWidth write SetFirstColWidth;
property FirstRowHeight: Integer read GetFirstRowHeight write SetFirstRowHeight;
@ -249,12 +251,12 @@ type
property DayFormat: TJvDayFormat read FDayFormat write SetDayFormat default dfInitial;
property MonthFormat: TJvMonthFormat read FMonthFormat write SetMonthFormat default mfLong;
property WeekendDays: TJvWeekDaySet read FWeekendDays write SetWeekendDays;
property WeekendDays: TJvWeekDaySet read FWeekendDays write SetWeekendDays default [wdSaturday, wdSunday];
property MonthNamesAlignment: TAlignment read FMonthNamesAlignment write SetMonthNamesAlignment default taLeftJustify;
property DayNamesAlignment: TAlignment read FDayNamesAlignment write SetDayNamesAlignment default taLeftJustify;
property DaysAlignment: TAlignment read FDaysAlignment write SetDaysAlignment default taLeftJustify;
property YearAlignment: TAlignment read FYearAlignment write SetYearAlignment default taLeftJustify;
property DayNamesAlignment: TAlignment read FDayNamesAlignment write SetDayNamesAlignment default taCenter;
property DaysAlignment: TAlignment read FDaysAlignment write SetDaysAlignment default taCenter;
property YearAlignment: TAlignment read FYearAlignment write SetYearAlignment default taLeftJustify;
property OnSelectCell;
property OnDrawCell;
@ -273,7 +275,7 @@ type
property BorderStyle;
property Flat read GetFlat write SetFlat default true;
property Font;
property ScrollBars;
property ScrollBars default ssNone;
property TitleStyle;
end;
@ -338,7 +340,7 @@ begin
Flat := true;
DecodeDate(Now, FCurrentYear, FCurrentMonth, FCurrentDay);
HTMLFontName := 'Arial';
HTMLFontName := 'default';
DecodeDate(Now, AYear, AMonth, ADay);
FYear := AYear;
@ -394,7 +396,13 @@ var
Month, Day: Word;
ADate: TDate;
CanAdd: Boolean;
fontName: String;
begin
if SameText(HTMLFontName, 'default') then
fontName := GetFontData(Font.Handle).Name
else
fontName := HTMLFontName;
AList.Clear;
if Border then
Tbs := '1'
@ -402,7 +410,7 @@ begin
Tbs := '0';
AList.Append('<html><head><title>Year ' + IntToStr(Year) + '</title></head>');
AList.Append('<body>');
AList.Append('<font size=2 face="' + HTMLFontName + '">');
AList.Append('<font size=2 face="' + fontName + '">');
AList.Append('<center><h3>Year ' + IntToStr(Year) + '</h3></center>');
AList.Append('<Table width=100% border=' + Tbs + '>');
for ARow := 1 to 12 do
@ -422,7 +430,7 @@ begin
AList.Append('<tr>');
AList.Append('<td width=20%>' + DS + '</td>');
Infs := FYearData[ACol, ARow].InfoText;
Infs := StringReplace(Infs, Cr, '<br>', [rfReplaceAll]);
Infs := StringReplace(Infs, LineEnding, '<br>', [rfReplaceAll]);
AList.Append('<td>' + Infs + '</td>');
AList.Append('</tr>');
end;
@ -1485,6 +1493,11 @@ begin
Result := inherited Flat;
end;
function TJvYearGrid.IsHtmlFontNameStored: Boolean;
begin
Result := not SameText(FHtmlFontName, 'default');
end;
procedure TJvYearGrid.SetFlat(AValue: Boolean);
begin
inherited Flat := AValue;
@ -1627,7 +1640,7 @@ var
taRightJustify:
Result := ARect.Right - AWidth - CellMargins.Right;
taCenter:
Result := ARect.Left + (ARect.Right - ARect.Left - AWidth) div 2;
Result := (ARect.Left + ARect.Right - AWidth) div 2;
else
Result := ARect.Left + CellMargins.Left;
end;