tvplanit: Adjust visibility of DayView variables and methods. Cosmetic changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8412 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-22 14:48:35 +00:00
parent 82df095ab2
commit 9a098ee42b
2 changed files with 117 additions and 181 deletions

View File

@ -234,127 +234,123 @@ type
TVpDayView = class(TVpLinkableControl) TVpDayView = class(TVpLinkableControl)
private private
FComponentHint: TTranslateString;
FDefaultPopup: TPopupMenu;
FExternalPopup: TPopupMenu;
FHintMode: TVpHintMode;
FMouseEvent: TVpEvent;
FOnHoliday: TVpHolidayEvent;
function IsStoredDateLabelFormat: Boolean;
procedure SetPopupMenu(AValue: TPopupMenu);
protected{ private }
FGranularity: TVpGranularity;
FColumnWidth: Integer;
FColor: TColor;
FLineColor: TColor;
FDefTopHour: TVpHours;
FTopHour: TVpHours;
FDateLabelFormat: string;
FShowResourceName: Boolean;
FTopLine: Integer;
FActiveRow: Integer;
FActiveCol: Integer; FActiveCol: Integer;
FActiveEvent: TVpEvent; FActiveEvent: TVpEvent;
FGutterWidth: Integer; FActiveRow: Integer;
FLineCount: Integer;
FVisibleLines: Integer;
FTimeFormat: TVpTimeFormat;
FDrawingStyle: TVpDrawingStyle;
FTimeSlotColors: TVpTimeSlotColor;
FRowHeadAttr: TVpRHAttributes;
FHeadAttr: TVpCHAttributes;
FAllDayEventAttr: TVpAllDayEventAttributes; FAllDayEventAttr: TVpAllDayEventAttributes;
FDisplayDate: TDateTime;
FScrollBars: TScrollStyle;
FIconAttributes: TVpDayViewIconAttributes;
FWrapStyle: TVpDVWrapStyle;
FDotDotDotColor: TColor;
FShowEventTimes: Boolean;
FAllowInplaceEdit: Boolean;
FDragDropTransparent: Boolean;
FAllowDragAndDrop: Boolean; FAllowDragAndDrop: Boolean;
FNumDays: Integer; FAllowInplaceEdit: Boolean;
FIncludeWeekends: Boolean; FColor: TColor;
FRowLinesStep: Integer; FColumnWidth: Integer;
FShowNavButtons: Boolean; FComponentHint: TTranslateString;
FFixedDate: Boolean;
FCustomRowHeight: Integer; FCustomRowHeight: Integer;
FDateLabelFormat: string;
FDefaultPopup: TPopupMenu;
FDefTopHour: TVpHours;
FDisplayDate: TDateTime;
FDotDotDotColor: TColor;
FDragDropTransparent: Boolean;
FDrawingStyle: TVpDrawingStyle;
FExternalPopup: TPopupMenu;
FFixedDate: Boolean;
FGranularity: TVpGranularity;
FGutterWidth: Integer;
FHeadAttr: TVpCHAttributes;
FHintMode: TVpHintMode;
FIconAttributes: TVpDayViewIconAttributes;
FIncludeWeekends: Boolean;
FLineColor: TColor;
FLineCount: Integer;
FMouseEvent: TVpEvent;
FNumDays: Integer;
FRowHeadAttr: TVpRHAttributes;
FRowLinesStep: Integer;
FScrollBars: TScrollStyle;
FShowEventTimes: Boolean;
FShowNavButtons: Boolean;
FShowResourceName: Boolean;
FSimpleRowTime: Boolean; FSimpleRowTime: Boolean;
{ event variables } FTimeFormat: TVpTimeFormat;
FOwnerDrawRowHead: TVpOwnerDrawRowEvent; FTimeSlotColors: TVpTimeSlotColor;
FOwnerDrawCells: TVpOwnerDrawRowEvent; FTopHour: TVpHours;
FOwnerDrawColHead: TVpOwnerDrawEvent; FTopLine: Integer;
FBeforeEdit: TVpBeforeEditEvent; FVisibleLines: Integer;
FAfterEdit: TVpAfterEditEvent; FWrapStyle: TVpDVWrapStyle;
FOwnerEditEvent: TVpEditEvent; // internal variables
FOnDrawIcons: TVpOnDVDrawIcons;
FOnBeforeDrawEvent: TVpOnDVBeforeDrawEvent;
FOnAfterDrawEvent: TVpOnDVAfterDrawEvent;
FOnAddEvent: TVpOnAddNewEvent;
FOnModifyEvent: TVpOnModifyEvent;
FOnDeletingEvent: TVpOnDeletingEvent;
{ internal variables }
dvClickTimer: TTimer; dvClickTimer: TTimer;
dvLoaded: Boolean;
dvInLinkHandler: Boolean;
dvRowHeight: Integer;
dvColHeadHeight: Integer;
dvRowHeadWidth: Integer;
dvClientVArea: Integer; dvClientVArea: Integer;
dvMouseDownPoint: TPoint; dvColHeadHeight: Integer;
dvMouseDown: Boolean; dvCreatingEditor: Boolean;
dvEndingEditing: Boolean;
dvDragging: Boolean; dvDragging: Boolean;
dvDragStartTime: TDateTime; dvDragStartTime: TDateTime;
dvEndingEditing: Boolean;
dvHotPoint: TPoint;
dvInLinkHandler: Boolean;
dvLoaded: Boolean;
dvMouseDown: Boolean;
dvMouseDownPoint: TPoint;
dvPainting: Boolean;
dvRowHeadWidth: Integer;
dvRowHeight: Integer;
dvTimeIncSize: double;
dvVScrollDelta: Integer;
// event variables
FAfterEdit: TVpAfterEditEvent;
FBeforeEdit: TVpBeforeEditEvent;
FOnAddEvent: TVpOnAddNewEvent;
FOnAfterDrawEvent: TVpOnDVAfterDrawEvent;
FOnBeforeDrawEvent: TVpOnDVBeforeDrawEvent;
FOnDeletingEvent: TVpOnDeletingEvent;
FOnDrawIcons: TVpOnDVDrawIcons;
FOnHoliday: TVpHolidayEvent;
FOnModifyEvent: TVpOnModifyEvent;
FOwnerDrawCells: TVpOwnerDrawRowEvent;
FOwnerDrawColHead: TVpOwnerDrawEvent;
FOwnerDrawRowHead: TVpOwnerDrawRowEvent;
FOwnerEditEvent: TVpEditEvent;
// Property methods
function GetLastVisibleDate: TDateTime;
function IsStoredDateLabelFormat: Boolean;
procedure SetActiveCol(Value: Integer);
procedure SetActiveRow(Value: Integer);
procedure SetColor(Value: TColor); reintroduce;
procedure SetCustomRowHeight(Value: Integer);
procedure SetDateLabelFormat(Value: string);
procedure SetDefTopHour(Value: TVpHours);
procedure SetDisplayDate(Value: TDateTime);
procedure SetDotDotDotColor(const v: TColor);
procedure SetDrawingStyle(Value: TVpDrawingStyle);
procedure SetGranularity(Value: TVpGranularity);
procedure SetGutterWidth(Value: Integer);
procedure SetIncludeWeekends(Value: Boolean);
procedure SetLineColor(Value: TColor);
procedure SetNumDays(Value: Integer);
procedure SetPopupMenu(AValue: TPopupMenu);
procedure SetRowLinesStep(Value: Integer);
procedure SetShowEventTimes(Value: Boolean);
procedure SetShowNavButtons(Value: Boolean);
procedure SetShowResourceName(Value: Boolean);
procedure SetSimpleRowTime(Value: Boolean);
procedure SetTimeFormat(Value: TVpTimeFormat);
procedure SetTopHour(Value: TVpHours);
procedure SetTopLine(Value: Integer);
procedure SetVScrollPos;
procedure SetWrapStyle(const v: TVpDVWrapStyle);
{ Nav Buttons } protected
// Needed by the DayViewPainter
dvDayUpBtn: TSpeedButton; dvDayUpBtn: TSpeedButton;
dvDayDownBtn: TSpeedButton; dvDayDownBtn: TSpeedButton;
dvTodayBtn: TSpeedButton; dvTodayBtn: TSpeedButton;
dvWeekUpBtn: TSpeedButton; dvWeekUpBtn: TSpeedButton;
dvWeekDownBtn: TSpeedButton; dvWeekDownBtn: TSpeedButton;
dvLineMatrix: TVpLineMatrix;
dvColRectArray: TVpColRectArray;
dvEventArray: TVpEventArray;
dvActiveEventRec: TRect; dvActiveEventRec: TRect;
dvActiveIconRec: TRect; dvActiveIconRec: TRect;
dvColRectArray: TVpColRectArray;
dvEventArray: TVpEventArray;
dvInPlaceEditor: TVpDvInPlaceEdit; dvInPlaceEditor: TVpDvInPlaceEdit;
dvCreatingEditor: Boolean; dvLineMatrix: TVpLineMatrix;
{ the granularity based time increment for each row }
dvTimeIncSize: double;
dvPainting: Boolean;
dvVScrollDelta: Integer;
dvHotPoint: TPoint;
{ property methods }
function GetLastVisibleDate: TDateTime;
function GetRealNumDays(WorkDate: TDateTime) : Integer;
procedure SetDrawingStyle(Value: TVpDrawingStyle);
procedure SetColor(Value: TColor); reintroduce;
procedure SetLineColor(Value: TColor);
procedure SetTopHour(Value: TVpHours);
procedure SetTopLine(Value: Integer);
procedure SetDateLabelFormat(Value: string);
procedure SetGutterWidth(Value: Integer);
procedure SetDefTopHour(Value: TVpHours);
procedure SetGranularity(Value: TVpGranularity);
procedure SetTimeFormat(Value: TVpTimeFormat);
procedure SetNumDays(Value: Integer);
procedure SetIncludeWeekends(Value: Boolean);
procedure SetDisplayDate(Value: TDateTime);
procedure SetVScrollPos;
procedure SetCustomRowHeight(Value: Integer);
procedure SetRowLinesStep(Value: Integer);
procedure SetShowNavButtons(Value: Boolean);
procedure SetShowResourceName(Value: Boolean);
procedure SetSimpleRowTime(Value: Boolean);
procedure SetActiveRow(Value: Integer);
procedure SetActiveCol(Value: Integer);
procedure SetWrapStyle(const v: TVpDVWrapStyle);
procedure SetDotDotDotColor(const v: TColor);
procedure SetShowEventTimes(Value: Boolean);
{ drag-drop methods } { drag-drop methods }
procedure DoStartDrag(var DragObject: TDragObject); override; procedure DoStartDrag(var DragObject: TDragObject); override;
@ -392,8 +388,6 @@ type
procedure InitializeDefaultPopup; procedure InitializeDefaultPopup;
{ internal methods } { internal methods }
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer; function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer;
function dvCalcVisibleLines(RenderHeight, ColHeadHeight, ARowHeight: Integer; function dvCalcVisibleLines(RenderHeight, ColHeadHeight, ARowHeight: Integer;
Scale: Extended; StartLine, StopLine: Integer): Integer; Scale: Extended; StartLine, StopLine: Integer): Integer;
@ -411,10 +405,13 @@ type
procedure EndEdit(Sender: TObject); procedure EndEdit(Sender: TObject);
function GetEventAtCoord(APoint: TPoint): TVpEvent; function GetEventAtCoord(APoint: TPoint): TVpEvent;
function GetEventRect(AEvent: TVpEvent): TRect; function GetEventRect(AEvent: TVpEvent): TRect;
function GetRealNumDays(WorkDate: TDateTime): Integer;
procedure SetActiveEventByCoord(APoint: TPoint); procedure SetActiveEventByCoord(APoint: TPoint);
procedure SetTimeIntervals(UseGran: TVpGranularity); procedure SetTimeIntervals(UseGran: TVpGranularity);
{ inherited methods } { inherited methods }
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure Loaded; override; procedure Loaded; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
@ -556,6 +553,7 @@ uses
SysUtils, StrUtils, Math, Dialogs, SysUtils, StrUtils, Math, Dialogs,
VpEvntEditDlg, VpDayViewPainter; VpEvntEditDlg, VpDayViewPainter;
(*****************************************************************************) (*****************************************************************************)
{ TVpTGInPlaceEdit } { TVpTGInPlaceEdit }
@ -566,14 +564,12 @@ begin
BorderStyle := bsNone; BorderStyle := bsNone;
// DoubleBuffered := False; // DoubleBuffered := False;
end; end;
{=====}
procedure TVpDvInPlaceEdit.CreateParams(var Params: TCreateParams); procedure TVpDvInPlaceEdit.CreateParams(var Params: TCreateParams);
begin begin
inherited CreateParams(Params); inherited CreateParams(Params);
Params.Style := Params.Style{$IFNDEF LCL} or ES_MULTILINE{$ENDIF}; Params.Style := Params.Style{$IFNDEF LCL} or ES_MULTILINE{$ENDIF};
end; end;
{=====}
procedure TVpDvInPlaceEdit.KeyDown(var Key: Word; Shift: TShiftState); procedure TVpDvInPlaceEdit.KeyDown(var Key: Word; Shift: TShiftState);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -615,7 +611,6 @@ begin
inherited; inherited;
end; end;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDvInPlaceEdit.WMKillFocus(var Msg: TWMKillFocus); procedure TVpDvInPlaceEdit.WMKillFocus(var Msg: TWMKillFocus);
@ -626,9 +621,9 @@ begin
Unused(Msg); Unused(Msg);
TVpDayView(Owner).EndEdit(self); TVpDayView(Owner).EndEdit(self);
end; end;
{=====}
(*****************************************************************************)
{ TVpAllDayEventAttributes } { TVpAllDayEventAttributes }
constructor TVpAllDayEventAttributes.Create(AOwner: TWinControl); constructor TVpAllDayEventAttributes.Create(AOwner: TWinControl);
@ -639,28 +634,24 @@ begin
FEventBackgroundColor := clBtnFace; FEventBackgroundColor := clBtnFace;
FEventBorderColor := cl3dDkShadow; FEventBorderColor := cl3dDkShadow;
end; end;
{=====}
destructor TVpAllDayEventAttributes.Destroy; destructor TVpAllDayEventAttributes.Destroy;
begin begin
inherited; inherited;
FFont.Free; FFont.Free;
end; end;
{=====}
procedure TVpAllDayEventAttributes.SetBackGroundColor(Value: TColor); procedure TVpAllDayEventAttributes.SetBackGroundColor(Value: TColor);
begin begin
FBackgroundColor := Value; FBackgroundColor := Value;
FOwner.Invalidate; FOwner.Invalidate;
end; end;
{=====}
procedure TVpAllDayEventAttributes.SetEventBackgroundColor(Value: TColor); procedure TVpAllDayEventAttributes.SetEventBackgroundColor(Value: TColor);
begin begin
FEventBackgroundColor := Value; FEventBackgroundColor := Value;
FOwner.Invalidate; FOwner.Invalidate;
end; end;
{=====}
procedure TVpAllDayEventAttributes.SetEventBorderColor(Value: TColor); procedure TVpAllDayEventAttributes.SetEventBorderColor(Value: TColor);
begin begin
@ -673,7 +664,7 @@ begin
FFont.Assign(Value); FFont.Assign(Value);
FFont.Owner := FOwner; FFont.Owner := FOwner;
end; end;
{=====}
(*****************************************************************************) (*****************************************************************************)
{ TVpDayViewIconAttributes } { TVpDayViewIconAttributes }
@ -760,6 +751,7 @@ begin
end; end;
end; end;
(*****************************************************************************) (*****************************************************************************)
{ TVpDayView } { TVpDayView }
@ -903,7 +895,6 @@ begin
dvHookUp; dvHookUp;
end; end;
{=====}
destructor TVpDayView.Destroy; destructor TVpDayView.Destroy;
begin begin
@ -1032,8 +1023,6 @@ begin
TVpMenuItem(item).Translate; TVpMenuItem(item).Translate;
end; end;
{=====}
procedure TVpDayView.DeleteActiveEvent(Verify: Boolean); procedure TVpDayView.DeleteActiveEvent(Verify: Boolean);
var var
DoIt: Boolean; DoIt: Boolean;
@ -1065,7 +1054,6 @@ begin
end; end;
end; end;
end; end;
{=====}
procedure TVpDayView.Invalidate; procedure TVpDayView.Invalidate;
begin begin
@ -1094,7 +1082,6 @@ begin
dvInLinkHandler := false; dvInLinkHandler := false;
end; end;
end; end;
{=====}
procedure TVpDayView.dvHookUp; procedure TVpDayView.dvHookUp;
var var
@ -1111,7 +1098,9 @@ begin
end; end;
end; end;
{ Hint support } { Hint support }
procedure TVpDayView.ShowHintWindow(APoint: TPoint; AEvent: TVpEvent); procedure TVpDayView.ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
var var
txt: String; txt: String;
@ -1521,7 +1510,6 @@ begin
dvLoaded := true; dvLoaded := true;
dvPopulate; dvPopulate;
end; end;
{=====}
procedure TVpDayView.Paint; procedure TVpDayView.Paint;
begin begin
@ -1529,14 +1517,12 @@ begin
TopLine, -1, FGranularity, False); TopLine, -1, FGranularity, False);
SetVScrollPos; SetVScrollPos;
end; end;
{=====}
procedure TVpDayView.dvPopulate; procedure TVpDayView.dvPopulate;
begin begin
if DataStore <> nil then if DataStore <> nil then
DataStore.Date := FDisplayDate; DataStore.Date := FDisplayDate;
end; end;
{=====}
procedure TVpDayView.dvNavButtonsClick(Sender: TObject); procedure TVpDayView.dvNavButtonsClick(Sender: TObject);
begin begin
@ -1552,7 +1538,6 @@ begin
else if Sender = dvWeekDownBtn then else if Sender = dvWeekDownBtn then
Date := Date - 7; Date := Date - 7;
end; end;
{=====}
function TVpDayView.dvCalcVisibleLines(RenderHeight, ColHeadHeight, ARowHeight: Integer; function TVpDayView.dvCalcVisibleLines(RenderHeight, ColHeadHeight, ARowHeight: Integer;
Scale: Extended; StartLine, StopLine: Integer): Integer; Scale: Extended; StartLine, StopLine: Integer): Integer;
@ -1586,7 +1571,6 @@ begin
} }
FVisibleLines := Result; FVisibleLines := Result;
end; end;
{=====}
procedure TVpDayView.SetColor(Value: TColor); procedure TVpDayView.SetColor(Value: TColor);
begin begin
@ -1595,7 +1579,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
function TVpDayView.dvCalcColHeadHeight(Scale: Extended): Integer; function TVpDayView.dvCalcColHeadHeight(Scale: Extended): Integer;
var var
@ -1618,7 +1601,6 @@ begin
dvColHeadHeight := Result; dvColHeadHeight := Result;
end; end;
{=====}
procedure TVpDayView.DoStartDrag(var DragObject: TDragObject); procedure TVpDayView.DoStartDrag(var DragObject: TDragObject);
{$IFDEF LCL} {$IFDEF LCL}
@ -1656,7 +1638,6 @@ begin
DragObject.Free;//EndDrag(false); DragObject.Free;//EndDrag(false);
{$ENDIF} {$ENDIF}
end; end;
{=====}
procedure TVpDayView.DoEndDrag(Target: TObject; X, Y: Integer); procedure TVpDayView.DoEndDrag(Target: TObject; X, Y: Integer);
begin begin
@ -1668,7 +1649,6 @@ begin
{$ENDIF} {$ENDIF}
// not needed for LCL: we use DragObjectEx !! // not needed for LCL: we use DragObjectEx !!
end; end;
{=====}
procedure TVpDayView.DragOver(Source: TObject; X, Y: Integer; State: TDragState; procedure TVpDayView.DragOver(Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); var Accept: Boolean);
@ -1687,7 +1667,6 @@ begin
end else end else
Accept := false; Accept := false;
end; end;
{=====}
procedure TVpDayView.DragDrop(Source: TObject; X, Y: Integer); procedure TVpDayView.DragDrop(Source: TObject; X, Y: Integer);
var var
@ -1760,13 +1739,11 @@ begin
dvClientVArea := Result * MinutesInDay div GranularityMinutes[UseGran]; dvClientVArea := Result * MinutesInDay div GranularityMinutes[UseGran];
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
@ -1784,7 +1761,6 @@ begin
end else end else
Result := FNumDays; Result := FNumDays;
end; end;
{=====}
procedure TVpDayView.SetDrawingStyle(Value: TVpDrawingStyle); procedure TVpDayView.SetDrawingStyle(Value: TVpDrawingStyle);
begin begin
@ -1793,7 +1769,6 @@ begin
Repaint; Repaint;
end; end;
end; end;
{=====}
procedure TVpDayView.SetLineColor(Value: TColor); procedure TVpDayView.SetLineColor(Value: TColor);
begin begin
@ -1802,7 +1777,6 @@ begin
Repaint; Repaint;
end; end;
end; end;
{=====}
procedure TVpDayView.SetTopHour(Value: TVpHours); procedure TVpDayView.SetTopHour(Value: TVpHours);
begin begin
@ -1811,7 +1785,6 @@ begin
TopLine := HourToLine(FTopHour, FGranularity); TopLine := HourToLine(FTopHour, FGranularity);
end; end;
end; end;
{=====}
procedure TVpDayView.SetTopLine(Value: Integer); procedure TVpDayView.SetTopLine(Value: Integer);
begin begin
@ -1854,7 +1827,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpDayView.SetDefTopHour(Value: TVpHours); procedure TVpDayView.SetDefTopHour(Value: TVpHours);
begin begin
@ -1864,7 +1836,6 @@ begin
TopHour := Value; TopHour := Value;
end; end;
end; end;
{=====}
procedure TVpDayView.SetTimeIntervals(UseGran: TVpGranularity); procedure TVpDayView.SetTimeIntervals(UseGran: TVpGranularity);
var var
@ -1903,7 +1874,6 @@ begin
FTopLine := 0; FTopLine := 0;
Invalidate; Invalidate;
end; end;
{=====}
procedure TVpDayView.SetTimeFormat(Value: TVpTimeFormat); procedure TVpDayView.SetTimeFormat(Value: TVpTimeFormat);
begin begin
@ -1912,7 +1882,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpDayView.SetDisplayDate(Value: TDateTime); procedure TVpDayView.SetDisplayDate(Value: TDateTime);
begin begin
@ -1927,7 +1896,6 @@ begin
ControlLink.Notify(self, neDateChange, Date); ControlLink.Notify(self, neDateChange, Date);
end; end;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDayView.WMSize(var Msg: TWMSize); procedure TVpDayView.WMSize(var Msg: TWMSize);
@ -1949,12 +1917,10 @@ begin
else else
Invalidate; Invalidate;
end; end;
{=====}
procedure TVpDayView.CreateParams(var Params: TCreateParams); procedure TVpDayView.CreateParams(var Params: TCreateParams);
begin begin
inherited CreateParams(Params); inherited CreateParams(Params);
with Params do with Params do
begin begin
Style := Style or WS_TABSTOP; Style := Style or WS_TABSTOP;
@ -1965,7 +1931,6 @@ begin
{$ENDIF} {$ENDIF}
end; end;
end; end;
{=====}
procedure TVpDayView.CreateWnd; procedure TVpDayView.CreateWnd;
begin begin
@ -1973,7 +1938,6 @@ begin
PostMessage (Handle, Vp_DayViewInit, 0, 0); PostMessage (Handle, Vp_DayViewInit, 0, 0);
end; end;
procedure TVpDayView.MouseEnter; procedure TVpDayView.MouseEnter;
begin begin
FMouseEvent := nil; FMouseEvent := nil;
@ -2082,8 +2046,6 @@ begin
end; end;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDayView.WMLButtonDblClk(var Msg: TWMLButtonDblClk); procedure TVpDayView.WMLButtonDblClk(var Msg: TWMLButtonDblClk);
{$ELSE} {$ELSE}
@ -2125,7 +2087,6 @@ begin
end; end;
end; end;
end; end;
{=====}
{$IFDEF LCL} {$IFDEF LCL}
function TVpDayView.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; function TVpDayView.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;
@ -2183,7 +2144,6 @@ begin
if FActiveEvent <> nil then if FActiveEvent <> nil then
dvSpawnEventEditDialog(IsNewEvent); dvSpawnEventEditDialog(IsNewEvent);
end; end;
{=====}
procedure TVpDayView.dvSpawnEventEditDialog(IsNewEvent: Boolean); procedure TVpDayView.dvSpawnEventEditDialog(IsNewEvent: Boolean);
var var
@ -2229,7 +2189,6 @@ begin
end; end;
Invalidate; Invalidate;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDayView.WMSetFocus(var Msg: TWMSetFocus); procedure TVpDayView.WMSetFocus(var Msg: TWMSetFocus);
@ -2240,7 +2199,6 @@ begin
Unused(Msg); Unused(Msg);
if ActiveRow = -1 then ActiveRow := TopLine; if ActiveRow = -1 then ActiveRow := TopLine;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDayView.WMEraseBackground(var Msg: TWMERASEBKGND); procedure TVpDayView.WMEraseBackground(var Msg: TWMERASEBKGND);
@ -2250,7 +2208,6 @@ procedure TVpDayView.WMEraseBackground(var Msg: TLMERASEBKGND);
begin begin
Msg.Result := 1; Msg.Result := 1;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDayView.CMWantSpecialKey(var Msg: TCMWantSpecialKey); procedure TVpDayView.CMWantSpecialKey(var Msg: TCMWantSpecialKey);
@ -2259,7 +2216,6 @@ begin
Msg.Result := 1; Msg.Result := 1;
end; end;
{$ENDIF} {$ENDIF}
{=====}
procedure TVpDayView.SetActiveEventByCoord(APoint: TPoint); procedure TVpDayView.SetActiveEventByCoord(APoint: TPoint);
var var
@ -2303,19 +2259,18 @@ begin
end; end;
end; end;
end; end;
{=====}
function TVpDayView.GetEventAtCoord(APoint: TPoint): TVpEvent; function TVpDayView.GetEventAtCoord(APoint: TPoint): TVpEvent;
var var
I: Integer; I: Integer;
begin begin
result := nil; Result := nil;
for I := 0 to pred(Length(dvEventArray)) do begin for I := 0 to pred(Length(dvEventArray)) do begin
if dvEventArray[I].Event = nil then if dvEventArray[I].Event = nil then
Exit; Exit;
if PointInRect(APoint, dvEventArray[I].Rec) then if PointInRect(APoint, dvEventArray[I].Rec) then
begin begin
result := TVpEvent(dvEventArray[I].Event); Result := TVpEvent(dvEventArray[I].Event);
Exit; Exit;
end; end;
end; end;
@ -2340,7 +2295,6 @@ begin
dvClickTimer.Enabled := false; dvClickTimer.Enabled := false;
EditEvent; EditEvent;
end; end;
{=====}
procedure TVpDayView.EditEvent; procedure TVpDayView.EditEvent;
var var
@ -2498,7 +2452,6 @@ begin
end; end;
end; end;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpDayView.WMVScroll(var Msg: TWMVScroll); procedure TVpDayView.WMVScroll(var Msg: TWMVScroll);
@ -2520,13 +2473,11 @@ begin
SB_THUMBPOSITION, SB_THUMBTRACK : TopLine := Msg.Pos; SB_THUMBPOSITION, SB_THUMBTRACK : TopLine := Msg.Pos;
end; end;
end; end;
{=====}
procedure TVpDayView.dvScrollVertical(Lines: Integer); procedure TVpDayView.dvScrollVertical(Lines: Integer);
begin begin
TopLine := TopLine + Lines; TopLine := TopLine + Lines;
end; end;
{=====}
procedure TVpDayView.SetVScrollPos; procedure TVpDayView.SetVScrollPos;
var var
@ -2551,7 +2502,6 @@ begin
end; end;
SetScrollInfo(Handle, SB_VERT, SI, True); SetScrollInfo(Handle, SB_VERT, SI, True);
end; end;
{=====}
procedure TVpDayView.SetCustomRowHeight(Value: Integer); procedure TVpDayView.SetCustomRowHeight(Value: Integer);
begin begin
@ -2615,7 +2565,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpDayView.SetActiveRow(Value: Integer); procedure TVpDayView.SetActiveRow(Value: Integer);
var var
@ -2644,7 +2593,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpDayView.SetActiveCol(Value: Integer); procedure TVpDayView.SetActiveCol(Value: Integer);
begin begin
@ -2658,7 +2606,7 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpDayView.SetDotDotDotColor(const v: TColor); procedure TVpDayView.SetDotDotDotColor(const v: TColor);
begin begin
if v <> FDotDotDotColor then begin if v <> FDotDotDotColor then begin
@ -2666,7 +2614,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpDayView.SetShowEventTimes(Value: Boolean); procedure TVpDayView.SetShowEventTimes(Value: Boolean);
begin begin
@ -2675,7 +2622,6 @@ begin
Invalidate; Invalidate;
end end
end; end;
{=====}
procedure TVpDayView.SetWrapStyle(const v: TVpDVWrapStyle); procedure TVpDayView.SetWrapStyle(const v: TVpDVWrapStyle);
begin begin
@ -2701,8 +2647,6 @@ begin
FComponentHint := Hint; FComponentHint := Hint;
end; end;
{=====}
procedure TVpDayView.dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean); procedure TVpDayView.dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean);
var var
I : Integer; I : Integer;
@ -2724,7 +2668,6 @@ begin
end; end;
end; end;
end; end;
{=====}
procedure TVpDayView.dvSetActiveColByCoord(Pnt: TPoint); procedure TVpDayView.dvSetActiveColByCoord(Pnt: TPoint);
var var
@ -2738,7 +2681,6 @@ begin
end; end;
end; end;
end; end;
{=====}
function TVpDayView.GetControlType : TVpItemType; function TVpDayView.GetControlType : TVpItemType;
begin begin
@ -2828,6 +2770,7 @@ begin
end; end;
{$ENDIF} {$ENDIF}
(*****************************************************************************) (*****************************************************************************)
{ TVpCHAttributes } { TVpCHAttributes }
@ -2837,14 +2780,12 @@ begin
FOwner := AOwner; FOwner := AOwner;
FFont := TVpFont.Create(AOwner); FFont := TVpFont.Create(AOwner);
end; end;
{=====}
destructor TVpCHAttributes.Destroy; destructor TVpCHAttributes.Destroy;
begin begin
FFont.Free; FFont.Free;
inherited; inherited;
end; end;
{=====}
procedure TVpCHAttributes.SetColor(const Value: TColor); procedure TVpCHAttributes.SetColor(const Value: TColor);
begin begin
@ -2853,13 +2794,12 @@ begin
FOwner.Invalidate; FOwner.Invalidate;
end; end;
end; end;
{=====}
procedure TVpCHAttributes.SetFont(Value: TVpFont); procedure TVpCHAttributes.SetFont(Value: TVpFont);
begin begin
FFont.Assign(Value); FFont.Assign(Value);
end; end;
{=====}
(*****************************************************************************) (*****************************************************************************)
{ TVpRHAttributes } { TVpRHAttributes }
@ -2875,7 +2815,6 @@ begin
FMinuteFont.Name := 'Tahoma'; FMinuteFont.Name := 'Tahoma';
{$ENDIF} {$ENDIF}
end; end;
{=====}
destructor TVpRHAttributes.Destroy; destructor TVpRHAttributes.Destroy;
begin begin
@ -2883,7 +2822,6 @@ begin
FMinuteFont.Free; FMinuteFont.Free;
inherited; inherited;
end; end;
{=====}
procedure TVpRHAttributes.SetColor(const Value: TColor); procedure TVpRHAttributes.SetColor(const Value: TColor);
begin begin
@ -2892,7 +2830,6 @@ begin
FOwner.Invalidate; FOwner.Invalidate;
end; end;
end; end;
{=====}
procedure TVpRHAttributes.SetHourFont(Value: TVpFont); procedure TVpRHAttributes.SetHourFont(Value: TVpFont);
begin begin
@ -2901,7 +2838,6 @@ begin
FOwner.Invalidate; FOwner.Invalidate;
end; end;
end; end;
{=====}
procedure TVpRHAttributes.SetMinuteFont(Value: TVpFont); procedure TVpRHAttributes.SetMinuteFont(Value: TVpFont);
begin begin

