You've already forked lazarus-ccr
tvplanit: Improving LCL scaling.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8438 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -220,12 +220,12 @@ begin
|
||||
|
||||
{ Calculate size of rect for the day number at the top of the TextRect. }
|
||||
if ACol = 6 then
|
||||
tmpRect.Left := ATextRect.Left + mvColWidth - TextAdjust - TextMargin
|
||||
tmpRect.Left := ATextRect.Left + mvColWidth - TextAdjust - FMonthView.TextMargin
|
||||
else
|
||||
tmpRect.Left := ATextRect.Right - TextAdjust - TextMargin + 2;
|
||||
tmpRect.Left := ATextRect.Right - TextAdjust - FMonthView.TextMargin + 2;
|
||||
if fsItalic in RenderCanvas.Font.Style then
|
||||
dec(tmpRect.Left, 2);
|
||||
tmpRect.Top := ATextRect.Top + TextMargin div 2;
|
||||
tmpRect.Top := ATextRect.Top + FMonthView.TextMargin div 2;
|
||||
tmpRect.Right := tmpRect.Left + textAdjust;
|
||||
tmpRect.Bottom := tmpRect.Top + textHeight;
|
||||
|
||||
@ -372,12 +372,12 @@ begin
|
||||
|
||||
{ Fix header string }
|
||||
StrLen := RenderCanvas.TextWidth(Str);
|
||||
if (StrLen > mvColWidth - TextMargin * 2) then
|
||||
Str := GetDisplayString(RenderCanvas, Str, 0, mvColWidth - TextMargin * 2);
|
||||
if (StrLen > mvColWidth - FMonthView.TextMargin * 2) then
|
||||
Str := GetDisplayString(RenderCanvas, Str, 0, mvColWidth - FMonthView.TextMargin * 2);
|
||||
StrLen := RenderCanvas.TextWidth(Str);
|
||||
|
||||
{ Draw header text }
|
||||
P := Point((dhRect.Left + dhRect.Right - StrLen) div 2, dhRect.Top + TextMargin - 1);
|
||||
P := Point((dhRect.Left + dhRect.Right - StrLen) div 2, dhRect.Top + FMonthView.TextMargin - 1);
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, P.X, P.Y, Str);
|
||||
|
||||
DayTAG := (DayTAG + 1) mod 7;
|
||||
@ -496,6 +496,7 @@ var
|
||||
eventCat: TVpCategoryInfo;
|
||||
dayRect: TRect;
|
||||
TextRect: TRect;
|
||||
txtMargin: Integer;
|
||||
tmpRect: TRect;
|
||||
Str: String;
|
||||
StrLen: Integer;
|
||||
@ -507,6 +508,8 @@ begin
|
||||
RenderCanvas.Pen.Style := psSolid;
|
||||
RenderCanvas.Brush.Color := RealColor;
|
||||
|
||||
txtMargin := FMonthView.TextMargin;
|
||||
|
||||
{ write the events }
|
||||
if (FMonthView.DataStore <> nil) and FMonthView.ShowEvents and
|
||||
(FMonthView.DataStore.Resource <> nil) and
|
||||
@ -527,7 +530,7 @@ begin
|
||||
TextRect.TopLeft := Point(dayRect.Left+1, dayRect.Top+1);
|
||||
TextRect.BottomRight := Point(
|
||||
TextRect.Left + mvColWidth,
|
||||
TextRect.Top + mvEventTextHeight + TextMargin// div 2
|
||||
TextRect.Top + mvEventTextHeight + txtMargin// div 2
|
||||
);
|
||||
|
||||
{ set canvas color }
|
||||
@ -550,9 +553,9 @@ begin
|
||||
|
||||
{ shorten events that are next to the day number, in order }
|
||||
{ to give the day number enough room }
|
||||
if (TextRect.Top < dayRect.Top + mvDayNumberHeight + TextMargin div 2)
|
||||
if (TextRect.Top < dayRect.Top + mvDayNumberHeight + txtMargin div 2)
|
||||
then
|
||||
TextRect.Right := TextRect.Left + mvColWidth - mvDayNumberHeight - TextMargin * 2
|
||||
TextRect.Right := TextRect.Left + mvColWidth - mvDayNumberHeight - txtMargin * 2
|
||||
else
|
||||
TextRect.Right := TextRect.Left + mvColWidth - 3;
|
||||
|
||||
@ -582,11 +585,11 @@ begin
|
||||
RenderCanvas.Font.Color := FMonthView.OffDayFontColor;
|
||||
|
||||
StrLen := RenderCanvas.TextWidth(Str);
|
||||
if StrLen > WidthOf(TextRect) - TextMargin * 2 then
|
||||
Str := GetDisplayString(RenderCanvas, Str, 0, WidthOf(TextRect) - TextMargin * 2);
|
||||
if StrLen > WidthOf(TextRect) - txtMargin * 2 then
|
||||
Str := GetDisplayString(RenderCanvas, Str, 0, WidthOf(TextRect) - txtMargin * 2);
|
||||
|
||||
{ write the event text }
|
||||
P := Point(TextRect.Left + TextMargin div 2, TextRect.Top + TextMargin div 2);
|
||||
P := Point(TextRect.Left + txtMargin div 2, TextRect.Top + txtMargin div 2);
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, P.X, P.Y, Str);
|
||||
|
||||
{ Store TextRect and Event in EventArray }
|
||||
@ -695,12 +698,12 @@ begin
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
{$ENDIF}
|
||||
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RealWidth) then
|
||||
HeadTextRect.Left := RealLeft + TextMargin * 2
|
||||
HeadTextRect.Left := RealLeft + FMonthView.TextMargin * 2
|
||||
else
|
||||
if DisplayOnly then
|
||||
HeadTextRect.Left := RealLeft + (RealWidth - RenderCanvas.TextWidth(HeadStr)) div 2
|
||||
else
|
||||
HeadTextRect.Left := RealLeft + 30 + TextMargin * 2;
|
||||
HeadTextRect.Left := RealLeft + 30 + FMonthView.TextMargin * 2;
|
||||
HeadTextRect.Top := (HeadRect.Top + HeadRect.Bottom - RenderCanvas.TextHeight('Tg')) div 2;
|
||||
HeadTextRect.BottomRight := HeadRect.BottomRight;
|
||||
|
||||
@ -712,7 +715,7 @@ begin
|
||||
RenderCanvas,
|
||||
HeadStr,
|
||||
0,
|
||||
HeadTextRect.Right - HeadTextRect.Left - TextMargin
|
||||
HeadTextRect.Right - HeadTextRect.Left - FMonthView.TextMargin
|
||||
);
|
||||
end;
|
||||
|
||||
@ -734,11 +737,19 @@ end;
|
||||
procedure TVpMonthViewPainter.FixFontHeights;
|
||||
begin
|
||||
with FMonthView do begin
|
||||
{$IF VP_LCL_SCALING = 0}
|
||||
HeadAttributes.Font.Height := GetRealFontHeight(HeadAttributes.Font);
|
||||
DayHeadAttributes.Font.Height := GetRealFontHeight(DayHeadAttributes.Font);
|
||||
DayNumberFont.Height := GetRealFontHeight(DayNumberFont);
|
||||
EventFont.Height := GetRealFontHeight(EventFont);
|
||||
Font.Height := GetRealFontHeight(Font);
|
||||
{$ELSE}
|
||||
HeadAttributes.Font.Height := FixFontHeight(HeadAttributes.Font);
|
||||
DayHeadAttributes.Font.Height := FixFontHeight(DayHeadAttributes.Font);
|
||||
DayNumberFont.Height := FixFontHeight(DayNumberFont);
|
||||
EventFont.Height := FixFontHeight(EventFont);
|
||||
Font.Height := FixFontHeight(Font);
|
||||
{$IFEND}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -823,7 +834,7 @@ begin
|
||||
|
||||
DisplayDate := IfThen(RenderDate = 0, Date, RenderDate);
|
||||
|
||||
{ we use the VpProductName because is is a good representation of some }
|
||||
{ We use the VpProductName because is is a good representation of some }
|
||||
{ generic text }
|
||||
RenderCanvas.Font.Assign(FMonthView.DayHeadAttributes.Font);
|
||||
{$IF VP_LCL_SCALING = 0}
|
||||
|
Reference in New Issue
Block a user