From c1d3789b4f3674299a6c5bd6462fe362ad60d892 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 19 Sep 2022 21:42:45 +0000 Subject: [PATCH] tvplanit: Add WeekStartsOn property to TVpGanttView. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8493 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpganttview.pas | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/components/tvplanit/source/vpganttview.pas b/components/tvplanit/source/vpganttview.pas index e20e01030..608f96b0d 100644 --- a/components/tvplanit/source/vpganttview.pas +++ b/components/tvplanit/source/vpganttview.pas @@ -18,7 +18,7 @@ type TVpGanttSpecialDayMode = (sdmColumn, sdmHeader); const - DEFAULT_GANTTVIEWOPTIONS = [ + DEFAULT_GANTTVIEW_OPTIONS = [ gvoActiveDate, gvoHorizGrid, gvoVertGrid, gvoWeekends, gvoHolidays ]; @@ -134,6 +134,7 @@ type FOptions: TVpGanttViewOptions; FSpecialDayMode: TVpGanttSpecialDayMode; FTimeFormat: TVpTimeFormat; + FWeekStartsOn: TVpDayType; FOnAddEvent: TVpOnAddNewEvent; FOnDeletingEvent: TVpOnDeletingEvent; @@ -168,6 +169,7 @@ type procedure SetTextMargin(AValue: Integer); procedure SetTopRow(AValue: Integer); procedure SetWeekendColor(AValue: TColor); + procedure SetWeekStartsOn(Value: TVpDayType); protected // Needed by the painter @@ -317,13 +319,14 @@ type property LineColor: TColor read FLineColor write SetLineColor default DEFAULT_LINECOLOR; property MonthFormat: String index 1 read GetDateFormat write SetDateFormat stored IsStoredDateFormat; property MonthFormat_short: String index 2 read GetDateFormat write SetDateFormat stored IsStoredDateFormat; - property Options: TVpGanttViewOptions read FOptions write SetOptions default DEFAULT_GANTTVIEWOPTIONS; + property Options: TVpGanttViewOptions read FOptions write SetOptions default DEFAULT_GANTTVIEW_OPTIONS; property PopupMenu: TPopupMenu read GetPopupMenu write SetPopupMenu; property RowHeaderAttributes: TVpGanttRowHeaderAttributes read FRowHeaderAttributes write FRowHeaderAttributes; property SpecialDayMode: TVpGanttSpecialDayMode read FSpecialDayMode write SetSpecialDayMode default sdmColumn; property TextMargin: Integer read FTextMargin write SetTextMargin default 2; property TimeFormat: TVpTimeFormat read FTimeFormat write FTimeFormat default tf12Hour; property WeekendColor: TColor read FWeekendColor write SetWeekendColor default WEEKEND_COLOR; + property WeekStartsOn: TVpDayType read FWeekStartsOn write SetWeekStartsOn default dtSunday; // inherited events property OnClick; // new events @@ -467,9 +470,9 @@ begin FDateFormat[1] := DEFAULT_MONTHFORMAT; FDateFormat[2] := DEFAULT_MONTHFORMAT_SHORT; FDrawingStyle := ds3d; + FOptions := DEFAULT_GANTTVIEW_OPTIONS; FScrollBars := ssBoth; - - FOptions := DEFAULT_GANTTVIEWOPTIONS; + FWeekStartsOn := dtSunday; // Popup menu FDefaultPopup := TPopupMenu.Create(Self); @@ -1710,6 +1713,14 @@ begin end; end; +procedure TVpGanttView.SetWeekStartsOn(Value: TVpDayType); +begin + if FWeekStartsOn <> Value then begin + FWeekStartsOn := Value; + Invalidate; + end; +end; + procedure TVpGanttView.SpawnEventEditDialog(IsNewEvent: Boolean); var AllowIt: Boolean;