View File

@ -1160,14 +1160,14 @@ var
begin begin
{ size and place the Today button first. } { size and place the Today button first. }
with TVpDayViewOpener(FDayView) do begin with TVpDayViewOpener(FDayView) do begin
dvDayUpBtn.Visible := FShowNavButtons; dvDayUpBtn.Visible := ShowNavButtons;
dvDayDownBtn.Visible := FShowNavButtons; dvDayDownBtn.Visible := ShowNavButtons;
dvTodayBtn.Visible := FShowNavButtons; dvTodayBtn.Visible := ShowNavButtons;
dvWeekUpBtn.Visible := FShowNavButtons; dvWeekUpBtn.Visible := ShowNavButtons;
dvWeekDownBtn.Visible := FShowNavButtons; dvWeekDownBtn.Visible := ShowNavButtons;
{ In order to hide the nav btns in designmode move them out of their parent } { In order to hide the nav btns in designmode move them out of their parent }
if (csDesigning in ComponentState) and not FShowNavButtons then begin if (csDesigning in ComponentState) and not ShowNavButtons then begin
dvTodayBtn.Left := -Width; dvTodayBtn.Left := -Width;
dvWeekDownBtn.Left := -Width; dvWeekDownBtn.Left := -Width;
dvWeekUpBtn.Left := -Width; dvWeekUpBtn.Left := -Width;