You've already forked lazarus-ccr
tvplanit: Use DateUtils functions IncYear etc instead of those implemented in TvPlanIt
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4828 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -96,40 +96,28 @@ procedure DrawBevelRect(const Canvas: TCanvas; R: TRect;
|
|||||||
function PointInRect(Point: TPoint; Rect: TRect): Boolean;
|
function PointInRect(Point: TPoint; Rect: TRect): Boolean;
|
||||||
{-determines if the specified point resides inside the specified TRect }
|
{-determines if the specified point resides inside the specified TRect }
|
||||||
|
|
||||||
function GetAlarmAdvanceTime(Advance: Integer;
|
function GetAlarmAdvanceTime(Advance: Integer; AdvanceType: TVpAlarmAdvType): TDateTime;
|
||||||
AdvanceType: TVpAlarmAdvType): TDateTime;
|
|
||||||
|
|
||||||
{$IFNDEF Delphi6}
|
{$IFDEF DELPHI}{$IFNDEF Delphi6}
|
||||||
|
function MonthOfTheYear(TheDate: TDateTime): Word;
|
||||||
function MonthOfTheYear (TheDate : TDateTime) : Word;
|
procedure IncAMonth(var Year, Month, Day: Word; NumMonths: Integer);
|
||||||
|
function IncMonth(const TheDate: TDateTime; NumberOfMonths: Integer): TDateTime;
|
||||||
procedure IncAMonth (var Year, Month, Day : Word; NumMonths : Integer);
|
function IncYear(TheDate: TDateTime; NumYears: Integer): TDateTime;
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
function IncMonth(const TheDate : TDateTime;
|
|
||||||
NumberOfMonths : Integer) : TDateTime;
|
|
||||||
|
|
||||||
function IncYear (TheDate : TDateTime; NumYears : Integer) : TDateTime;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
function GetJulianDate(Date: TDateTime): Word;
|
function GetJulianDate(Date: TDateTime): Word;
|
||||||
|
function GetWeekOfYear(ADate: TDateTime): byte;
|
||||||
function HourToLine(const Value: TVpHours; const Granularity: TVpGranularity): Integer;
|
function SameDate(dt1, dt2: TDateTime): Boolean;
|
||||||
|
|
||||||
function GetStartLine(StartTime: TDateTime; Granularity: TVpGranularity): Integer;
|
|
||||||
|
|
||||||
function GetEndLine (EndTime: TDateTime; Granularity: TVpGranularity): Integer;
|
|
||||||
|
|
||||||
function TimeInRange(Time, StartTime, EndTime: TDateTime; Inclusive: Boolean): Boolean;
|
function TimeInRange(Time, StartTime, EndTime: TDateTime; Inclusive: Boolean): Boolean;
|
||||||
|
|
||||||
|
function HourToLine(const Value: TVpHours; const Granularity: TVpGranularity): Integer;
|
||||||
|
function GetStartLine(StartTime: TDateTime; Granularity: TVpGranularity): Integer;
|
||||||
|
function GetEndLine (EndTime: TDateTime; Granularity: TVpGranularity): Integer;
|
||||||
function LineToStartTime(Line: Integer; Granularity: TVpGranularity): TDateTime;
|
function LineToStartTime(Line: Integer; Granularity: TVpGranularity): TDateTime;
|
||||||
|
|
||||||
function GetLineDuration(Granularity: TVpGranularity): Double;
|
function GetLineDuration(Granularity: TVpGranularity): Double;
|
||||||
|
|
||||||
function GetLabelWidth(ALabel: TLabel): Integer;
|
function GetLabelWidth(ALabel: TLabel): Integer;
|
||||||
|
|
||||||
function SameDate(dt1, dt2: TDateTime): Boolean;
|
|
||||||
function GetWeekOfYear(ADate: TDateTime): byte;
|
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -374,10 +362,7 @@ end;
|
|||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
|
||||||
|
{$IFDEF DELPHI} {$IFNDEF Delphi6}
|
||||||
{$IFNDEF Delphi6}
|
|
||||||
{=====}
|
|
||||||
|
|
||||||
function MonthOfTheYear (TheDate : TDateTime) : Word;
|
function MonthOfTheYear (TheDate : TDateTime) : Word;
|
||||||
var
|
var
|
||||||
Year, Day: Word;
|
Year, Day: Word;
|
||||||
@ -390,7 +375,6 @@ procedure IncAMonth (var Year, Month, Day : Word; NumMonths : Integer);
|
|||||||
type
|
type
|
||||||
PMonthDayTable = ^TMonthDayTable;
|
PMonthDayTable = ^TMonthDayTable;
|
||||||
TMonthDayTable = array[1..12] of Word;
|
TMonthDayTable = array[1..12] of Word;
|
||||||
|
|
||||||
const
|
const
|
||||||
MonthDays: array [Boolean] of TMonthDayTable =
|
MonthDays: array [Boolean] of TMonthDayTable =
|
||||||
((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
|
((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
|
||||||
@ -398,7 +382,6 @@ const
|
|||||||
var
|
var
|
||||||
DayTable: PDayTable;
|
DayTable: PDayTable;
|
||||||
Sign: Integer;
|
Sign: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if NumMonths >= 0 then
|
if NumMonths >= 0 then
|
||||||
Sign := 1
|
Sign := 1
|
||||||
@ -433,7 +416,7 @@ begin
|
|||||||
Result := IncMonth (TheDate, NumYears * 12);
|
Result := IncMonth (TheDate, NumYears * 12);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
|
|
||||||
function GetJulianDate(Date: TDateTime): Word;
|
function GetJulianDate(Date: TDateTime): Word;
|
||||||
var
|
var
|
||||||
|
@ -444,15 +444,11 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
VpBaseDS,
|
{$IFDEF LCL}
|
||||||
VpPrtFmtCBox,
|
DateUtils,
|
||||||
VpPrtPrv,
|
{$ENDIF}
|
||||||
VpDayView,
|
VpBaseDS, VpPrtFmtCBox, VpPrtPrv, VpDayView, VpWeekView, VpMonthView,
|
||||||
VpWeekView,
|
VpCalendar, VpTaskList, VpContactGrid;
|
||||||
VpMonthView,
|
|
||||||
VpCalendar,
|
|
||||||
VpTaskList,
|
|
||||||
VpContactGrid;
|
|
||||||
|
|
||||||
function XMLizeString(const s: string): string;
|
function XMLizeString(const s: string): string;
|
||||||
var
|
var
|
||||||
|
@ -517,6 +517,7 @@ var
|
|||||||
HeadTextRect: TRect;
|
HeadTextRect: TRect;
|
||||||
HeadStr: string;
|
HeadStr: string;
|
||||||
HeadStrLen : Integer;
|
HeadStrLen : Integer;
|
||||||
|
weekNo: Integer;
|
||||||
begin
|
begin
|
||||||
RenderCanvas.Brush.Color := RealHeadAttrColor;
|
RenderCanvas.Brush.Color := RealHeadAttrColor;
|
||||||
RenderCanvas.Font.Assign(TFont(FWeekView.HeadAttributes.Font));
|
RenderCanvas.Font.Assign(TFont(FWeekView.HeadAttributes.Font));
|
||||||
@ -557,12 +558,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ build header caption }
|
{ build header caption }
|
||||||
|
weekNo := GetWeekOfYear(StartDate);
|
||||||
HeadStr := HeadStr + Format('%s %s (%s %d)', [
|
HeadStr := HeadStr + Format('%s %s (%s %d)', [
|
||||||
RSWeekOf, FormatDateTime(FWeekView.DateLabelFormat, StartDate), RSCalendarWeekAbbr, GetWeekOfYear(StartDate)
|
RSWeekOf, FormatDateTime(FWeekView.DateLabelFormat, StartDate), RSCalendarWeekAbbr, weekNo
|
||||||
]);
|
]);
|
||||||
// HeadStr := HeadStr + RSWeekof + ' ' + FormatDateTime(DateLabelFormat, StartDate)+' (KW'+IntToStr(GetWeekOfYear(StartDate))+')';
|
|
||||||
{ draw the text }
|
{ draw the text }
|
||||||
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RenderIn.Right - RenderIn.Left)
|
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= WidthOf(RenderIn))
|
||||||
then
|
then
|
||||||
HeadTextRect.TopLeft:= Point(RealLeft + TextMargin * 2, HeadRect.Top)
|
HeadTextRect.TopLeft:= Point(RealLeft + TextMargin * 2, HeadRect.Top)
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user