From: <ah...@us...> - 2008-10-23 19:24:07
|
Revision: 11975 http://jvcl.svn.sourceforge.net/jvcl/?rev=11975&view=rev Author: ahuser Date: 2008-10-23 19:24:05 +0000 (Thu, 23 Oct 2008) Log Message: ----------- Incorporated Mantis #4550: TjTFWeeks, TjTFMonths, TjTFScheduler, JvTFGlanceTextViewer bugs and requests Modified Paths: -------------- trunk/jvcl/run/JvTFGlance.pas trunk/jvcl/run/JvTFGlanceTextViewer.pas trunk/jvcl/run/JvTFManager.pas trunk/jvcl/run/JvTFMonths.pas trunk/jvcl/run/JvTFWeeks.pas Modified: trunk/jvcl/run/JvTFGlance.pas =================================================================== --- trunk/jvcl/run/JvTFGlance.pas 2008-10-20 16:13:40 UTC (rev 11974) +++ trunk/jvcl/run/JvTFGlance.pas 2008-10-23 19:24:05 UTC (rev 11975) @@ -52,8 +52,8 @@ TJvTFGlanceViewer = class; TJvTFCellPics = class; - TJvTFUpdateTitleEvent = procedure(Sender: TObject; var NewTitle: string) - of object; + TJvTFUpdateTitleEvent = procedure(Sender: TObject; var NewTitle: string) of object; + TJvApptHintEvent = procedure(Sender: TObject; Appt: TJvTFAppt; var Handled: Boolean) of object; TJvTFCellPic = class(TCollectionItem) private @@ -468,6 +468,7 @@ FSchedNames: TStringList; FSelAppt: TJvTFAppt; + FOnApptHint: TJvApptHintEvent; function GetSchedNames: TStrings; procedure SetBorderStyle(Value: TBorderStyle); @@ -640,7 +641,8 @@ property OnDropAppt: TJvTFGlanceDropApptEvent read FOnDropAppt write FOnDropAppt; property OnUpdateCellTitleText: TJvTFUpdateCellTitleTextEvent read FOnUpdateCellTitleText write FOnUpdateCellTitleText; - //inherited properties + property OnApptHint: TJvApptHintEvent read FOnApptHint write FOnApptHint; + property DateFormat; // from TJvTFControl property TimeFormat; // from TJvTFControl @@ -688,6 +690,9 @@ FPhysicalCell: TJvTFGlanceCell; FRepeatGrouped: Boolean; FShowSchedNamesInHint: Boolean; + FShowStartEndTimeInHint: Boolean; + FOnApptHint: TJvApptHintEvent; + procedure DoGlanceControlApptHint(Sender: TObject; Appt: TJvTFAppt; var Handled: Boolean); procedure SetShowSchedNamesInHint(const Value: Boolean); function GetRepeatAppt(Index: Integer): TJvTFAppt; function GetSchedule(Index: Integer): TJvTFSched; @@ -695,6 +700,7 @@ procedure SetRepeatGrouped(Value: Boolean); function GetDistinctAppt(Index: Integer): TJvTFAppt; function GetAppt(Index: Integer): TJvTFAppt; + procedure SetShowStartEndTimeInHint(const Value: Boolean); protected FInPlaceEdit: Boolean; @@ -735,7 +741,9 @@ published property RepeatGrouped: Boolean read FRepeatGrouped write SetRepeatGrouped default True; property ShowSchedNamesInHint: Boolean read FShowSchedNamesInHint write SetShowSchedNamesInHint default True; + property ShowStartEndTimeInHint: Boolean read FShowStartEndTimeInHint write SetShowStartEndTimeInHint default True; property InPlaceEdit: Boolean read FInPlaceEdit write SetInplaceEdit default True; + property ApptHint: TJvApptHintEvent read FOnApptHint write FOnApptHint; end; TJvTFGlance = class(TJvTFCustomGlance) @@ -2867,7 +2875,8 @@ procedure TJvTFCustomGlance.CheckApptHint(Info: TJvTFGlanceCoord); var - ExtraDesc : string; + ExtraDesc: string; + Handled: Boolean; begin if Assigned(FViewer) and FViewer.ShowSchedNamesInHint then {$IFDEF USEJVCL} @@ -2880,7 +2889,12 @@ {$ENDIF USEJVCL} ExtraDesc := ExtraDesc + #13#10; - FHint.ApptHint(Info.Appt, Info.AbsX + 8, Info.AbsY + 8, True, True, False, ExtraDesc); + Handled := False; + if Assigned(OnApptHint) then + FOnApptHint(Self, Info.Appt, Handled); + if not Handled then + FHint.ApptHint(Info.Appt, Info.AbsX + 8, Info.AbsY + 8, + not Assigned(FViewer) or FViewer.ShowStartEndTimeInHint, True, False, ExtraDesc); end; procedure TJvTFCustomGlance.CheckViewerApptHint(X, Y: Integer); @@ -3647,6 +3661,8 @@ procedure TJvTFGlanceViewer.SetGlanceControl(Value: TJvTFCustomGlance); begin FGlanceControl := Value; + if Assigned(FGlanceControl) then + FGlanceControl.OnApptHint := DoGlanceControlApptHint; end; procedure TJvTFGlanceViewer.SetInplaceEdit(const Value: Boolean); @@ -4088,6 +4104,22 @@ end; end; +procedure TJvTFGlanceViewer.SetShowStartEndTimeInHint(const Value: Boolean); +begin + if FShowStartEndTimeInHint <> Value then + begin + FShowStartEndTimeInHint := Value; + Refresh; + end; +end; + +procedure TJvTFGlanceViewer.DoGlanceControlApptHint(Sender: TObject; + Appt: TJvTFAppt; var Handled: Boolean); +begin + if Assigned(FOnApptHint) then + FOnApptHint(Sender, Appt, Handled); +end; + {$IFDEF USEJVCL} {$IFDEF UNITVERSIONING} initialization @@ -4099,4 +4131,3 @@ {$ENDIF USEJVCL} end. - Modified: trunk/jvcl/run/JvTFGlanceTextViewer.pas =================================================================== --- trunk/jvcl/run/JvTFGlanceTextViewer.pas 2008-10-20 16:13:40 UTC (rev 11974) +++ trunk/jvcl/run/JvTFGlanceTextViewer.pas 2008-10-23 19:24:05 UTC (rev 11975) @@ -59,6 +59,10 @@ RelLineNum: Integer; end; + TJvDrawApptEvent = procedure(Sender: TObject; ACanvas: TCanvas; DrawInfo: TJvTFGlTxtVwDrawInfo; + Appt: TJvTFAppt; Rect:TRect; var Handled: Boolean) of object; + TJvApptHintEvent = procedure(Sender: TObject; Appt: TJvTFAppt; var Handled: Boolean) of object; + TJvTFGVTxtEditor = class(TMemo) private FLinkedAppt: TJvTFAppt; @@ -215,6 +219,8 @@ FOnDblClick: TNotifyEvent; FOnClick: TNotifyEvent; FOnEnter: TNotifyEvent; + FOnDrawAppt: TJvDrawApptEvent; + procedure SetLineSpacing(Value: Integer); procedure SetSelApptAttr(Value: TJvTFTxtVwApptAttr); procedure SetEditorAlign(Value: TJvTFGlTxtVwEditorAlign); @@ -232,6 +238,8 @@ procedure DoDblClick(); virtual; procedure DoClick; virtual; procedure DoEnter; virtual; + procedure DoDrawAppt(ACanvas: TCanvas; DrawInfo: TJvTFGlTxtVwDrawInfo; + Appt: TJvTFAppt; Rect: TRect; var Handled: Boolean); procedure ParentReconfig; override; procedure SetSelAppt(Value: TJvTFAppt); @@ -269,6 +277,8 @@ property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick; property OnClick: TNotifyEvent read FOnClick write FOnClick; property OnEnter: TNotifyEvent read FOnEnter write FOnEnter; + property OnDrawAppt: TJvDrawApptEvent read FOnDrawAppt write FOnDrawAppt; + property OnApptHint; end; {$IFDEF USEJVCL} @@ -425,7 +435,7 @@ procedure TJvTFGVTextControl.PaintTo(ACanvas: TCanvas; DrawInfo: TJvTFGlTxtVwDrawInfo); var - I, NextLineTop, LastLine: Integer; + I, NextLineTop, LastLine, Line: Integer; aRect, LineRect, TxtRect, BtnRect: TRect; Flags: UINT; Txt: string; @@ -433,6 +443,7 @@ Appt: TJvTFAppt; RegFontColor, RegBrushColor: TColor; + DrawingHandled: Boolean; begin Viewer.SetTo(DrawInfo.Cell); @@ -475,7 +486,12 @@ Txt := 'Appt ' + IntToStr(I) else begin - Appt := Viewer.Appts[AbsToRel(I)]; + Line := AbsToRel(I); + if Line < 0 then + Line := 0; + if Line >= Viewer.Appts.Count then + Line := 0; + Appt := Viewer.Appts[Line]; Txt := ''; if Viewer.ShowStartEnd then @@ -513,11 +529,19 @@ TxtRect := LineRect; Windows.InflateRect(TxtRect, -1, -1); - PTxt := StrAlloc((Length(Txt) + 4) * SizeOf(Char)); - StrPCopy(PTxt, Txt); - Windows.DrawText(ACanvas.Handle, PTxt, -1, TxtRect, Flags); - StrDispose(PTxt); + DrawingHandled := False; + if Assigned(Viewer) then + Viewer.DoDrawAppt(ACanvas, DrawInfo, Appt, LineRect, DrawingHandled); + if not DrawingHandled then + begin + // PTxt := StrAlloc((Length(Txt) + 4) * SizeOf(Char)); + // StrPCopy(PTxt, Txt); + // Windows.DrawText(ACanvas.Handle, PTxt, -1, TxtRect, Flags); + // StrDispose(PTxt); + Windows.DrawText(ACanvas.Handle, PChar(Txt), Length(Txt), TxtRect, Flags); + end; + Inc(NextLineTop, CalcLineHeight); end; end; @@ -1484,6 +1508,13 @@ Result := FViewControl.ShowDDButton; end; +procedure TJvTFGlanceTextViewer.DoDrawAppt(ACanvas: TCanvas; + DrawInfo: TJvTFGlTxtVwDrawInfo; Appt: TJvTFAppt; Rect: TRect; var Handled: Boolean); +begin + if Assigned(FOnDrawAppt) then + FOnDrawAppt(Self, ACanvas, DrawInfo, Appt, Rect, Handled); +end; + procedure TJvTFGlanceTextViewer.SetShowLineDDButton(const Value: Boolean); begin FViewControl.ShowDDButton := Value; Modified: trunk/jvcl/run/JvTFManager.pas =================================================================== --- trunk/jvcl/run/JvTFManager.pas 2008-10-20 16:13:40 UTC (rev 11974) +++ trunk/jvcl/run/JvTFManager.pas 2008-10-23 19:24:05 UTC (rev 11975) @@ -3089,7 +3089,12 @@ end; if LoadedNow then - NeedAppts(Result); + begin + if SchedLoadMode = slmOnDemand then + NeedAppts(Result) + else + AddToBatch(Result); + end; end; function TJvTFScheduleManager.RequestSchedule(Comp: TJvTFComponent; @@ -3106,7 +3111,12 @@ end; if ApptsNeeded then - NeedAppts(Result); + begin + if SchedLoadMode = slmOnDemand then + NeedAppts(Result) + else + AddToBatch(Result); + end; end; function TJvTFScheduleManager.RequestSchedule(Comp: TJvTFComponent; @@ -3121,7 +3131,12 @@ end; if LoadedNow then - NeedAppts(Result); + begin + if SchedLoadMode = slmOnDemand then + NeedAppts(Result) + else + AddToBatch(Result); + end; end; procedure TJvTFScheduleManager.ReleaseSchedule(ApptCtrl: TJvTFControl; @@ -4549,14 +4564,10 @@ PhysHeight, TopMarginPels, BottomMarginPels, HeaderPels, FooterPels: Integer; begin PhysHeight := Windows.GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT); - TopMarginPels := ConvertMeasure(PageLayout.MarginTop, Measure, pmPixels, - False); - BottomMarginPels := ConvertMeasure(PageLayout.MarginBottom, Measure, pmPixels, - False); - HeaderPels := ConvertMeasure(PageLayout.HeaderHeight, Measure, pmPixels, - False); - FooterPels := ConvertMeasure(PageLayout.FooterHeight, Measure, pmPixels, - False); + TopMarginPels := ConvertMeasure(PageLayout.MarginTop, Measure, pmPixels, False); + BottomMarginPels := ConvertMeasure(PageLayout.MarginBottom, Measure, pmPixels, False); + HeaderPels := ConvertMeasure(PageLayout.HeaderHeight, Measure, pmPixels, False); + FooterPels := ConvertMeasure(PageLayout.FooterHeight, Measure, pmPixels, False); Result := PhysHeight - TopMarginPels - BottomMarginPels - HeaderPels - FooterPels; Modified: trunk/jvcl/run/JvTFMonths.pas =================================================================== --- trunk/jvcl/run/JvTFMonths.pas 2008-10-20 16:13:40 UTC (rev 11974) +++ trunk/jvcl/run/JvTFMonths.pas 2008-10-23 19:24:05 UTC (rev 11975) @@ -54,6 +54,8 @@ FOffDayCellAttr: TJvTFGlanceCellAttr; FScrollSize: TJvTFMonthsScrollSize; FSplitSatSun: Boolean; + FDayFormat: string; + FFirstDayOfMonthFormat: string; function GetMonth: Word; procedure SetMonth(Value: Word); function GetYear: Word; @@ -65,6 +67,8 @@ procedure SetExtraDayCellAttr(Value: TJvTFGlanceCellAttr); procedure SetOffDayCellAttr(Value: TJvTFGlanceCellAttr); procedure SetSplitSatSun(Value: Boolean); + procedure SetDayFormat(const Value: string); + procedure SetFirstDayOfMonthFormat(const Value: string); protected procedure SetStartOfWeek(Value: TTFDayOfWeek); override; procedure SetColCount(Value: Integer); override; @@ -105,6 +109,8 @@ property OnUpdateTitle: TJvTFUpdateTitleEvent read FOnUpdateTitle write FOnUpdateTitle; property StartOfWeek; property ColCount; + property FirstDayOfMonthFormat: string read FFirstDayOfMonthFormat write SetFirstDayOfMonthFormat; + property DayFormat: string read FDayFormat write SetDayFormat; // property Navigator; // property OnNavigate; end; @@ -149,6 +155,9 @@ FExtraDayCellAttr.TitleAttr.Color := clWhite; FOffDayCellAttr.TitleAttr.Color := clWhite; + FDayFormat := 'd'; + FFirstDayOfMonthFormat := 'mmm d'; + FDWTitleAttr := TJvTFGlanceTitle.Create(Self); with FDWTitleAttr do begin @@ -392,11 +401,10 @@ function TJvTFMonths.GetCellTitleText(Cell: TJvTFGlanceCell): string; begin - if CellIsExtraDay(Cell) and (IsFirstOfMonth(Cell.CellDate) or - EqualDates(Cell.CellDate, OriginDate)) then - Result := FormatDateTime('mmm d', Cell.CellDate) + if CellIsExtraDay(Cell) and (IsFirstOfMonth(Cell.CellDate) or EqualDates(Cell.CellDate, OriginDate)) then + Result := FormatDateTime(FirstDayOfMonthFormat, Cell.CellDate) else - Result := FormatDateTime('d', Cell.CellDate); + Result := FormatDateTime(DayFormat, Cell.CellDate); end; function TJvTFMonths.GetDataTop: Integer; @@ -482,6 +490,15 @@ inherited SetColCount(Value); end; +procedure TJvTFMonths.SetDayFormat(const Value: string); +begin + if Value <> FDayFormat then + begin + FDayFormat := Value; + Invalidate; + end; +end; + procedure TJvTFMonths.SetDisplayDate(Value: TDate); begin FDisplayDate := Value; @@ -507,6 +524,15 @@ FExtraDayCellAttr.Assign(Value); end; +procedure TJvTFMonths.SetFirstDayOfMonthFormat(const Value: string); +begin + if Value <> FFirstDayOfMonthFormat then + begin + FFirstDayOfMonthFormat := Value; + Invalidate; + end; +end; + procedure TJvTFMonths.SetMonth(Value: Word); var Y, M, D: Word; @@ -610,4 +636,3 @@ {$ENDIF USEJVCL} end. - Modified: trunk/jvcl/run/JvTFWeeks.pas =================================================================== --- trunk/jvcl/run/JvTFWeeks.pas 2008-10-20 16:13:40 UTC (rev 11974) +++ trunk/jvcl/run/JvTFWeeks.pas 2008-10-23 19:24:05 UTC (rev 11975) @@ -377,7 +377,10 @@ begin if WeekCount = 1 then Result := DWNames.GetDWName(DayOfWeek(Cell.CellDate)) + ', '; - Result := Result + FormatDateTime('mmm d', Cell.CellDate); + if DateFormat = '' then + Result := Result + FormatDateTime('mmm d', Cell.CellDate) + else + Result := Result + FormatDateTime(DateFormat, Cell.CellDate); end else Result := FormatDateTime(DateFormat, Cell.CellDate); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |