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

@ -16,11 +16,8 @@ object MainForm: TMainForm
Height = 248 Height = 248
Top = 8 Top = 8
Width = 882 Width = 882
HTMLBorder = False
HTMLFontName = 'Arial'
BorderColor = clCream BorderColor = clCream
Year = 2018 Year = 2018
AutoSizeOptions = [aoGrid, aoFirstColumn, aoFirstRow, aoColumns, aoRows]
FirstColWidth = 67 FirstColWidth = 67
FirstRowHeight = 19 FirstRowHeight = 19
CellMargins.Left = 2 CellMargins.Left = 2
@ -28,13 +25,8 @@ object MainForm: TMainForm
CellMargins.Right = 2 CellMargins.Right = 2
CellMargins.Bottom = 2 CellMargins.Bottom = 2
DayFormat = dfShort DayFormat = dfShort
WeekendDays = [wdSaturday, wdSunday]
MonthNamesAlignment = taCenter
DayNamesAlignment = taCenter
DaysAlignment = taCenter
DefaultColWidth = 19 DefaultColWidth = 19
BorderSpacing.Around = 8 BorderSpacing.Around = 8
ScrollBars = ssNone
TitleStyle = tsStandard TitleStyle = tsStandard
ColWidths = ( ColWidths = (
67 67

View File

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