You've already forked lazarus-ccr
tvplanit: DPI-aware font sizes of planner controls.
Publish some missing inherited properties of VpCalendar Move "GetTimeFormat" from FullDemo to unit vpmisc. Remove some hints/warnings. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5078 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,35 +1,35 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 301
|
||||
Height = 600
|
||||
Height = 596
|
||||
Top = 177
|
||||
Width = 978
|
||||
Width = 959
|
||||
Caption = 'Turbo Power VisualPlanIt Demo'
|
||||
ClientHeight = 580
|
||||
ClientWidth = 978
|
||||
ClientHeight = 576
|
||||
ClientWidth = 959
|
||||
Menu = MainMenu1
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.7'
|
||||
object Panel1: TPanel
|
||||
Left = 125
|
||||
Height = 580
|
||||
Height = 576
|
||||
Top = 0
|
||||
Width = 853
|
||||
Width = 834
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 580
|
||||
ClientWidth = 853
|
||||
ClientHeight = 576
|
||||
ClientWidth = 834
|
||||
TabOrder = 0
|
||||
object HeaderPanel: TPanel
|
||||
Left = 2
|
||||
Height = 48
|
||||
Top = 0
|
||||
Width = 851
|
||||
Width = 832
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 2
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 48
|
||||
ClientWidth = 851
|
||||
ClientWidth = 832
|
||||
Color = clActiveCaption
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
@ -54,28 +54,28 @@ object MainForm: TMainForm
|
||||
end
|
||||
object Notebook: TNotebook
|
||||
Left = 0
|
||||
Height = 532
|
||||
Height = 528
|
||||
Top = 48
|
||||
Width = 853
|
||||
PageIndex = 1
|
||||
Width = 834
|
||||
PageIndex = 0
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
object Events: TPage
|
||||
object LeftPanel: TPanel
|
||||
Left = 0
|
||||
Height = 532
|
||||
Height = 528
|
||||
Top = 0
|
||||
Width = 333
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 532
|
||||
ClientHeight = 528
|
||||
ClientWidth = 333
|
||||
TabOrder = 0
|
||||
object VpMonthView1: TVpMonthView
|
||||
Left = 0
|
||||
Height = 197
|
||||
Top = 335
|
||||
Top = 331
|
||||
Width = 333
|
||||
DataStore = VpBufDSDataStore1
|
||||
ControlLink = VpControlLink1
|
||||
@ -108,14 +108,14 @@ object MainForm: TMainForm
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 5
|
||||
Top = 330
|
||||
Top = 326
|
||||
Width = 333
|
||||
Align = alBottom
|
||||
ResizeAnchor = akBottom
|
||||
end
|
||||
object VpDayView1: TVpDayView
|
||||
Left = 0
|
||||
Height = 288
|
||||
Height = 284
|
||||
Top = 42
|
||||
Width = 333
|
||||
DataStore = VpBufDSDataStore1
|
||||
@ -262,15 +262,15 @@ object MainForm: TMainForm
|
||||
end
|
||||
object Splitter3: TSplitter
|
||||
Left = 333
|
||||
Height = 532
|
||||
Height = 528
|
||||
Top = 0
|
||||
Width = 5
|
||||
end
|
||||
object VpWeekView1: TVpWeekView
|
||||
Left = 338
|
||||
Height = 532
|
||||
Height = 528
|
||||
Top = 0
|
||||
Width = 515
|
||||
Width = 496
|
||||
DataStore = VpBufDSDataStore1
|
||||
ControlLink = VpControlLink1
|
||||
Color = clWindow
|
||||
@ -561,7 +561,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object VpNavBar1: TVpNavBar
|
||||
Left = 0
|
||||
Height = 580
|
||||
Height = 576
|
||||
Top = 0
|
||||
Width = 120
|
||||
ActiveFolder = 0
|
||||
@ -664,7 +664,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 120
|
||||
Height = 580
|
||||
Height = 576
|
||||
Top = 0
|
||||
Width = 5
|
||||
end
|
||||
|
@ -11,7 +11,8 @@ uses
|
||||
Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs,
|
||||
ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, VpBaseDS, VpDayView,
|
||||
VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg,
|
||||
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types, VpBase;
|
||||
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types,
|
||||
VpBase, VpCalendar;
|
||||
|
||||
type
|
||||
|
||||
@ -366,34 +367,6 @@ begin
|
||||
PopulateLanguages;
|
||||
ReadIni;
|
||||
|
||||
with VpDayview1 do begin
|
||||
AllDayEventAttributes.Font.Size := ScaleY(AllDayEventAttributes.Font.Size, DesignTimeDPI);
|
||||
Font.Size := ScaleY(Font.Size, DesignTimeDPI);
|
||||
HeadAttributes.Font.Size := ScaleY(HeadAttributes.Font.Size, DesignTimeDPI);
|
||||
RowHeadAttributes.HourFont.Size := ScaleY(RowHeadAttributes.HourFont.Size, DesignTimeDPI);
|
||||
RowHeadAttributes.MinuteFont.Size := ScaleY(RowHeadAttributes.MinuteFont.Size, DesignTimeDPI);
|
||||
end;
|
||||
with VpWeekView1 do begin
|
||||
AllDayEventAttributes.Font.Size := ScaleY(AllDayEventAttributes.Font.Size, DesignTimeDPI);
|
||||
DayHeadAttributes.Font.Size := ScaleY(DayHeadAttributes.Font.Size, DesignTimeDPI);
|
||||
HeadAttributes.Font.Size := ScaleY(HeadAttributes.Font.Size, DesignTimeDPI);
|
||||
end;
|
||||
with VpMonthView1 do begin
|
||||
DayHeadAttributes.Font.Size := ScaleY(DayHeadAttributes.Font.Size, DesignTimeDPI);
|
||||
DayNumberFont.Size := ScaleY(DayNumberFont.Size, DesignTimeDPI);
|
||||
EventFont.Size := ScaleY(EventFont.Size, DesignTimeDPI);
|
||||
Font.Size := ScaleY(Font.Size, DesignTimeDPI);
|
||||
HeadAttributes.Font.Size := ScaleY(HeadAttributes.Font.Size, DesignTimeDPI);
|
||||
TodayAttributes.Font.Size := ScaleY(TodayAttributes.Font.Size, DesignTimeDPI);
|
||||
end;
|
||||
with VpTaskList1 do begin
|
||||
Font.Size := ScaleY(Font.Size, DesignTimeDPI);
|
||||
TaskHeadAttributes.Font.Size := ScaleY(TaskHeadAttributes.Font.Size, DesignTimeDPI);
|
||||
end;
|
||||
with VpContactGrid1 do begin
|
||||
Font.Size := ScaleY(Font.Size, DesignTimeDPI);
|
||||
end;
|
||||
|
||||
ds := VpControlLink1.Datastore;
|
||||
if ds.Resources.Count > 0 then
|
||||
begin
|
||||
@ -573,7 +546,6 @@ end;
|
||||
procedure TMainForm.PositionControls;
|
||||
var
|
||||
w: Integer;
|
||||
cnv: TControlCanvas;
|
||||
begin
|
||||
// DayView page
|
||||
DaySelectorPanel.Height := 2*CbGranularity.Top + CbGranularity.Height;
|
||||
@ -636,7 +608,6 @@ procedure TMainForm.ReadIni;
|
||||
var
|
||||
ini: TCustomIniFile;
|
||||
lang: String;
|
||||
idx: Integer;
|
||||
L,T, W,H: Integer;
|
||||
R: TRect;
|
||||
begin
|
||||
@ -752,17 +723,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.SetLanguage(ALang: String);
|
||||
|
||||
function GetTimeFormat: TVpTimeFormat;
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
s := lowercase(FormatDateTime('hh:nn ampm', 0.25));
|
||||
if pos(lowercase(FormatSettings.TimeAMString), s) = Length(s) - Length(FormatSettings.TimeAMString) then
|
||||
Result := tf12Hour else
|
||||
Result := tf24Hour;
|
||||
end;
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
langdir: String;
|
||||
@ -802,13 +762,14 @@ begin
|
||||
SetDefaultLang(FLang, langdir);
|
||||
TranslateUnitResourceStrings('vpsr', langdir + 'vpsr.' + FLang + '.po');
|
||||
end;
|
||||
|
||||
{
|
||||
VpDayView1.LoadLanguage;
|
||||
VpWeekView1.LoadLanguage;
|
||||
VpMonthView1.LoadLanguage;
|
||||
VpTaskList1.LoadLanguage;
|
||||
VpContactGrid1.LoadLanguage;
|
||||
|
||||
//VpCalendar1.LoadLanguage;
|
||||
}
|
||||
// Select language in language combobox.
|
||||
if ALang = '' then ALang := 'en';
|
||||
found := false;
|
||||
@ -877,10 +838,11 @@ begin
|
||||
VpDayView1.TimeFormat := tfmt;
|
||||
VpWeekView1.TimeFormat := tfmt;
|
||||
VpMonthView1.TimeFormat := tfmt;
|
||||
{$ENDIF}
|
||||
firstWeekDay := GetFirstDayofWeek(ALang); // not correct at the moment
|
||||
VpMonthView1.WeekStartsOn := firstWeekDay;
|
||||
VpWeekView1.WeekStartsOn := firstWeekDay;
|
||||
{$ENDIF}
|
||||
//VpCalendar1.WeekStarts := firstWeekDay;
|
||||
|
||||
PositionControls;
|
||||
|
||||
|
@ -107,7 +107,6 @@ uses
|
||||
{$IFNDEF LCL}
|
||||
ShellAPI,
|
||||
{$ENDIF}
|
||||
Math,
|
||||
VpConst, VpMisc, VpSR;
|
||||
|
||||
const
|
||||
|
@ -168,6 +168,7 @@ type
|
||||
clRevertDate : TDateTime; {date on entry}
|
||||
clRowCount : Integer; {7 if no header, otherwise 8}
|
||||
clStartRow : Integer; {first row number}
|
||||
calMargin : Integer;
|
||||
|
||||
{property methods}
|
||||
function GetDay: Integer;
|
||||
@ -239,6 +240,8 @@ type
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
constructor CreateEx(AOwner: TComponent; AsPopup: Boolean); virtual;
|
||||
destructor Destroy; override;
|
||||
procedure LoadLanguage;
|
||||
|
||||
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||
|
||||
function GetControlType: TVpItemType; override;
|
||||
@ -268,6 +271,11 @@ type
|
||||
property Year : Integer read GetYear;
|
||||
|
||||
{properties}
|
||||
property Align;
|
||||
property Anchors;
|
||||
{$IFDEF LCL}
|
||||
property BorderSpacing;
|
||||
{$ENDIF}
|
||||
property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle;
|
||||
property Color;
|
||||
property Colors: TVpCalColors read FColors write FColors;
|
||||
@ -347,7 +355,7 @@ uses
|
||||
VpCalendarPainter;
|
||||
|
||||
const
|
||||
calMargin = 4; {left, right, and top margin}
|
||||
CAL_MARGIN = 4; {left, right, and top margin}
|
||||
|
||||
function SumOf(const A: array of Integer; First, Last: Integer): Integer;
|
||||
var
|
||||
@ -776,6 +784,8 @@ begin
|
||||
TabStop := True;
|
||||
Width := 200;
|
||||
|
||||
calMargin := ScaleX(CAL_MARGIN, DesignTimeDPI);
|
||||
|
||||
{$IFNDEF LCL}
|
||||
Font.Name := 'MS Sans Serif';
|
||||
Font.Size := 8;
|
||||
@ -1427,6 +1437,12 @@ begin
|
||||
Result := itCalendar;
|
||||
end;
|
||||
|
||||
procedure TVpCustomCalendar.LoadLanguage;
|
||||
begin
|
||||
FDefaultPopup.Items.Clear;
|
||||
InitializeDefaultPopup;
|
||||
end;
|
||||
|
||||
procedure TVpCustomCalendar.PaintToCanvas(ACanvas: TCanvas; ARect: TRect;
|
||||
Angle: TVpRotationAngle; ADate: TDateTime);
|
||||
begin
|
||||
|
@ -380,6 +380,7 @@ begin
|
||||
SetMeasurements;
|
||||
|
||||
RenderCanvas.Font.Assign(FCalendar.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
|
||||
with TVpCalendarOpener(FCalendar) do
|
||||
if (RealRight - RealLeft <> FLastRenderX) or
|
||||
|
@ -267,6 +267,7 @@ begin
|
||||
end;
|
||||
TmpBmpRect := Rect(0, 0, TmpBmp.Width, TmpBmp.Height);
|
||||
TmpBmp.Canvas.Font.Assign(FContactGrid.Font);
|
||||
TmpBmp.Canvas.Font.Size := ScaleY(TmpBmp.Canvas.Font.Size, DesignTimeDPI);
|
||||
|
||||
{ Calculate Phone Lbl Width }
|
||||
PhoneLblWidth := TmpBmp.Canvas.TextWidth(RSEmail);
|
||||
@ -317,6 +318,7 @@ begin
|
||||
TmpBmp.Canvas.Pen.Color := BevelDarkShadow;
|
||||
TmpBmp.Canvas.Brush.Style := bsSolid;
|
||||
TmpBmp.Canvas.Font.Assign(FContactGrid.ContactHeadAttributes.Font);
|
||||
TmpBmp.Canvas.Font.Size := ScaleY(TmpBmp.Canvas.Font.Size, DesignTimeDPI);
|
||||
case Angle of
|
||||
ra0:
|
||||
begin
|
||||
@ -414,6 +416,7 @@ begin
|
||||
|
||||
{ restore font and colors }
|
||||
TmpBmp.Canvas.Font.Assign(FContactGrid.Font);
|
||||
TmpBmp.Canvas.Font.Size := ScaleY(TmpBmp.Canvas.Font.Size, DesignTimeDPI);
|
||||
TmpBmp.Canvas.Brush.Color := RealColor;
|
||||
TmpBmp.Canvas.Pen.Color := BevelDarkShadow;
|
||||
TmpBmp.Canvas.Pen.Style := psSolid;
|
||||
|
@ -1246,6 +1246,7 @@ var
|
||||
TextHeight: Integer;
|
||||
begin
|
||||
Canvas.Font.Assign(FHeadAttr.Font);
|
||||
Canvas.Font.Size := ScaleY(Canvas.Font.Size, DesignTimeDPI);
|
||||
|
||||
if FShowResourceName and (DataStore <> nil) and (DataStore.Resource <> nil) then
|
||||
TextHeight := Canvas.TextHeight(TallShortChars) * 2 + TextMargin * 3
|
||||
@ -1359,6 +1360,7 @@ begin
|
||||
{ font, the standard client font, and a sample character string. }
|
||||
SaveFont := Canvas.Font;
|
||||
Canvas.Font.Assign(FRowHeadAttr.FMinuteFont);
|
||||
Canvas.Font.Size := ScaleY(Canvas.Font.Size, DesignTimeDPI);
|
||||
Canvas.Font.Height := GetRealFontHeight(Canvas.Font);
|
||||
Result := Canvas.TextHeight(TallShortChars);
|
||||
Canvas.Font.Assign(SaveFont);
|
||||
|
@ -353,6 +353,7 @@ begin
|
||||
if NumADEvents > 0 then begin
|
||||
// Measure the AllDayEvent text height
|
||||
RenderCanvas.Font.Assign(FDayView.AllDayEventAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
ADTextHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin;
|
||||
|
||||
// Distance between text and border
|
||||
@ -493,6 +494,7 @@ begin
|
||||
SavedFont.Assign(RenderCanvas.Font);
|
||||
try
|
||||
RenderCanvas.Font.Assign(FDayView.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
RenderCanvas.Brush.Color := RealColor;
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn, R);
|
||||
|
||||
@ -515,7 +517,7 @@ begin
|
||||
Break;
|
||||
|
||||
RenderCanvas.Brush.Color := RealColor;
|
||||
RenderCanvas.Font.Assign(SavedFont);
|
||||
RenderCanvas.Font.Assign(SavedFont); // no further scaling needed here
|
||||
LineRect.Top := Round(R.Top + i * RealRowHeight);
|
||||
LineRect.Bottom := Round(LineRect.Top + RealRowHeight);
|
||||
|
||||
@ -670,6 +672,7 @@ begin
|
||||
|
||||
{ Draw Column Header }
|
||||
RenderCanvas.Font.Assign(FDayView.HeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
RenderCanvas.Brush.Color := RealHeadAttrColor;
|
||||
RenderCanvas.Pen.Style := psClear;
|
||||
tmpRect := R;
|
||||
@ -1289,6 +1292,7 @@ begin
|
||||
|
||||
{ Calculate the column rect for this day }
|
||||
RenderCanvas.Font.Assign(FDayView.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
CellsRect := Rect(RPos, ADEventsRect.Bottom + 1, RPos + DayWidth, RealBottom - 2);
|
||||
if (i = RealNumDays - 1) and (ExtraSpace > 0) then
|
||||
CellsRect.Right := CellsRect.Right + ExtraSpace;
|
||||
@ -1417,6 +1421,7 @@ begin
|
||||
begin
|
||||
// In case of 60-min granularity paint time as simple string
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.MinuteFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
timeStr := Format('%s:%s', [hourStr, minuteStr]);
|
||||
x := lineRect.Right - RenderCanvas.TextWidth(timeStr) - MINUTES_BORDER;
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, x, y + TextMargin, timeStr);
|
||||
@ -1425,11 +1430,13 @@ begin
|
||||
// In all other cases, paint large hour and small minutes (or am/pm)
|
||||
// Draw minutes
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.MinuteFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
x := lineRect.Right - RenderCanvas.TextWidth(MinuteStr) - MINUTES_BORDER;
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, x, y + TextMargin, minuteStr);
|
||||
|
||||
// Draw hours
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.HourFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
dec(x, RenderCanvas.TextWidth(HourStr) + MINUTES_HOUR_DISTANCE);
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, x, y + TextMargin{ - 2}, hourStr);
|
||||
end;
|
||||
@ -1461,6 +1468,7 @@ begin
|
||||
|
||||
// Calculate length of minutes ticks
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.MinuteFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
minutesLen := RenderCanvas.TextWidth('00') + MINUTES_BORDER + MINUTES_HOUR_DISTANCE div 2;
|
||||
|
||||
// Prepare pen
|
||||
@ -1529,8 +1537,10 @@ function TVpDayViewPainter.CalcRowHeadWidth: integer;
|
||||
begin
|
||||
Result := 2 * MINUTES_BORDER + MINUTES_HOUR_DISTANCE;
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.MinuteFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
inc(Result, RenderCanvas.TextWidth('00'));
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.HourFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
inc(Result, RenderCanvas.TextWidth('33'));
|
||||
end;
|
||||
|
||||
|
@ -62,7 +62,7 @@ implementation
|
||||
|
||||
uses
|
||||
LazFileUtils,
|
||||
VpConst, VpException, VpMisc, VpData;
|
||||
VpConst, VpMisc;
|
||||
|
||||
{ TVpIBDatastore }
|
||||
|
||||
|
@ -122,6 +122,7 @@ function SameDate(dt1, dt2: TDateTime): Boolean;
|
||||
function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean;
|
||||
function TimeInRange(ATime, StartTime, EndTime: TDateTime; IncludeLimits: Boolean): Boolean;
|
||||
|
||||
function GetTimeFormat: TVpTimeFormat;
|
||||
function GranularityToStr(Gran: TVpGranularity): string;
|
||||
function HourToAMPM(Hour: TVpHours): string;
|
||||
function HourToStr(Hour: TVpHours; Mil: Boolean): string;
|
||||
@ -487,6 +488,16 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function GetTimeFormat: TVpTimeFormat;
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
s := lowercase(FormatDateTime('hh:nn ampm', 0.25));
|
||||
if pos(lowercase(FormatSettings.TimeAMString), s) = Length(s) - Length(FormatSettings.TimeAMString) then
|
||||
Result := tf12Hour else
|
||||
Result := tf24Hour;
|
||||
end;
|
||||
|
||||
function GranularityToStr(Gran: TVpGranularity): string;
|
||||
begin
|
||||
Result := IntToStr(GranularityMinutes[Gran]);
|
||||
|
@ -448,10 +448,8 @@ begin
|
||||
{ Assign default font to DayNumberFont and EventFont }
|
||||
FDayNumberFont := TVpFont.Create(AOwner);
|
||||
FDayNumberFont.Assign(Font);
|
||||
// FDayNumberFont.OnChange := mvFontChanged;
|
||||
FEventFont := TVpFont.Create(AOwner);
|
||||
FEventFont.Assign(Font);
|
||||
// FEventFont.OnChange := mvFontChanged;
|
||||
FOffDayFontColor := clGray;
|
||||
|
||||
SetLength(mvEventArray, MaxVisibleEvents);
|
||||
|
@ -120,6 +120,7 @@ var
|
||||
begin
|
||||
{ clear day head area }
|
||||
RenderCanvas.Font.Assign(FMonthView.DayHeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
RenderCanvas.Brush.Color := DayHeadAttrColor;
|
||||
|
||||
{ build rect }
|
||||
@ -364,7 +365,8 @@ begin
|
||||
RenderCanvas.Font.Assign(FMonthView.TodayAttributes.Font)
|
||||
else
|
||||
RenderCanvas.Font.Assign(FMonthView.DayNumberFont);
|
||||
fontstyle := Rendercanvas.Font.style;
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
fontstyle := RenderCanvas.Font.style;
|
||||
|
||||
if (DisplayDate = ThisDate) then begin
|
||||
if FMonthView.Focused then begin
|
||||
@ -474,7 +476,8 @@ begin
|
||||
RenderCanvas.Font.Assign(FMonthView.TodayAttributes.Font)
|
||||
else
|
||||
RenderCanvas.Font.Assign(FMonthView.DayNumberFont);
|
||||
fontstyle := Rendercanvas.Font.style;
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
fontstyle := Rendercanvas.Font.Style;
|
||||
|
||||
if (DisplayDate = ThisDate) then begin
|
||||
if FMonthView.Focused then
|
||||
@ -657,6 +660,7 @@ begin
|
||||
|
||||
{ set the event font }
|
||||
RenderCanvas.Font.Assign(FMonthView.EventFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
if TVpMonthViewOpener(FMonthView).mvMonthDayArray[I].OffDay then
|
||||
RenderCanvas.Font.Color := FMonthView.OffDayFontColor;
|
||||
|
||||
@ -764,6 +768,7 @@ begin
|
||||
|
||||
{ Calculate the text rectangle }
|
||||
RenderCanvas.Font.Assign(FMonthView.HeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RealWidth) then
|
||||
HeadTextRect.Left:= RealLeft + TextMargin * 2
|
||||
else
|
||||
@ -788,6 +793,7 @@ begin
|
||||
|
||||
// Draw the text
|
||||
RenderCanvas.Font.Assign(FMonthView.HeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
TPSTextOut(
|
||||
RenderCanvas,
|
||||
Angle,
|
||||
@ -897,16 +903,20 @@ begin
|
||||
{ we use the VpProductName because is is a good representation of some }
|
||||
{ generic text }
|
||||
RenderCanvas.Font.Assign(FMonthView.DayHeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
with TVpMonthViewOpener(FMonthView) do
|
||||
mvDayHeadHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin + 2;
|
||||
|
||||
RenderCanvas.Font.Assign(FMonthView.DayNumberFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
mvDayNumberHeight := RenderCanvas.TextHeight('00');
|
||||
|
||||
RenderCanvas.Font.Assign(FMonthView.EventFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
mvEventTextHeight := RenderCanvas.TextHeight(VpProductName);
|
||||
|
||||
RenderCanvas.Font.Assign(FMonthView.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
mvLineHeight := RenderCanvas.TextHeight(VpProductName) + 2;
|
||||
mvColWidth := (RealWidth - 4) div 7;
|
||||
end;
|
||||
|
@ -1,7 +1,7 @@
|
||||
object TaskEditForm: TTaskEditForm
|
||||
Left = 243
|
||||
Left = 284
|
||||
Height = 378
|
||||
Top = 283
|
||||
Top = 286
|
||||
Width = 547
|
||||
HorzScrollBar.Page = 545
|
||||
VertScrollBar.Page = 339
|
||||
|
@ -252,6 +252,7 @@ var
|
||||
begin
|
||||
RenderCanvas.Brush.Color := TaskHeadAttrColor;
|
||||
RenderCanvas.Font.Assign(FTaskList.TaskHeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
|
||||
if FTaskList.DrawingStyle = dsFlat then delta := 1 else delta := 2;
|
||||
HeadRect.Left := RealLeft + delta;
|
||||
@ -321,6 +322,7 @@ begin
|
||||
else
|
||||
HeadStr := RSTaskTitleNoResource;
|
||||
RenderCanvas.Font.Assign(TaskHeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
TPSTextOut(
|
||||
RenderCanvas,
|
||||
Angle,
|
||||
@ -396,6 +398,7 @@ begin
|
||||
end;
|
||||
|
||||
RenderCanvas.Font.Assign(Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
for I := StartLine to pred(tlAllTaskList.Count) do begin
|
||||
Task := tlAllTaskList[I];
|
||||
if (LineRect.Top + Trunc(RowHeight * 0.5) <= RealBottom) then begin
|
||||
@ -528,6 +531,7 @@ end;
|
||||
procedure TVpTaskListPainter.MeasureRowHeight;
|
||||
begin
|
||||
RenderCanvas.Font.Assign(FTaskList.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
RowHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin * 2;
|
||||
end;
|
||||
|
||||
|
@ -143,6 +143,7 @@ begin
|
||||
{ Measure the AllDayEvent TextHeight }
|
||||
txtDist := TextMargin div 2;
|
||||
RenderCanvas.Font.Assign(FWeekView.AllDayEventAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
ADTextHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin + txtDist;
|
||||
|
||||
{ Build the AllDayEvent rect based on the value of NumADEvents }
|
||||
@ -295,6 +296,7 @@ begin
|
||||
tmpRect := TextRect;
|
||||
inc(tmpRect.Right);
|
||||
RenderCanvas.Font.Assign(FWeekView.DayHeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
RenderCanvas.Brush.Color := RealDayHeadAttrColor;
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn, tmpRect);
|
||||
if FWeekView.DayHeadAttributes.Bordered and (FWeekView.DrawingStyle <> dsNoBorder) then
|
||||
@ -505,6 +507,7 @@ begin
|
||||
|
||||
{ set the event font }
|
||||
RenderCanvas.Font.Assign(FWeekView.EventFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
RenderCanvas.Brush.Color := RealColor;
|
||||
|
||||
{ Build the event text }
|
||||
@ -540,6 +543,7 @@ var
|
||||
begin
|
||||
RenderCanvas.Brush.Color := RealHeadAttrColor;
|
||||
RenderCanvas.Font.Assign(TFont(FWeekView.HeadAttributes.Font));
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
|
||||
{ draw the header cell and borders }
|
||||
if FWeekView.DrawingStyle = ds3d then begin
|
||||
@ -697,11 +701,16 @@ begin
|
||||
StartDate := GetStartOfWeek(RenderDate, WeekStartsOn);
|
||||
|
||||
RenderCanvas.Font.Assign(FWeekView.DayHeadAttributes.Font);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
FDayHeadHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin + 2 ;
|
||||
|
||||
RenderCanvas.Font.Assign(FWeekView.EventFont);
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
with TVpWeekViewOpener(FWeekView) do
|
||||
wvRowHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin div 2;
|
||||
|
||||
RenderCanvas.Font.Assign(TFont(FWeekView.HeadAttributes.Font));
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
with TVpWeekViewOpener(FWeekView) do
|
||||
wvHeaderHeight := RenderCanvas.TextHeight(VpProductName) + TextMargin * 2;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user