You've already forked lazarus-ccr
tvplanit: Some cleanup in TVpCanvasUtils. Fix Calendar font size being frozen at 8pt.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4893 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -58,6 +58,7 @@ object MainForm: TMainForm
|
|||||||
KBNavigation = True
|
KBNavigation = True
|
||||||
DateLabelFormat = 'mmmm yyyy'
|
DateLabelFormat = 'mmmm yyyy'
|
||||||
DayHeadAttributes.Color = clBtnFace
|
DayHeadAttributes.Color = clBtnFace
|
||||||
|
DayHeadAttributes.Font.Height = -13
|
||||||
DayNameStyle = dsShort
|
DayNameStyle = dsShort
|
||||||
DrawingStyle = dsFlat
|
DrawingStyle = dsFlat
|
||||||
EventDayStyle = [fsItalic]
|
EventDayStyle = [fsItalic]
|
||||||
@ -244,7 +245,6 @@ object MainForm: TMainForm
|
|||||||
DayHeadAttributes.Color = clBtnFace
|
DayHeadAttributes.Color = clBtnFace
|
||||||
DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
|
DayHeadAttributes.DateFormat = 'dddd mmmm, dd'
|
||||||
DayHeadAttributes.Font.Height = -13
|
DayHeadAttributes.Font.Height = -13
|
||||||
DayHeadAttributes.Font.Name = 'Tahoma'
|
|
||||||
DayHeadAttributes.Bordered = True
|
DayHeadAttributes.Bordered = True
|
||||||
DrawingStyle = dsFlat
|
DrawingStyle = dsFlat
|
||||||
HeadAttributes.Color = clBtnFace
|
HeadAttributes.Color = clBtnFace
|
||||||
|
@ -8,7 +8,8 @@ uses
|
|||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
StdCtrls, ComCtrls, LCLTranslator, Menus,
|
StdCtrls, ComCtrls, LCLTranslator, Menus,
|
||||||
VpBaseDS, VpDayView, VpWeekView, VpTaskList, VpAbout,
|
VpBaseDS, VpDayView, VpWeekView, VpTaskList, VpAbout,
|
||||||
VpContactGrid, VpMonthView, VpResEditDlg, VpContactButtons, VpBufDS, VpNavBar;
|
VpContactGrid, VpMonthView, VpResEditDlg, VpContactButtons, VpBufDS, VpNavBar,
|
||||||
|
VpData;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -125,8 +126,8 @@ uses
|
|||||||
{$IFDEF WINDOWS}
|
{$IFDEF WINDOWS}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
LResources, LazUTF8, LazFileUtils, StrUtils, Translations, IniFiles, Math,
|
LResources, LazFileUtils, LazUTF8, StrUtils, Translations, IniFiles, Math,
|
||||||
VpMisc, VpBase, VpData;
|
VpMisc, VpBase;
|
||||||
|
|
||||||
const
|
const
|
||||||
LANGUAGE_DIR = '..\..\languages\';
|
LANGUAGE_DIR = '..\..\languages\';
|
||||||
|
@ -208,11 +208,7 @@ var
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
S: string;
|
S: string;
|
||||||
DrawRect: TRect;
|
DrawRect: TRect;
|
||||||
fontsize: Integer;
|
|
||||||
begin
|
begin
|
||||||
{Store the font size}
|
|
||||||
fontsize := RenderCanvas.Font.Size;
|
|
||||||
|
|
||||||
{draw the day name column labels}
|
{draw the day name column labels}
|
||||||
RenderCanvas.Font.Color := DayNameColor;
|
RenderCanvas.Font.Color := DayNameColor;
|
||||||
I := 0;
|
I := 0;
|
||||||
@ -240,10 +236,6 @@ begin
|
|||||||
S := SysToUTF8(S);
|
S := SysToUTF8(S);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{restore the font size - this is not needed normally, but may solve the
|
|
||||||
issue with growing fonts along this row in MacOSX }
|
|
||||||
RenderCanvas.Font.Size := fontsize;
|
|
||||||
|
|
||||||
{draw the day name above each column}
|
{draw the day name above each column}
|
||||||
DrawRect := TVpCalendarOpener(FCalendar).clRowCol[1, I];
|
DrawRect := TVpCalendarOpener(FCalendar).clRowCol[1, I];
|
||||||
OffsetRect(DrawRect, RealLeft, Realtop);
|
OffsetRect(DrawRect, RealLeft, Realtop);
|
||||||
|
@ -721,7 +721,6 @@ var
|
|||||||
OldFont: TFont;
|
OldFont: TFont;
|
||||||
RealPoint: TPoint;
|
RealPoint: TPoint;
|
||||||
OldBrushStyle: TBrushStyle;
|
OldBrushStyle: TBrushStyle;
|
||||||
// savedFontHeight: Integer;
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(FCanvas) then
|
if not Assigned(FCanvas) then
|
||||||
raise EVpCanvasError.Create(RSNoCanvas);
|
raise EVpCanvasError.Create(RSNoCanvas);
|
||||||
@ -756,13 +755,12 @@ begin
|
|||||||
else LF.lfPitchAndFamily := DEFAULT_PITCH;
|
else LF.lfPitchAndFamily := DEFAULT_PITCH;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Create new font to use
|
// Store currently used font
|
||||||
OldFont := FCanvas.Font;
|
|
||||||
OldFont := TFont.Create;
|
OldFont := TFont.Create;
|
||||||
try
|
try
|
||||||
OldFont.Assign(FCanvas.Font);
|
OldFont.Assign(FCanvas.Font);
|
||||||
// savedFontHeight := FCanvas.Font.Height;
|
// Create new font to use.
|
||||||
FCanvas.Font.Handle:= CreateFontIndirect(LF);
|
FCanvas.Font.Handle := CreateFontIndirect(LF);
|
||||||
|
|
||||||
// Output the text
|
// Output the text
|
||||||
if Rotate then
|
if Rotate then
|
||||||
@ -777,9 +775,8 @@ begin
|
|||||||
FCanvas.Brush.Style := OldBrushStyle;
|
FCanvas.Brush.Style := OldBrushStyle;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
// Restore previously used font.
|
||||||
FCanvas.Font.Assign(OldFont);
|
FCanvas.Font.Assign(OldFont);
|
||||||
// FCanvas.Font := OldFont;
|
|
||||||
// FCanvas.Font.Height := savedFontHeight;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -278,7 +278,6 @@ begin
|
|||||||
FMonthView := AOwner;
|
FMonthView := AOwner;
|
||||||
FFont := TFont.Create;
|
FFont := TFont.Create;
|
||||||
FFont.Assign(FMonthView.Font);
|
FFont.Assign(FMonthView.Font);
|
||||||
FFont.Size := 8;
|
|
||||||
FColor := clSilver;
|
FColor := clSilver;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
@ -13,7 +13,7 @@ type
|
|||||||
private
|
private
|
||||||
FMonthView: TVpMonthView;
|
FMonthView: TVpMonthView;
|
||||||
// local parameters of the old TVpMonthView method
|
// local parameters of the old TVpMonthView method
|
||||||
HeadRect: TRect;
|
// HeadRect: TRect;
|
||||||
DisplayDate: TDateTime;
|
DisplayDate: TDateTime;
|
||||||
RealColor: TColor;
|
RealColor: TColor;
|
||||||
BevelHighlight: TColor;
|
BevelHighlight: TColor;
|
||||||
@ -699,49 +699,45 @@ end;
|
|||||||
|
|
||||||
procedure TVpMonthViewPainter.DrawHeader;
|
procedure TVpMonthViewPainter.DrawHeader;
|
||||||
var
|
var
|
||||||
|
HeadRect: TRect;
|
||||||
HeadTextRect: TRect;
|
HeadTextRect: TRect;
|
||||||
HeadStr: string;
|
HeadStr: string;
|
||||||
HeadStrLen : Integer;
|
HeadStrLen : Integer;
|
||||||
dayHeadHeight: Integer;
|
dayHeadHeight: Integer;
|
||||||
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
RenderCanvas.Brush.Color := DayHeadAttrColor;
|
RenderCanvas.Brush.Color := DayHeadAttrColor;
|
||||||
|
|
||||||
dayHeadHeight := TVpMonthViewOpener(FMonthView).mvDayHeadHeight;
|
dayHeadHeight := TVpMonthViewOpener(FMonthView).mvDayHeadHeight;
|
||||||
|
|
||||||
|
HeadRect := Rect(RealLeft + 1, RealTop + 1, RealRight - 1, RealTop + dayHeadHeight);
|
||||||
|
|
||||||
{ draw the header cell and borders }
|
{ draw the header cell and borders }
|
||||||
if FMonthView.DrawingStyle = dsFlat then begin
|
if FMonthView.DrawingStyle = dsFlat then begin
|
||||||
{ draw an outer and inner bevel }
|
{ draw an outer and inner bevel }
|
||||||
|
{
|
||||||
HeadRect.Left := RealLeft + 1;
|
HeadRect.Left := RealLeft + 1;
|
||||||
HeadRect.Top := RealTop + 1;
|
HeadRect.Top := RealTop + 1;
|
||||||
HeadRect.Right := RealRight - 1;
|
HeadRect.Right := RealRight - 1;
|
||||||
HeadRect.Bottom := RealTop + dayHeadHeight;
|
HeadRect.Bottom := RealTop + dayHeadHeight;
|
||||||
|
}
|
||||||
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
|
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
|
||||||
DrawBevelRect(
|
R := TPSRotateRectangle(Angle, RenderIn, HeadRect);
|
||||||
RenderCanvas,
|
DrawBevelRect(RenderCanvas, R, BevelShadow, BevelShadow);
|
||||||
TPSRotateRectangle(Angle, RenderIn, HeadRect),
|
|
||||||
BevelHighlight,
|
|
||||||
BevelShadow
|
|
||||||
);
|
|
||||||
end else
|
end else
|
||||||
if FMonthView.DrawingStyle = ds3d then begin
|
if FMonthView.DrawingStyle = ds3d then begin
|
||||||
{ draw a 3d bevel }
|
{ draw a 3d bevel }
|
||||||
HeadRect.Left := RealLeft + 2;
|
InflateRect(HeadRect, -1, -1);
|
||||||
HeadRect.Top := RealTop + 2;
|
HeadRect.Bottom := HeadRect.Top + dayHeadHeight;
|
||||||
HeadRect.Right := RealRight - 3;
|
{
|
||||||
HeadRect.Bottom := RealTop + dayHeadHeight;
|
AHeadRect.Left := RealLeft + 2;
|
||||||
|
AHeadRect.Top := RealTop + 2;
|
||||||
|
AHeadRect.Right := RealRight - 3;
|
||||||
|
AHeadRect.Bottom := RealTop + dayHeadHeight;
|
||||||
|
}
|
||||||
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
|
TPSFillRect(RenderCanvas, Angle, RenderIn, HeadRect);
|
||||||
DrawBevelRect(
|
R := TPSRotateRectangle(Angle, RenderIn, HeadRect);
|
||||||
RenderCanvas,
|
DrawBevelRect(RenderCanvas, R, BevelHighlight, BevelDarkShadow);
|
||||||
TPSRotateRectangle(Angle, RenderIn, HeadRect),
|
|
||||||
BevelHighlight,
|
|
||||||
BevelDarkShadow
|
|
||||||
);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
HeadRect.Left := RealLeft + 1;
|
|
||||||
HeadRect.Top := RealTop + 1;
|
|
||||||
HeadRect.Right := RealRight - 1;
|
|
||||||
HeadRect.Bottom := RealTop + dayHeadHeight;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Acquire startdate and end date }
|
{ Acquire startdate and end date }
|
||||||
@ -751,7 +747,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{ draw the text }
|
{ draw the text }
|
||||||
if DisplayOnly and (RenderCanvas.TextWidth (HeadStr) >= RealWidth) then
|
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RealWidth) then
|
||||||
HeadTextRect.TopLeft:= Point(
|
HeadTextRect.TopLeft:= Point(
|
||||||
RealLeft + TextMargin * 2,
|
RealLeft + TextMargin * 2,
|
||||||
HeadRect.Top
|
HeadRect.Top
|
||||||
@ -759,7 +755,7 @@ begin
|
|||||||
else
|
else
|
||||||
if DisplayOnly then
|
if DisplayOnly then
|
||||||
HeadTextRect.TopLeft := Point(
|
HeadTextRect.TopLeft := Point(
|
||||||
RealLeft + (RealWidth - RenderCanvas.TextWidth (HeadStr)) div 2,
|
RealLeft + (RealWidth - RenderCanvas.TextWidth(HeadStr)) div 2,
|
||||||
HeadRect.Top
|
HeadRect.Top
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user