tvplanit: Cosmetic changes in DayView

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4779 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-19 23:40:28 +00:00
parent e9199cdad2
commit 5d527e1d69
4 changed files with 711 additions and 799 deletions

View File

@ -401,6 +401,10 @@ msgstr "Standard-Klang verwenden"
msgid "Delete" msgid "Delete"
msgstr "Löschen" msgstr "Löschen"
#: vpsr.rsdeletecontactfromschedule
msgid "Delete contact %s from your schedule?"
msgstr ""
#: vpsr.rsdescriptionlbl #: vpsr.rsdescriptionlbl
msgctxt "vpsr.rsdescriptionlbl" msgctxt "vpsr.rsdescriptionlbl"
msgid "Subject:" msgid "Subject:"
@ -1368,3 +1372,4 @@ msgstr "Unbekannte Achsen-Spezifikation: %s"
#: vpsr.sxmldecnotatbeg #: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element" msgid "The XML declaration must appear before the first element"
msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen." msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen."

View File

@ -391,6 +391,10 @@ msgstr ""
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: vpsr.rsdeletecontactfromschedule
msgid "Delete contact %s from your schedule?"
msgstr ""
#: vpsr.rsdescriptionlbl #: vpsr.rsdescriptionlbl
msgctxt "vpsr.rsdescriptionlbl" msgctxt "vpsr.rsdescriptionlbl"
msgid "Subject:" msgid "Subject:"

View File

