From 35e35ca54408d813a010d5e5a4d140df56b7a7ee Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 11 Oct 2022 15:24:15 +0000 Subject: [PATCH] tvplanit: Fix operation of navigation buttons in Preview dialog for weekview. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8533 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/examples/fulldemo/demomain.lfm | 46 ++++++++++++++----- .../tvplanit/examples/fulldemo/demomain.lrj | 4 +- .../tvplanit/examples/fulldemo/demomain.pas | 6 ++- components/tvplanit/source/vpprtfmt.pas | 6 ++- components/tvplanit/source/vpprtprv.pas | 1 + 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/components/tvplanit/examples/fulldemo/demomain.lfm b/components/tvplanit/examples/fulldemo/demomain.lfm index 3b2a17e7c..4495c07e7 100644 --- a/components/tvplanit/examples/fulldemo/demomain.lfm +++ b/components/tvplanit/examples/fulldemo/demomain.lfm @@ -347,9 +347,12 @@ object MainForm: TMainForm Width = 834 PopupMenu = VpTaskList1.default ControlLink = VpControlLink1 + Font.Height = -12 + ParentFont = False Align = alClient TabOrder = 1 DrawingStyle = dsFlat + TaskHeadAttributes.Font.Height = -12 TaskHeadAttributes.Font.Style = [fsItalic] end end @@ -831,7 +834,7 @@ object MainForm: TMainForm Top = 0 Width = 100 end> - FormatName = 'Events of current week (dayview)' + FormatName = 'Events of current week (Day view)' end item Version = 'v1.0.7' @@ -890,6 +893,25 @@ object MainForm: TMainForm Width = 100 end> FormatName = 'Tasks of current week (landscape)' + end + item + Version = 'v1.0.7' + DayInc = 1 + DayIncUnits = duWeek + Elements = < + item + Version = 'v1.0.7' + DayOffset = 0 + DayOffsetUnits = duDay + ElementName = 'WeekView' + Height = 100 + ItemType = itWeekView + Left = 0 + Shape.Shape = ustRectangle + Top = 0 + Width = 100 + end> + FormatName = 'Events of current and next week (Week view)' end> Printer.RightMargin = 5 Printer.TopMargin = 5 @@ -1269,17 +1291,6 @@ object MainForm: TMainForm Top = 296 object MenuItem1: TMenuItem Caption = 'File' - object MnuEditPrintFormats: TMenuItem - Caption = 'Edit print formats...' - OnClick = MnuEditPrintFormatsClick - end - object MnuLoadPrintFormats: TMenuItem - Caption = 'Load print formats...' - OnClick = MnuLoadPrintFormatsClick - end - object MenuItem4: TMenuItem - Caption = '-' - end object MnuPrintPreview: TMenuItem Caption = 'Print preview...' OnClick = MnuPrintPreviewClick @@ -1288,6 +1299,17 @@ object MainForm: TMainForm Caption = 'Print...' OnClick = MnuPrintClick end + object MenuItem4: TMenuItem + Caption = '-' + end + object MnuEditPrintFormats: TMenuItem + Caption = 'Edit print formats...' + OnClick = MnuEditPrintFormatsClick + end + object MnuLoadPrintFormats: TMenuItem + Caption = 'Load print formats...' + OnClick = MnuLoadPrintFormatsClick + end object MenuItem3: TMenuItem Caption = '-' end diff --git a/components/tvplanit/examples/fulldemo/demomain.lrj b/components/tvplanit/examples/fulldemo/demomain.lrj index 46e7df308..e3f9cf609 100644 --- a/components/tvplanit/examples/fulldemo/demomain.lrj +++ b/components/tvplanit/examples/fulldemo/demomain.lrj @@ -23,10 +23,10 @@ {"hash":17060163,"name":"tmainform.cbshoweventhints.caption","sourcebytes":[83,104,111,119,32,101,118,101,110,116,32,97,110,100,32,99,111,110,116,97,99,116,32,104,105,110,116,115],"value":"Show event and contact hints"}, {"hash":245274983,"name":"tmainform.cbapplycategoryinfos.caption","sourcebytes":[65,112,112,108,121,32,99,97,116,101,103,111,114,121,32,99,111,108,111,114,115,32,116,111,32,119,101,101,107,32,97,110,100,32,109,111,110,116,104,32,118,105,101,119],"value":"Apply category colors to week and month view"}, {"hash":315429,"name":"tmainform.menuitem1.caption","sourcebytes":[70,105,108,101],"value":"File"}, -{"hash":109668078,"name":"tmainform.mnueditprintformats.caption","sourcebytes":[69,100,105,116,32,112,114,105,110,116,32,102,111,114,109,97,116,115,46,46,46],"value":"Edit print formats..."}, -{"hash":25869902,"name":"tmainform.mnuloadprintformats.caption","sourcebytes":[76,111,97,100,32,112,114,105,110,116,32,102,111,114,109,97,116,115,46,46,46],"value":"Load print formats..."}, {"hash":161391310,"name":"tmainform.mnuprintpreview.caption","sourcebytes":[80,114,105,110,116,32,112,114,101,118,105,101,119,46,46,46],"value":"Print preview..."}, {"hash":151352958,"name":"tmainform.mnuprint.caption","sourcebytes":[80,114,105,110,116,46,46,46],"value":"Print..."}, +{"hash":109668078,"name":"tmainform.mnueditprintformats.caption","sourcebytes":[69,100,105,116,32,112,114,105,110,116,32,102,111,114,109,97,116,115,46,46,46],"value":"Edit print formats..."}, +{"hash":25869902,"name":"tmainform.mnuloadprintformats.caption","sourcebytes":[76,111,97,100,32,112,114,105,110,116,32,102,111,114,109,97,116,115,46,46,46],"value":"Load print formats..."}, {"hash":363524,"name":"tmainform.mnuquit.caption","sourcebytes":[81,117,105,116],"value":"Quit"}, {"hash":184026309,"name":"tmainform.mnumaintenance.caption","sourcebytes":[77,97,105,110,116,101,110,97,110,99,101],"value":"Maintenance"}, {"hash":174903555,"name":"tmainform.mnuresources.caption","sourcebytes":[82,101,115,111,117,114,99,101,115],"value":"Resources"}, diff --git a/components/tvplanit/examples/fulldemo/demomain.pas b/components/tvplanit/examples/fulldemo/demomain.pas index e8627d256..e0310fe74 100644 --- a/components/tvplanit/examples/fulldemo/demomain.pas +++ b/components/tvplanit/examples/fulldemo/demomain.pas @@ -786,7 +786,11 @@ begin t1 := StartOfTheWeek(now); t2 := t1; // it all fits on one single page end; - 2: begin // Tasks of current week + 2: begin // events of current and next week in WeekView + t1 := StartOfTheWeek(now); + t2 := t1 + 7; + end; + 3: begin // Tasks of current week t1 := StartOfTheWeek(now); t2 := t1; end; diff --git a/components/tvplanit/source/vpprtfmt.pas b/components/tvplanit/source/vpprtfmt.pas index 7b4aff973..41c751d60 100644 --- a/components/tvplanit/source/vpprtfmt.pas +++ b/components/tvplanit/source/vpprtfmt.pas @@ -1483,7 +1483,7 @@ var Scale: Extended; StartLine: Integer; EndLine: Integer; - oldGanttStartDate, oldGanttEndDate: TDateTime; + oldGanttStartDate: TDateTime; procedure GetMeasurements; begin @@ -1662,6 +1662,8 @@ var Granularity, True ); + if Element.ItemType = itWeekView then + FPrintFormats.Items[CurFormat].DefaultDayInc := 7; end; case Element.ItemType of @@ -2045,7 +2047,7 @@ begin StartContact := FLastContact; LastPage := True; - if FHaveDate and (ADate < EndDate) then + if FHaveDate and (ADate <= EndDate) then // wp: I consider the end date to be inclusive LastPage := False; if FHaveTaskList and (FLastTask >= 0) then LastPage := False; diff --git a/components/tvplanit/source/vpprtprv.pas b/components/tvplanit/source/vpprtprv.pas index bf281e6b3..5c87dc5f6 100644 --- a/components/tvplanit/source/vpprtprv.pas +++ b/components/tvplanit/source/vpprtprv.pas @@ -1112,6 +1112,7 @@ begin if v <> FZoomFactor then begin FZoomFactor := v; ClearPageData; + GeneratePageImage; SetScrollBars; Invalidate; end;