@ -98,23 +98,18 @@ type
Show: Boolean; Show: Boolean;
Bitmap: TBitmap; Bitmap: TBitmap;
end; end;
TVpDVIconTypes = (itAlarm, itRecurring, itCategory, itCustom); TVpDVIconTypes = (itAlarm, itRecurring, itCategory, itCustom);
TVpDVIcons = array [itAlarm..itCustom] of TVpDVIconData; TVpDVIcons = array [itAlarm..itCustom] of TVpDVIconData;
TVpOnDVBeforeDrawEvent = procedure (Sender : TObject; TVpOnDVBeforeDrawEvent = procedure (Sender: TObject; Event: TVpEvent;
Event : TVpEvent; Active: Boolean; ACanvas: TCanvas; EventRect: TRect; IconRect: TRect) of object;
Active : Boolean;
ACanvas : TCanvas; TVpOnDVAfterDrawEvent = procedure (Sender: TObject; Event: TVpEvent;
EventRect : TRect; Active: Boolean; ACanvas: TCanvas; EventRect: TRect; IconRect: TRect) of object;
IconRect : TRect) of object;
TVpOnDVAfterDrawEvent = procedure (Sender : TObject; TVpOnDVDrawIcons = procedure (Sender: TObject; Event: TVpEvent;
Event : TVpEvent;
Active : Boolean;
ACanvas : TCanvas;
EventRect : TRect;
IconRect : TRect) of object;
TVpOnDVDrawIcons = procedure (Sender : TObject;
Event : TVpEvent;
var Icons: TVpDVIcons) of object; var Icons: TVpDVIcons) of object;
TVpDVWrapStyle = (wsNone, wsIconFlow, wsNoFlow); TVpDVWrapStyle = (wsNone, wsIconFlow, wsNoFlow);
@ -221,14 +216,11 @@ type
property RecurringBitmap: TBitmap property RecurringBitmap: TBitmap
read FRecurringBitmap write SetRecurringBitmap; read FRecurringBitmap write SetRecurringBitmap;
property ShowAlarmBitmap: Boolean property ShowAlarmBitmap: Boolean
read FShowAlarmBitmap write SetShowAlarmBitmap read FShowAlarmBitmap write SetShowAlarmBitmap default True;
default True;
property ShowCategoryBitmap : Boolean property ShowCategoryBitmap : Boolean
read FShowCategoryBitmap write SetShowCategoryBitmap read FShowCategoryBitmap write SetShowCategoryBitmap default True;
default True;
property ShowRecurringBitmap : Boolean property ShowRecurringBitmap : Boolean
read FShowRecurringBitmap write SetShowRecurringBitmap read FShowRecurringBitmap write SetShowRecurringBitmap default True;
default True;
end; end;
{ TVpDayView } { TVpDayView }
@ -344,12 +336,8 @@ type
{$ENDIF} {$ENDIF}
{ internal methods } { internal methods }
function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer; function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer;
function dvCalcVisibleLines (RenderHeight : Integer; function dvCalcVisibleLines(RenderHeight, ColHeadHeight, RowHeight: Integer;
ColHeadHeight : Integer; Scale: Extended; StartLine, StopLine: Integer): Integer;
RowHeight : Integer;
Scale : Extended;
StartLine : Integer;
StopLine : Integer) : Integer;
function dvCalcColHeadHeight(Scale: Extended): Integer; function dvCalcColHeadHeight(Scale: Extended): Integer;
procedure dvEditInPlace(Sender: TObject); procedure dvEditInPlace(Sender: TObject);
procedure dvHookUp; procedure dvHookUp;
@ -423,29 +411,14 @@ type
procedure EditSelectedEvent; procedure EditSelectedEvent;
function GetControlType: TVpItemType; override; function GetControlType: TVpItemType; override;
procedure AutoScaledPaintToCanvas (PaintCanvas : TCanvas; procedure AutoScaledPaintToCanvas(PaintCanvas: TCanvas; PaintTo: TRect;
PaintTo : TRect; Angle: TVpRotationAngle; RenderDate: TDateTime; StartLine, StopLine: Integer;
Angle : TVpRotationAngle;
RenderDate : TDateTime;
StartLine : Integer;
StopLine : Integer;
UseGran: TVpGranularity); UseGran: TVpGranularity);
procedure PaintToCanvas (ACanvas : TCanvas; procedure PaintToCanvas (ACanvas: TCanvas; ARect: TRect; Angle: TVpRotationAngle;
ARect : TRect; ADate: TDateTime; StartHour, EndHour: TVpHours; UseGran: TVpGranularity);
Angle : TVpRotationAngle; procedure RenderToCanvas (RenderCanvas: TCanvas; RenderIn: TRect;
ADate : TDateTime; Angle: TVpRotationAngle; Scale: Extended; RenderDate: TDateTime;
StartHour : TVpHours; StartLine, StopLine: Integer; UseGran: TVpGranularity; DisplayOnly: Boolean); override;
EndHour : TVpHours;
UseGran : TVpGranularity);
procedure RenderToCanvas (RenderCanvas : TCanvas;
RenderIn : TRect;
Angle : TVpRotationAngle;
Scale : Extended;
RenderDate : TDateTime;
StartLine : Integer;
StopLine : Integer;
UseGran : TVpGranularity;
DisplayOnly : Boolean); override;
property ActiveEvent: TVpEvent read FActiveEvent write FActiveEvent; property ActiveEvent: TVpEvent read FActiveEvent write FActiveEvent;
property TopHour: TVpHours read FTopHour write SetTopHour; property TopHour: TVpHours read FTopHour write SetTopHour;
property TopLine: Integer read FTopLine write SetTopLine; property TopLine: Integer read FTopLine write SetTopLine;
@ -463,62 +436,37 @@ type
property TabStop; property TabStop;
property TabOrder; property TabOrder;
property Font; property Font;
property AllDayEventAttributes: TVpAllDayEventAttributes property AllDayEventAttributes: TVpAllDayEventAttributes read FAllDayEventAttr write FAllDayEventAttr;
read FAllDayEventAttr write FAllDayEventAttr; property DotDotDotColor: TColor read FDotDotDotColor write SetDotDotDotColor default clBlack;
property ShowEventTimes: Boolean read FShowEventTimes write SetShowEventTimes default true;
property DotDotDotColor : TColor property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle stored True;
read FDotDotDotColor write SetDotDotDotColor default clBlack; property TimeSlotColors: TVpTimeSlotColor read FTimeSlotColors write FTimeSlotColors;
property HeadAttributes: TVpCHAttributes read FHeadAttr write FHeadAttr;
property ShowEventTimes: Boolean property RowHeadAttributes: TVpRHAttributes read FRowHeadAttr write FRowHeadAttr;
read FShowEventTimes write SetShowEventTimes default true; property IconAttributes: TVpDayViewIconAttributes read FIconAttributes write FIconAttributes;
property DrawingStyle: TVpDrawingStyle
read FDrawingStyle write SetDrawingStyle stored True;
property TimeSlotColors: TVpTimeSlotColor
read FTimeSlotColors write FTimeSlotColors;
property HeadAttributes: TVpCHAttributes
read FHeadAttr write FHeadAttr;
property RowHeadAttributes: TVpRHAttributes
read FRowHeadAttr write FRowHeadAttr;
property IconAttributes : TVpDayViewIconAttributes
read FIconAttributes write FIconAttributes;
property Color: TColor read FColor write SetColor; property Color: TColor read FColor write SetColor;
property OwnerDrawRowHeader: TVpOwnerDrawRowEvent property OwnerDrawRowHeader: TVpOwnerDrawRowEvent read FOwnerDrawRowHead write FOwnerDrawRowHead;
read FOwnerDrawRowHead write FOwnerDrawRowHead; property OwnerDrawColHeader: TVpOwnerDrawEvent read FOwnerDrawColHead write FOwnerDrawColHead;
property OwnerDrawColHeader: TVpOwnerDrawEvent property OwnerDrawCells: TVpOwnerDrawRowEvent read FOwnerDrawCells write FOwnerDrawCells;
read FOwnerDrawColHead write FOwnerDrawColHead; property ShowResourceName: Boolean read FShowResourceName write SetShowResourceName;
property OwnerDrawCells: TVpOwnerDrawRowEvent
read FOwnerDrawCells write FOwnerDrawCells;
property ShowResourceName: Boolean
read FShowResourceName write SetShowResourceName;
property LineColor: TColor read FLineColor write SetLineColor; property LineColor: TColor read FLineColor write SetLineColor;
property GutterWidth: Integer read FGutterWidth write SetGutterWidth; property GutterWidth: Integer read FGutterWidth write SetGutterWidth;
property DateLabelFormat: property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat;
string read FDateLabelFormat write SetDateLabelFormat;
Property Granularity: TVpGranularity read FGranularity write SetGranularity; Property Granularity: TVpGranularity read FGranularity write SetGranularity;
property DefaultTopHour: TVpHours read FDefTopHour write SetDefTopHour; property DefaultTopHour: TVpHours read FDefTopHour write SetDefTopHour;
property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat; property TimeFormat: TVpTimeFormat read FTimeFormat write SetTimeFormat;
property IncludeWeekends: Boolean read FIncludeWeekends write SetIncludeWeekends default True;
property NumDays: Integer read FNumDays write SetNumDays default 1;
property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow;
{events} {events}
property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit; property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit;
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit; property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
property IncludeWeekends : Boolean property OnAddEvent: TVpOnAddNewEvent read FOnAddEvent write FOnAddEvent;
read FIncludeWeekends write SetIncludeWeekends default True; property OnAfterDrawEvent: TVpOnDVAfterDrawEvent read FOnAfterDrawEvent write FOnAfterDrawEvent;
property NumDays : Integer read FNumDays write SetNumDays default 1; property OnBeforeDrawEvent: TVpOnDVBeforeDrawEvent read FOnBeforeDrawEvent write FOnBeforeDrawEvent;
property WrapStyle : TVpDVWrapStyle property OnDrawIcons: TVpOnDVDrawIcons read FOnDrawIcons Write FOnDrawIcons;
read FWrapStyle Write SetWrapStyle default wsIconFlow; property OnOwnerEditEvent: TVpEditEvent read FOwnerEditEvent write FOwnerEditEvent;
property OnAddEvent: TVpOnAddNewEvent
read FOnAddEvent write FOnAddEvent;
property OnAfterDrawEvent : TVpOnDVAfterDrawEvent
read FOnAfterDrawEvent write FOnAfterDrawEvent;
property OnBeforeDrawEvent : TVpOnDVBeforeDrawEvent
read FOnBeforeDrawEvent write FOnBeforeDrawEvent;
property OnDrawIcons : TVpOnDVDrawIcons
read FOnDrawIcons Write FOnDrawIcons;
property OnClick; property OnClick;
property OnOwnerEditEvent: TVpEditEvent
read FOwnerEditEvent write FOwnerEditEvent;
end; end;
implementation implementation
@ -554,24 +502,28 @@ procedure TVpDvInPlaceEdit.KeyDown(var Key: Word; Shift: TShiftState);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
begin begin
case Key of case Key of
VK_RETURN: begin VK_RETURN:
begin
Key := 0; Key := 0;
TVpDayView(Owner).EndEdit(Self); TVpDayView(Owner).EndEdit(Self);
end; end;
VK_UP: begin VK_UP:
begin
Key := 0; Key := 0;
TVpDayView(Owner).ActiveRow := TVpDayView(Owner).ActiveRow - 1; TVpDayView(Owner).ActiveRow := TVpDayView(Owner).ActiveRow - 1;
// !!!! TVpDayView(Owner).EndEdit(Self); !!!! !!!!!!!!!!!!!!!!!!!!!!!!! // !!!! TVpDayView(Owner).EndEdit(Self); !!!! !!!!!!!!!!!!!!!!!!!!!!!!!
end; end;
VK_DOWN: begin VK_DOWN:
begin
Key := 0; Key := 0;
TVpDayView(Owner).ActiveRow := TVpDayView(Owner).ActiveRow + 1; TVpDayView(Owner).ActiveRow := TVpDayView(Owner).ActiveRow + 1;
// !!!! TVpDayView(Owner).EndEdit(Self); !!!! !!!!!!!!!!!!!!!!!!!!!!!!! // !!!! TVpDayView(Owner).EndEdit(Self); !!!! !!!!!!!!!!!!!!!!!!!!!!!!!
end; end;
VK_ESCAPE: begin VK_ESCAPE:
begin
Key := 0; Key := 0;
TVpDayView(Owner).SetFocus; TVpDayView(Owner).SetFocus;
end; end;
@ -642,16 +594,12 @@ end;
(*****************************************************************************) (*****************************************************************************)
{ TVpDayViewIconAttributes } { TVpDayViewIconAttributes }
constructor TVpDayViewIconAttributes.Create ( constructor TVpDayViewIconAttributes.Create(AOwner: TVpLinkableControl);
AOwner : TVpLinkableControl);
begin begin
inherited Create; inherited Create;
FOwner := AOwner; FOwner := AOwner;
FAlarmBitmap := TBitmap.Create; FAlarmBitmap := TBitmap.Create;
FRecurringBitmap := TBitmap.Create; FRecurringBitmap := TBitmap.Create;
FShowAlarmBitmap := True; FShowAlarmBitmap := True;
FShowCategoryBitmap := True; FShowCategoryBitmap := True;
FShowRecurringBitmap := True; FShowRecurringBitmap := True;
@ -661,7 +609,6 @@ destructor TVpDayViewIconAttributes.Destroy;
begin begin
FAlarmBitmap.Free; FAlarmBitmap.Free;
FRecurringBitmap.Free; FRecurringBitmap.Free;
inherited Destroy; inherited Destroy;
end; end;
@ -676,21 +623,19 @@ procedure TVpDayViewIconAttributes.SetRecurringBitmap (v : TBitmap);
begin begin
FRecurringBitmap.Assign(v); FRecurringBitmap.Assign(v);
if Assigned(FOwner) then if Assigned(FOwner) then
FOwner.Invalidate; FOwner.Invalidate
end; end;
procedure TVpDayViewIconAttributes.SetShowAlarmBitmap ( procedure TVpDayViewIconAttributes.SetShowAlarmBitmap(const v: Boolean);
const v : Boolean);
begin begin
if FShowAlarmBitmap <> v then begin if FShowAlarmBitmap <> v then begin
FShowAlarmBitmap := v; FShowAlarmBitmap := v;
if Assigned(FOwner) then if Assigned(FOwner) then
FOwner.Invalidate; FOwner.Invalidate
end; end;
end; end;
procedure TVpDayViewIconAttributes.SetShowCategoryBitmap ( procedure TVpDayViewIconAttributes.SetShowCategoryBitmap(const v: Boolean);
const v : Boolean);
begin begin
if FShowCategoryBitmap <> v then begin if FShowCategoryBitmap <> v then begin
FShowCategoryBitmap := v; FShowCategoryBitmap := v;
@ -699,13 +644,12 @@ begin
end; end;
end; end;
procedure TVpDayViewIconAttributes.SetShowRecurringBitmap ( procedure TVpDayViewIconAttributes.SetShowRecurringBitmap(const v: Boolean);
const v : Boolean);
begin begin
if FShowRecurringBitmap <> v then begin if FShowRecurringBitmap <> v then begin
FShowRecurringBitmap := v; FShowRecurringBitmap := v;
if Assigned(FOwner) then if Assigned(FOwner) then
FOwner.Invalidate; FOwner.Invalidate
end; end;
end; end;
@ -836,7 +780,6 @@ end;
{=====} {=====}
destructor TVpDayView.Destroy; destructor TVpDayView.Destroy;
begin begin
FreeAndNil(dvInplaceEditor); FreeAndNil(dvInplaceEditor);
@ -886,9 +829,9 @@ begin
Str := '"' + FActiveEvent.Description + '"'; Str := '"' + FActiveEvent.Description + '"';
if Verify then if Verify then
DoIt := (MessageDlg(RSDelete + ' ' + Str + ' ' + RSFromSchedule DoIt := (MessageDlg(Format(RSDeleteContactFromSchedule, [Str]) + #13#10#10 + RSPermanent,
+ #13#10#10 + RSPermanent, mtconfirmation, // DoIt := (MessageDlg(RSDelete + ' ' + Str + ' ' + RSFromSchedule + #13#10#10 + RSPermanent,
[mbYes, mbNo], 0) = mrYes); mtConfirmation, [mbYes, mbNo], 0) = mrYes);
if DoIt then begin if DoIt then begin
FActiveEvent.Deleted := true; FActiveEvent.Deleted := true;
@ -941,7 +884,6 @@ procedure TVpDayView.InitializeDefaultPopup;
var var
NewItem: TMenuItem; NewItem: TMenuItem;
NewSubItem: TMenuItem; NewSubItem: TMenuItem;
begin begin
if RSDayPopupAdd <> '' then begin if RSDayPopupAdd <> '' then begin
NewItem := TMenuItem.Create(Self); NewItem := TMenuItem.Create(Self);
@ -1068,7 +1010,6 @@ procedure TVpDayView.PopupAddEvent (Sender : TObject);
var var
StartTime: TDateTime; StartTime: TDateTime;
EndTime: TDateTime; EndTime: TDateTime;
begin begin
if ReadOnly then if ReadOnly then
Exit; Exit;
@ -1079,12 +1020,13 @@ begin
if not Assigned (DataStore.Resource) then if not Assigned (DataStore.Resource) then
Exit; Exit;
StartTime := trunc(FDisplayDate + ActiveCol) + StartTime := trunc(FDisplayDate + ActiveCol) + dvLineMatrix[ActiveCol, ActiveRow].Time;
dvLineMatrix[ActiveCol, ActiveRow].Time;
EndTime := StartTime + dvTimeIncSize; EndTime := StartTime + dvTimeIncSize;
FActiveEvent := DataStore.Resource.Schedule.AddEvent( FActiveEvent := DataStore.Resource.Schedule.AddEvent(
DataStore.GetNextID(EventsTableName), DataStore.GetNextID(EventsTableName),
StartTime, EndTime); StartTime,
EndTime
);
Repaint; Repaint;
{ edit this new event } { edit this new event }
@ -1158,7 +1100,6 @@ end;
procedure TVpDayView.PopupNextMonth(Sender: TObject); procedure TVpDayView.PopupNextMonth(Sender: TObject);
var var
M, D, Y: Word; M, D, Y: Word;
begin begin
DecodeDate(Date, Y, M, D); DecodeDate(Date, Y, M, D);
if M = 12 then begin if M = 12 then begin
@ -1193,7 +1134,6 @@ end;
procedure TVpDayView.PopupNextYear(Sender: TObject); procedure TVpDayView.PopupNextYear(Sender: TObject);
var var
M, D, Y : Word; M, D, Y : Word;
begin begin
DecodeDate(Date, Y, M, D); DecodeDate(Date, Y, M, D);
Date := EncodeDate(Y + 1, M, 1); Date := EncodeDate(Y + 1, M, 1);
@ -1203,7 +1143,6 @@ end;
procedure TVpDayView.PopupPrevYear(Sender: TObject); procedure TVpDayView.PopupPrevYear(Sender: TObject);
var var
M, D, Y: Word; M, D, Y: Word;
begin begin
DecodeDate(Date, Y, M, D); DecodeDate(Date, Y, M, D);
Date := EncodeDate(Y - 1, M, 1); Date := EncodeDate(Y - 1, M, 1);
@ -1221,15 +1160,8 @@ end;
procedure TVpDayView.Paint; procedure TVpDayView.Paint;
begin begin
RenderToCanvas (Canvas, RenderToCanvas(Canvas, Rect(0, 0, Width, Height), ra0, 1, FDisplayDate,
Rect (0, 0, Width, Height), TopLine, -1, FGranularity, False);
ra0,
1,
FDisplayDate,
TopLine,
-1,
FGranularity,
False);
SetVScrollPos; SetVScrollPos;
end; end;
{=====} {=====}
@ -1257,21 +1189,16 @@ begin
end; end;
{=====} {=====}
function TVpDayView.dvCalcVisibleLines (RenderHeight : Integer; function TVpDayView.dvCalcVisibleLines(RenderHeight, ColHeadHeight, RowHeight: Integer;
ColHeadHeight : Integer; Scale: Extended; StartLine, StopLine: Integer): Integer;
RowHeight : Integer;
Scale : Extended;
StartLine : Integer;
StopLine : Integer) : Integer;
var var
vertical: integer; vertical: integer;
begin begin
if StartLine < 0 then if StartLine < 0 then
StartLine := TopLine; StartLine := TopLine;
{ take into account the number lines that are allowed! } { take into account the number lines that are allowed! }
vertical := Round (RenderHeight - (ColHeadHeight * Scale) - 2); vertical := Round(RenderHeight - ColHeadHeight * Scale - 2);
Result := trunc (Vertical div RowHeight) + 2; Result := trunc (Vertical div RowHeight) + 2;
if Result > FLineCount then if Result > FLineCount then
Result := FLineCOunt; Result := FLineCOunt;
@ -1295,16 +1222,14 @@ end;
function TVpDayView.dvCalcColHeadHeight(Scale: Extended): Integer; function TVpDayView.dvCalcColHeadHeight(Scale: Extended): Integer;
var var
TextHeight: Integer; TextHeight: Integer;
begin begin
Canvas.Font.Assign(FHeadAttr.Font); Canvas.Font.Assign(FHeadAttr.Font);
if FShowResourceName and (DataStore <> nil) and if FShowResourceName and (DataStore <> nil) and (DataStore.Resource <> nil)
(DataStore.Resource <> nil) then then
TextHeight := (Canvas.TextHeight(RSTallShortChars) * 2) + TextHeight := Canvas.TextHeight(RSTallShortChars) * 2 + TextMargin * 3
(TextMargin * 3)
else else
TextHeight := Canvas.TextHeight(RSTallShortChars) + (TextMargin * 2); TextHeight := Canvas.TextHeight(RSTallShortChars) + TextMargin * 2;
Result := Round(TextHeight * Scale); Result := Round(TextHeight * Scale);
dvColHeadHeight := Result; dvColHeadHeight := Result;
end; end;
@ -1318,8 +1243,7 @@ begin //exit;
Exit; Exit;
if FActiveEvent <> nil then begin if FActiveEvent <> nil then begin
// Set the time from which this event was dragged // Set the time from which this event was dragged
DvDragStartTime := trunc(Date + ActiveCol) DvDragStartTime := trunc(Date + ActiveCol) + dvLineMatrix[ActiveCol, ActiveRow].Time;
+ dvLineMatrix[ActiveCol, ActiveRow].Time;
DragObject := TVpEventDragObject.Create(Self); DragObject := TVpEventDragObject.Create(Self);
TVpEventDragObject(DragObject).Event := FActiveEvent; TVpEventDragObject(DragObject).Event := FActiveEvent;
@ -1360,7 +1284,6 @@ var
Duration: TDateTime; Duration: TDateTime;
DragToTime: TDateTime; DragToTime: TDateTime;
i: Integer; i: Integer;
begin //exit; begin //exit;
if ReadOnly then if ReadOnly then
Exit; Exit;
@ -1410,7 +1333,6 @@ function TVpDayView.dvCalcRowHeight (Scale : Extended;
var var
SaveFont: TFont; SaveFont: TFont;
Temp: Integer; Temp: Integer;
begin begin
{ Calculates row height based on the largest of the RowHead's Minute } { Calculates row height based on the largest of the RowHead's Minute }
{ font, the standard client font, and a sample character string. } { font, the standard client font, and a sample character string. }
@ -1436,24 +1358,23 @@ begin
end; end;
dvRowHeight := Result; dvRowHeight := Result;
end; end;
{=====} {=====}
function TVpDayView.GetLastVisibleDate : TDateTime; function TVpDayView.GetLastVisibleDate : TDateTime;
begin begin
Result := Date + GetRealNumDays(Date); Result := Date + GetRealNumDays(Date);
end; end;
{=====} {=====}
function TVpDayView.GetRealNumDays(WorkDate: TDateTime) : Integer; function TVpDayView.GetRealNumDays(WorkDate: TDateTime) : Integer;
var var
i: Integer; i: Integer;
begin begin
if not FIncludeWeekends then begin if not FIncludeWeekends then begin
Result := 0; Result := 0;
i := 0; i := 0;
while i < FNumDays do begin while i < FNumDays do begin
if (DayOfWeek (WorkDate) <> 1) and if (DayOfWeek (WorkDate) <> 1) and (DayOfWeek (WorkDate) <> 7) then
(DayOfWeek (WorkDate) <> 7) then
Inc(i); Inc(i);
WorkDate := WorkDate + 1; WorkDate := WorkDate + 1;
Inc (Result); Inc (Result);
@ -1538,9 +1459,8 @@ end;
procedure TVpDayView.SetGutterWidth(Value: Integer); procedure TVpDayView.SetGutterWidth(Value: Integer);
begin begin
if (Value <> FGutterWidth) if (Value <> FGutterWidth) and (Value > -1) and (Value < Width div 10) then
and (Value > -1) begin
and (Value < (Width div 10)) then begin
FGutterWidth := Value; FGutterWidth := Value;
Invalidate; Invalidate;
end; end;
@ -1562,31 +1482,38 @@ var
I, J: Integer; I, J: Integer;
begin begin
case UseGran of case UseGran of
gr60Min: begin gr60Min:
begin
FLineCount := 24; FLineCount := 24;
dvTimeIncSize := 60 / MinutesInDay; dvTimeIncSize := 60 / MinutesInDay;
end; end;
gr30Min: begin gr30Min:
begin
FLineCount := 48; FLineCount := 48;
dvTimeIncSize := 30 / MinutesInDay; dvTimeIncSize := 30 / MinutesInDay;
end; end;
gr20Min: begin gr20Min:
begin
FLineCount := 72; FLineCount := 72;
dvTimeIncSize := 20 / MinutesInDay; dvTimeIncSize := 20 / MinutesInDay;
end; end;
gr15Min: begin gr15Min:
begin
FLineCount := 96; FLineCount := 96;
dvTimeIncSize := 15 / MinutesInDay; dvTimeIncSize := 15 / MinutesInDay;
end; end;
gr10Min: begin gr10Min:
begin
FLineCount := 144; FLineCount := 144;
dvTimeIncSize := 10 / MinutesInDay; dvTimeIncSize := 10 / MinutesInDay;
end; end;
gr06Min : begin gr06Min:
begin
FLineCount := 240; FLineCount := 240;
dvTimeIncSize := 6 / MinutesInDay; dvTimeIncSize := 6 / MinutesInDay;
end; end;
gr05Min : begin gr05Min:
begin
FLineCount := 288; FLineCount := 288;
dvTimeIncSize := 5 / MinutesInDay; dvTimeIncSize := 5 / MinutesInDay;
end; end;
@ -1605,13 +1532,15 @@ begin
end end
else begin else begin
case UseGran of case UseGran of
gr60Min: begin gr60Min:
begin
dvLineMatrix[I,J].Time := J * (60 / MinutesInDay); dvLineMatrix[I,J].Time := J * (60 / MinutesInDay);
dvLineMatrix[I,J].Hour := TVpHours(J); dvLineMatrix[I,J].Hour := TVpHours(J);
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
gr30Min: begin gr30Min:
begin
dvLineMatrix[I,J].Hour := TVpHours(J div 2); dvLineMatrix[I,J].Hour := TVpHours(J div 2);
case (J mod 2) of case (J mod 2) of
0: begin 0: begin
@ -1619,15 +1548,14 @@ begin
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
1: begin 1: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize;
* (60 / MinutesInDay)
+ dvTimeIncSize);
dvLineMatrix[I,J].Minute := 30; dvLineMatrix[I,J].Minute := 30;
end; end;
end; end;
end; end;
gr20Min: begin gr20Min:
begin
dvLineMatrix[I,J].Hour := TVpHours(J div 3); dvLineMatrix[I,J].Hour := TVpHours(J div 3);
case (J mod 3) of case (J mod 3) of
0: begin 0: begin
@ -1635,44 +1563,41 @@ begin
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
1: begin 1: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize;
* (60 / MinutesInDay) + dvTimeIncSize);
dvLineMatrix[I,J].Minute := 20; dvLineMatrix[I,J].Minute := 20;
end; end;
2: begin 2: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 2;
* (60 / MinutesInDay) + (dvTimeIncSize * 2));
dvLineMatrix[I,J].Minute := 40; dvLineMatrix[I,J].Minute := 40;
end; end;
end; end;
end; end;
gr15Min: begin gr15Min:
begin
dvLineMatrix[I,J].Hour := TVpHours(J div 4); dvLineMatrix[I,J].Hour := TVpHours(J div 4);
case (J mod 4) of case J mod 4 of
0: begin 0: begin
dvLineMatrix[I,J].Time := (J div 4) * (60 / MinutesInDay); dvLineMatrix[I,J].Time := (J div 4) * (60 / MinutesInDay);
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
1: begin 1: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize;
* (60 / MinutesInDay) + dvTimeIncSize);
dvLineMatrix[I,J].Minute := 15; dvLineMatrix[I,J].Minute := 15;
end; end;
2: begin 2: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 2;
+ (dvTimeIncSize * 2));
dvLineMatrix[I,J].Minute := 30; dvLineMatrix[I,J].Minute := 30;
end; end;
3: begin 3: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 3;
+ (dvTimeIncSize * 3));
dvLineMatrix[I,J].Minute := 45; dvLineMatrix[I,J].Minute := 45;
end; end;
end; end;
end; end;
gr10Min: begin gr10Min:
begin
dvLineMatrix[I,J].Hour := TVpHours(J div 6); dvLineMatrix[I,J].Hour := TVpHours(J div 6);
case (J mod 6) of case (J mod 6) of
0: begin 0: begin
@ -1680,34 +1605,30 @@ begin
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
1: begin 1: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize;
+ dvTimeIncSize);
dvLineMatrix[I,J].Minute := 10; dvLineMatrix[I,J].Minute := 10;
end; end;
2: begin 2: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 2;
+ (dvTimeIncSize * 2));
dvLineMatrix[I,J].Minute := 20; dvLineMatrix[I,J].Minute := 20;
end; end;
3: begin 3: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 3;
+ (dvTimeIncSize * 3));
dvLineMatrix[I,J].Minute := 30; dvLineMatrix[I,J].Minute := 30;
end; end;
4: begin 4: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 4;
+ (dvTimeIncSize * 4));
dvLineMatrix[I,J].Minute := 40; dvLineMatrix[I,J].Minute := 40;
end; end;
5: begin 5: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 5;
+ (dvTimeIncSize * 5));
dvLineMatrix[I,J].Minute := 50; dvLineMatrix[I,J].Minute := 50;
end; end;
end; end;
end; end;
gr06Min : begin gr06Min:
begin
dvLineMatrix[I,J].Hour := TVpHours(J div 10); dvLineMatrix[I,J].Hour := TVpHours(J div 10);
case (J mod 10) of case (J mod 10) of
0: begin 0: begin
@ -1715,113 +1636,94 @@ begin
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
1: begin 1: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize;
+ dvTimeIncSize);
dvLineMatrix[I,J].Minute := 6; dvLineMatrix[I,J].Minute := 6;
end; end;
2: begin 2: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 2;
+ (dvTimeIncSize * 2));
dvLineMatrix[I,J].Minute := 12; dvLineMatrix[I,J].Minute := 12;
end; end;
3: begin 3: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 3;
+ (dvTimeIncSize * 3));
dvLineMatrix[I,J].Minute := 18; dvLineMatrix[I,J].Minute := 18;
end; end;
4: begin 4: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 4;
+ (dvTimeIncSize * 4));
dvLineMatrix[I,J].Minute := 24; dvLineMatrix[I,J].Minute := 24;
end; end;
5: begin 5: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 5;
+ (dvTimeIncSize * 5));
dvLineMatrix[I,J].Minute := 30; dvLineMatrix[I,J].Minute := 30;
end; end;
6: begin 6: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 6;
+ (dvTimeIncSize * 6));
dvLineMatrix[I,J].Minute := 36; dvLineMatrix[I,J].Minute := 36;
end; end;
7: begin 7: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 7;
+ (dvTimeIncSize * 7));
dvLineMatrix[I,J].Minute := 42; dvLineMatrix[I,J].Minute := 42;
end; end;
8: begin 8: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 8;
+ (dvTimeIncSize * 8));
dvLineMatrix[I,J].Minute := 48; dvLineMatrix[I,J].Minute := 48;
end; end;
9: begin 9: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 9;
+ (dvTimeIncSize * 9));
dvLineMatrix[I,J].Minute := 54; dvLineMatrix[I,J].Minute := 54;
end; end;
end; end;
end; end;
gr05Min : begin gr05Min:
begin
dvLineMatrix[I,J].Hour := TVpHours(J div 12); dvLineMatrix[I,J].Hour := TVpHours(J div 12);
case (J mod 12) of case J mod 12 of
0: begin 0: begin
dvLineMatrix[I,J].Time := (J div 12) * (60 / MinutesInDay); dvLineMatrix[I,J].Time := (J div 12) * (60 / MinutesInDay);
dvLineMatrix[I,J].Minute := 0; dvLineMatrix[I,J].Minute := 0;
end; end;
1: begin 1: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize;
+ dvTimeIncSize);
dvLineMatrix[I,J].Minute := 5; dvLineMatrix[I,J].Minute := 5;
end; end;
2: begin 2: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 2;
+ (dvTimeIncSize * 2));
dvLineMatrix[I,J].Minute := 10; dvLineMatrix[I,J].Minute := 10;
end; end;
3: begin 3: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 3;
+ (dvTimeIncSize * 3));
dvLineMatrix[I,J].Minute := 15; dvLineMatrix[I,J].Minute := 15;
end; end;
4: begin 4: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 4;
+ (dvTimeIncSize * 4));
dvLineMatrix[I,J].Minute := 20; dvLineMatrix[I,J].Minute := 20;
end; end;
5: begin 5: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 5;
+ (dvTimeIncSize * 5));
dvLineMatrix[I,J].Minute := 25; dvLineMatrix[I,J].Minute := 25;
end; end;
6: begin 6: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 6;
+ (dvTimeIncSize * 6));
dvLineMatrix[I,J].Minute := 30; dvLineMatrix[I,J].Minute := 30;
end; end;
7: begin 7: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 7;
+ (dvTimeIncSize * 7));
dvLineMatrix[I,J].Minute := 35; dvLineMatrix[I,J].Minute := 35;
end; end;
8: begin 8: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 8;
+ (dvTimeIncSize * 8));
dvLineMatrix[I,J].Minute := 40; dvLineMatrix[I,J].Minute := 40;
end; end;
9: begin 9: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 9;
+ (dvTimeIncSize * 9));
dvLineMatrix[I,J].Minute := 45; dvLineMatrix[I,J].Minute := 45;
end; end;
10: begin 10: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 10;
+ (dvTimeIncSize * 10));
dvLineMatrix[I,J].Minute := 50; dvLineMatrix[I,J].Minute := 50;
end; end;
11: begin 11: begin
dvLineMatrix[I,J].Time := (Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) dvLineMatrix[I,J].Time := Ord(dvLineMatrix[I,J].Hour) * (60 / MinutesInDay) + dvTimeIncSize * 11;
+ (dvTimeIncSize * 11));
dvLineMatrix[I,J].Minute := 55; dvLineMatrix[I,J].Minute := 55;
end; end;
end; end;

View File

@ -136,6 +136,7 @@ resourcestring
{Event Specific} {Event Specific}
RSFromSchedule = 'from your schedule?'; RSFromSchedule = 'from your schedule?';
RSDeleteContactFromSchedule = 'Delete contact %s from your schedule?';
{Task Specific} {Task Specific}
RSFromTaskList = 'from your task list?'; RSFromTaskList = 'from your task list?';