tvplanit: New property ApplyCategoryInfos for week and month view. Some tweaking of text positions in month view.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8346 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-07-12 14:31:42 +00:00
parent cf88b7c792
commit 2e2d9f18bf
14 changed files with 133 additions and 39 deletions

View File

@ -19,7 +19,7 @@ object MainForm: TMainForm
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 596 ClientHeight = 596
ClientWidth = 834 ClientWidth = 834
TabOrder = 0 TabOrder = 2
object HeaderPanel: TPanel object HeaderPanel: TPanel
Left = 2 Left = 2
Height = 48 Height = 48
@ -58,7 +58,7 @@ object MainForm: TMainForm
Height = 548 Height = 548
Top = 48 Top = 48
Width = 834 Width = 834
PageIndex = 0 PageIndex = 4
Align = alClient Align = alClient
TabOrder = 1 TabOrder = 1
TabStop = True TabStop = True
@ -740,6 +740,18 @@ object MainForm: TMainForm
State = cbChecked State = cbChecked
TabOrder = 8 TabOrder = 8
end end
object CbApplyCategoryInfos: TCheckBox
AnchorSideLeft.Control = CbAllowInplaceEditing
AnchorSideTop.Control = CbDrawingStyle
AnchorSideTop.Side = asrCenter
Left = 316
Height = 19
Top = 178
Width = 266
Caption = 'Apply category colors to week and month view'
OnChange = CbApplyCategoryInfosChange
TabOrder = 9
end
end end
end end
end end

View File

@ -21,6 +21,7 @@
{"hash":248087155,"name":"tmainform.cballowdraganddrop.caption","sourcebytes":[65,108,108,111,119,32,100,114,97,103,32,97,110,100,32,100,114,111,112,32,111,102,32,101,118,101,110,116,115],"value":"Allow drag and drop of events"}, {"hash":248087155,"name":"tmainform.cballowdraganddrop.caption","sourcebytes":[65,108,108,111,119,32,100,114,97,103,32,97,110,100,32,100,114,111,112,32,111,102,32,101,118,101,110,116,115],"value":"Allow drag and drop of events"},
{"hash":216343376,"name":"tmainform.cbdragdroptransparent.caption","sourcebytes":[84,114,97,110,115,112,97,114,101,110,116,32,100,114,97,103,32,97,110,100,32,100,114,111,112],"value":"Transparent drag and drop"}, {"hash":216343376,"name":"tmainform.cbdragdroptransparent.caption","sourcebytes":[84,114,97,110,115,112,97,114,101,110,116,32,100,114,97,103,32,97,110,100,32,100,114,111,112],"value":"Transparent drag and drop"},
{"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":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":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":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":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..."},

View File

@ -32,6 +32,7 @@ type
CbAllowDragAndDrop: TCheckBox; CbAllowDragAndDrop: TCheckBox;
CbDragDropTransparent: TCheckBox; CbDragDropTransparent: TCheckBox;
CbShowEventHints: TCheckBox; CbShowEventHints: TCheckBox;
CbApplyCategoryInfos: TCheckBox;
lblOtherResources: TLabel; lblOtherResources: TLabel;
lblResources: TLabel; lblResources: TLabel;
lbOtherResources: TCheckListBox; lbOtherResources: TCheckListBox;
@ -97,6 +98,7 @@ type
procedure CbAddressBuilderChange(Sender: TObject); procedure CbAddressBuilderChange(Sender: TObject);
procedure CbAllowDragAndDropChange(Sender: TObject); procedure CbAllowDragAndDropChange(Sender: TObject);
procedure CbAllowInplaceEditingChange(Sender: TObject); procedure CbAllowInplaceEditingChange(Sender: TObject);
procedure CbApplyCategoryInfosChange(Sender: TObject);
procedure CbDragDropTransparentChange(Sender: TObject); procedure CbDragDropTransparentChange(Sender: TObject);
procedure CbDrawingStyleChange(Sender: TObject); procedure CbDrawingStyleChange(Sender: TObject);
procedure CbFirstDayOfWeekChange(Sender: TObject); procedure CbFirstDayOfWeekChange(Sender: TObject);
@ -414,6 +416,12 @@ begin
VpTaskList1.AllowInplaceEditing := CbAllowInplaceEditing.Checked; VpTaskList1.AllowInplaceEditing := CbAllowInplaceEditing.Checked;
end; end;
procedure TMainForm.CbApplyCategoryInfosChange(Sender: TObject);
begin
VpWeekView1.ApplyCategoryInfos := CbApplyCategoryInfos.Checked;
VpMonthView1.ApplyCategoryInfos := CbApplyCategoryInfos.Checked;
end;
procedure TMainForm.CbDragDropTransparentChange(Sender: TObject); procedure TMainForm.CbDragDropTransparentChange(Sender: TObject);
begin begin
VpDayView1.DragDropTransparent := CbDragDropTransparent.Checked; VpDayView1.DragDropTransparent := CbDragDropTransparent.Checked;
@ -886,6 +894,10 @@ begin
CbShowEventHints.Checked); CbShowEventHints.Checked);
CbShowEventHintsChange(nil); CbShowEventHintsChange(nil);
CbApplyCategoryInfos.Checked := ini.ReadBool('Settings', 'ApplyCategoryInfos',
CbApplyCategoryInfos.Checked);
CbApplyCategoryInfosChange(nil);
FResID := ini.ReadInteger('Data', 'ResourceID', -1); FResID := ini.ReadInteger('Data', 'ResourceID', -1);
finally finally
ini.Free; ini.Free;
@ -940,6 +952,7 @@ begin
ini.WriteBool('Settings', 'AllowDragAndDrop', CbAllowDragAndDrop.Checked); ini.WriteBool('Settings', 'AllowDragAndDrop', CbAllowDragAndDrop.Checked);
ini.WriteBool('Settings', 'DragAndDropTransparent', CbDragDropTransparent.Checked); ini.WriteBool('Settings', 'DragAndDropTransparent', CbDragDropTransparent.Checked);
ini.WriteBool('Settings', 'ShowEventHints', CbShowEventHints.Checked); ini.WriteBool('Settings', 'ShowEventHints', CbShowEventHints.Checked);
ini.WriteBool('Settings', 'ApplyCategoryInfos', CbApplyCategoryInfos.Checked);
ini.WriteInteger('Data', 'ResourceID', VpControlLink1.Datastore.ResourceID); ini.WriteInteger('Data', 'ResourceID', VpControlLink1.Datastore.ResourceID);
finally finally

View File

@ -170,6 +170,10 @@ msgstr "Drag-and-Drop von Terminen erlauben"
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "Bearbeiten im Planer erlauben" msgstr "Bearbeiten im Planer erlauben"
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr "Kategorie-Farben in Wochen- und Monatsansicht verwenden"
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "Transparenter Hintergrund beim Drag-and-Drop" msgstr "Transparenter Hintergrund beim Drag-and-Drop"
@ -278,4 +282,3 @@ msgstr "Erledigte Aufgaben verbergen"
#: tmainform.titlelbl.caption #: tmainform.titlelbl.caption
msgid "TitleLbl" msgid "TitleLbl"
msgstr "" msgstr ""

View File

@ -9,7 +9,7 @@ msgstr ""
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.0.1\n" "X-Generator: Poedit 3.1\n"
#: demomain.rs10min #: demomain.rs10min
msgid "10 min" msgid "10 min"
@ -167,6 +167,10 @@ msgstr "Allow drag and drop of events"
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "Allow inplace editing" msgstr "Allow inplace editing"
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr "Apply category colors to week and month view"
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "Transparent drag and drop" msgstr "Transparent drag and drop"
@ -275,4 +279,3 @@ msgstr "Hide completed tasks"
#: tmainform.titlelbl.caption #: tmainform.titlelbl.caption
msgid "TitleLbl" msgid "TitleLbl"
msgstr "TitleLbl" msgstr "TitleLbl"

View File

@ -160,6 +160,10 @@ msgstr ""
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "" msgstr ""
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr ""
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "" msgstr ""

View File

@ -159,6 +159,10 @@ msgstr ""
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "" msgstr ""
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr ""
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "" msgstr ""

View File

@ -170,6 +170,10 @@ msgstr "Pozwól na drag and drop wydarzeń"
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "Pozwól na bezpośrednią edycję" msgstr "Pozwól na bezpośrednią edycję"
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr ""
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "Przeźroczyste tło podczas drag and drop" msgstr "Przeźroczyste tło podczas drag and drop"

View File

@ -157,6 +157,10 @@ msgstr ""
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "" msgstr ""
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr ""
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "" msgstr ""

View File

@ -169,6 +169,10 @@ msgstr ""
msgid "Allow inplace editing" msgid "Allow inplace editing"
msgstr "" msgstr ""
#: tmainform.cbapplycategoryinfos.caption
msgid "Apply category colors to week and month view"
msgstr ""
#: tmainform.cbdragdroptransparent.caption #: tmainform.cbdragdroptransparent.caption
msgid "Transparent drag and drop" msgid "Transparent drag and drop"
msgstr "" msgstr ""

View File

@ -146,6 +146,8 @@ type
FOnHoliday: TVpHolidayEvent; FOnHoliday: TVpHolidayEvent;
FAllowDragAndDrop: Boolean; FAllowDragAndDrop: Boolean;
FDragDropTransparent: Boolean; FDragDropTransparent: Boolean;
FApplyCategoryInfos: Boolean;
procedure SetApplyCategoryInfos(AValue: Boolean);
protected{ private } protected{ private }
FKBNavigate: Boolean; FKBNavigate: Boolean;
FColumnWidth: Integer; FColumnWidth: Integer;
@ -314,6 +316,7 @@ type
property TabStop; property TabStop;
property TabOrder; property TabOrder;
property AllowDragAndDrop: Boolean read FAllowDragAndDrop write FAllowDragAndDrop default false; property AllowDragAndDrop: Boolean read FAllowDragAndDrop write FAllowDragAndDrop default false;
property ApplyCategoryInfos: Boolean read FApplyCategoryInfos write SetApplyCategoryInfos default false;
property Color: TColor read FColor write SetColor; property Color: TColor read FColor write SetColor;
property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat; property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat;
property DayHeadAttributes: TVpMonthviewAttr read FDayHeadAttr write FDayHeadAttr; property DayHeadAttributes: TVpMonthviewAttr read FDayHeadAttr write FDayHeadAttr;
@ -765,7 +768,15 @@ begin
Date := EncodeDate(Y, M, D); Date := EncodeDate(Y, M, D);
end; end;
{=====}
procedure TVpMonthView.SetApplyCategoryInfos(AValue: Boolean);
begin
if FApplyCategoryInfos <> AValue then
begin
FApplyCategoryInfos := AValue;
Invalidate;
end;
end;
procedure TVpMonthView.SetColor(Value: TColor); procedure TVpMonthView.SetColor(Value: TColor);
begin begin
@ -774,25 +785,22 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetDrawingStyle(Value: TVpDrawingStyle); procedure TVpMonthView.SetDrawingStyle(Value: TVpDrawingStyle);
begin begin
if FDrawingStyle <> Value then begin if FDrawingStyle <> Value then begin
FDrawingStyle := Value; FDrawingStyle := Value;
Repaint; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetLineColor(Value: TColor); procedure TVpMonthView.SetLineColor(Value: TColor);
begin begin
if FLineColor <> Value then begin if FLineColor <> Value then begin
FLineColor := Value; FLineColor := Value;
Repaint; Invalidate
end; end;
end; end;
{=====}
procedure TVpMonthView.SetOffDayColor(Value: TColor); procedure TVpMonthView.SetOffDayColor(Value: TColor);
begin begin
@ -801,14 +809,12 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetOffDayFontColor(Value: TColor); procedure TVpMonthView.SetOffDayFontColor(Value: TColor);
begin begin
FOffDayFontColor := Value; FOffDayFontColor := Value;
Invalidate; Invalidate;
end; end;
{=====}
procedure TVpMonthView.SetDateLabelFormat(Value: string); procedure TVpMonthView.SetDateLabelFormat(Value: string);
begin begin
@ -817,7 +823,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetShowEvents(Value: Boolean); procedure TVpMonthView.SetShowEvents(Value: Boolean);
begin begin
@ -826,7 +831,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetEventDayStyle(Value: TFontStyles); procedure TVpMonthView.SetEventDayStyle(Value: TFontStyles);
begin begin
@ -835,7 +839,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetDayNameStyle(Value: TVpMVDayNameStyle); procedure TVpMonthView.SetDayNameStyle(Value: TVpMVDayNameStyle);
begin begin
@ -844,21 +847,18 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetDayNumberFont(Value: TVpFont); procedure TVpMonthView.SetDayNumberFont(Value: TVpFont);
begin begin
FDayNumberFont.Assign(Value); FDayNumberFont.Assign(Value);
Invalidate; Invalidate;
end; end;
{=====}
procedure TVpMonthView.SetEventFont(Value: TVpFont); procedure TVpMonthView.SetEventFont(Value: TVpFont);
begin begin
FEventFont.Assign(Value); FEventFont.Assign(Value);
Invalidate; Invalidate;
end; end;
{=====}
procedure TVpMonthView.SetSelectedDayColor(Value: TColor); procedure TVpMonthView.SetSelectedDayColor(Value: TColor);
begin begin
@ -867,7 +867,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetShowEventTime(Value: Boolean); procedure TVpMonthView.SetShowEventTime(Value: Boolean);
begin begin
@ -876,7 +875,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetTimeFormat(Value: TVpTimeFormat); procedure TVpMonthView.SetTimeFormat(Value: TVpTimeFormat);
begin begin
@ -885,7 +883,6 @@ begin
Invalidate; Invalidate;
end; end;
end; end;
{=====}
procedure TVpMonthView.SetDate(Value: TDateTime); procedure TVpMonthView.SetDate(Value: TDateTime);
begin begin
@ -903,7 +900,6 @@ begin
ControlLink.Notify(self, neDateChange, FDate); ControlLink.Notify(self, neDateChange, FDate);
end; end;
end; end;
{=====}
{$IFNDEF LCL} {$IFNDEF LCL}
procedure TVpMonthView.WMSize(var Msg: TWMSize); procedure TVpMonthView.WMSize(var Msg: TWMSize);

View File

@ -12,6 +12,7 @@ type
TVpMonthViewPainter = class(TVpBasePainter) TVpMonthViewPainter = class(TVpBasePainter)
private private
FMonthView: TVpMonthView; FMonthView: TVpMonthView;
// local parameters of the old TVpMonthView method // local parameters of the old TVpMonthView method
DisplayDate: TDateTime; DisplayDate: TDateTime;
DisplayMonth: Word; DisplayMonth: Word;
@ -31,7 +32,7 @@ type
DotDotDotColor: TColor; DotDotDotColor: TColor;
FCurrHoliday: String; FCurrHoliday: String;
// protected variables of the original monthview needed only for painting // These variables were protected in the original monthview, but are needed only for painting
mvEventTextHeight: Integer; mvEventTextHeight: Integer;
mvDayNumberHeight: Integer; mvDayNumberHeight: Integer;
mvRowHeight: Integer; mvRowHeight: Integer;
@ -221,7 +222,7 @@ begin
if ACol = 6 then if ACol = 6 then
tmpRect.Left := ATextRect.Left + mvColWidth - TextAdjust - TextMargin tmpRect.Left := ATextRect.Left + mvColWidth - TextAdjust - TextMargin
else else
tmpRect.Left := ATextRect.Right - TextAdjust - TextMargin; tmpRect.Left := ATextRect.Right - TextAdjust - TextMargin + 2;
if fsItalic in RenderCanvas.Font.Style then if fsItalic in RenderCanvas.Font.Style then
dec(tmpRect.Left, 2); dec(tmpRect.Left, 2);
tmpRect.Top := ATextRect.Top + TextMargin div 2; tmpRect.Top := ATextRect.Top + TextMargin div 2;
@ -230,6 +231,7 @@ begin
{ Highlight today by a border } { Highlight today by a border }
if ADate = todayDate then begin if ADate = todayDate then begin
OffsetRect(tmpRect, 2, 0);
InflateRect(tmpRect, 3, 3); InflateRect(tmpRect, 3, 3);
RenderCanvas.Pen.Assign(FMonthView.TodayAttributes.BorderPen); RenderCanvas.Pen.Assign(FMonthView.TodayAttributes.BorderPen);
RenderCanvas.Brush.Color := FMonthView.TodayAttributes.Color; RenderCanvas.Brush.Color := FMonthView.TodayAttributes.Color;
@ -449,7 +451,7 @@ begin
for Col := 0 to 6 do begin for Col := 0 to 6 do begin
ThisDate := Trunc(StartingDate + DayNumber); ThisDate := Trunc(StartingDate + DayNumber);
{ Check and store if the this date is a holiday } { Check and store if this date is a holiday }
FMonthView.IsHoliday(ThisDate, FCurrHoliday); FMonthView.IsHoliday(ThisDate, FCurrHoliday);
OldBrush.Assign(RenderCanvas.Brush); OldBrush.Assign(RenderCanvas.Brush);
@ -490,12 +492,16 @@ procedure TVpMonthViewPainter.DrawEvents;
var var
I, J: Integer; I, J: Integer;
EventList: TList; EventList: TList;
event: TVpEvent;
eventCat: TVpCategoryInfo;
dayRect: TRect; dayRect: TRect;
TextRect: TRect; TextRect: TRect;
tmpRect: TRect;
Str: String; Str: String;
StrLen: Integer; StrLen: Integer;
P: TPoint; P: TPoint;
visibleEvents: Integer; visibleEvents: Integer;
brushCol: TColor;
begin begin
RenderCanvas.Pen.Color := RealLineColor; RenderCanvas.Pen.Color := RealLineColor;
RenderCanvas.Pen.Style := psSolid; RenderCanvas.Pen.Style := psSolid;
@ -518,19 +524,21 @@ begin
dayRect := TVpMonthViewOpener(FMonthView).mvMonthDayArray[I].Rec; dayRect := TVpMonthViewOpener(FMonthView).mvMonthDayArray[I].Rec;
{ initialize TextRect for this day } { initialize TextRect for this day }
TextRect.TopLeft := Point(dayRect.Left, dayRect.Top); TextRect.TopLeft := Point(dayRect.Left+1, dayRect.Top+1);
TextRect.BottomRight := Point( TextRect.BottomRight := Point(
TextRect.Left + mvColWidth, TextRect.Left + mvColWidth,
TextRect.Top + mvEventTextHeight + TextMargin div 2 TextRect.Top + mvEventTextHeight + TextMargin// div 2
); );
{ set canvas color } { set canvas color }
if TVpMonthViewOpener(FMonthView).mvMonthDayArray[I].OffDay if TVpMonthViewOpener(FMonthView).mvMonthDayArray[I].OffDay then
then RenderCanvas.Brush.Color := RealOffDayColor RenderCanvas.Brush.Color := RealOffDayColor
else RenderCanvas.Brush.Color := RealColor; else
RenderCanvas.Brush.Color := RealColor;
{ spin through the events and paint them } { spin through the events and paint them }
for J := 0 to Pred(EventList.Count) do begin for J := 0 to Pred(EventList.Count) do begin
event := TVpEvent(EventList[j]);
if (TextRect.Bottom > dayRect.Bottom) and (J <= Pred(EventList.Count)) then if (TextRect.Bottom > dayRect.Bottom) and (J <= Pred(EventList.Count)) then
begin begin
{ draw a little red square with a (...) at the bottom right } { draw a little red square with a (...) at the bottom right }
@ -544,12 +552,26 @@ begin
{ to give the day number enough room } { to give the day number enough room }
if (TextRect.Top < dayRect.Top + mvDayNumberHeight + TextMargin div 2) if (TextRect.Top < dayRect.Top + mvDayNumberHeight + TextMargin div 2)
then then
TextRect.Right := TextRect.Left + mvColWidth - mvDayNumberHeight - TextMargin TextRect.Right := TextRect.Left + mvColWidth - mvDayNumberHeight - TextMargin * 2
else else
TextRect.Right := TextRect.Left + mvColWidth; TextRect.Right := TextRect.Left + mvColWidth - 3;
if Assigned(FMonthView.Datastore) and FMonthView.ApplyCategoryInfos then
begin
brushCol := RenderCanvas.Brush.Color;
eventCat := FMonthView.Datastore.CategoryColorMap.GetCategory(event.Category);
if Assigned(eventCat) then
begin
tmpRect := TextRect;
InflateRect(tmpRect, -1, -1);
RenderCanvas.Brush.Color := eventCat.BackgroundColor;
TPSFillRect(RenderCanvas, Angle, RenderIn, tmpRect);
end;
RenderCanvas.Brush.Color := brushCol;
end;
{ Construct the display text } { Construct the display text }
Str := FMonthView.BuildEventString(TVpEvent(EventList[j]), FMonthView.ShowEventTime, true); Str := FMonthView.BuildEventString(event, FMonthView.ShowEventTime, true);
{ set the event font } { set the event font }
RenderCanvas.Font.Assign(FMonthView.EventFont); RenderCanvas.Font.Assign(FMonthView.EventFont);
@ -590,12 +612,14 @@ procedure TVpMonthViewPainter.DrawFocusRect(ARect: TRect; FixRight: Boolean = fa
var var
tmpRect: TRect; tmpRect: TRect;
begin begin
(*
tmpRect := ARect; tmpRect := ARect;
InflateRect(tmpRect, 2, 2); InflateRect(tmpRect, 2, 2);
TPSDrawFocusRect(RenderCanvas, Angle, RenderIn, tmpRect); TPSDrawFocusRect(RenderCanvas, Angle, RenderIn, tmpRect);
*)
tmpRect := ARect; tmpRect := ARect;
InflateRect(tmpRect, -2, -2); // InflateRect(tmpRect, -2, -2);
InflateRect(tmpRect, -1, -1);
if FixRight then if FixRight then
inc(tmpRect.Right); inc(tmpRect.Right);
TPSDrawFocusRect(RenderCanvas, Angle, RenderIn, tmpRect); TPSDrawFocusRect(RenderCanvas, Angle, RenderIn, tmpRect);
@ -653,7 +677,7 @@ begin
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI); RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
{$ENDIF} {$ENDIF}
if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RealWidth) then if DisplayOnly and (RenderCanvas.TextWidth(HeadStr) >= RealWidth) then
HeadTextRect.Left:= RealLeft + TextMargin * 2 HeadTextRect.Left := RealLeft + TextMargin * 2
else else
if DisplayOnly then if DisplayOnly then
HeadTextRect.Left := RealLeft + (RealWidth - RenderCanvas.TextWidth(HeadStr)) div 2 HeadTextRect.Left := RealLeft + (RealWidth - RenderCanvas.TextWidth(HeadStr)) div 2

View File

@ -132,6 +132,7 @@ type
FLayout: TVpWeekviewLayout; FLayout: TVpWeekviewLayout;
FOnHoliday: TVpHolidayEvent; FOnHoliday: TVpHolidayEvent;
procedure SetActiveEvent(AValue: TVpEvent); procedure SetActiveEvent(AValue: TVpEvent);
procedure SetApplyCategoryInfos(AValue: Boolean);
procedure SetLayout(AValue: TVpWeekviewLayout); procedure SetLayout(AValue: TVpWeekviewLayout);
protected{ private } protected{ private }
FActiveDate: TDateTime; FActiveDate: TDateTime;
@ -153,6 +154,7 @@ type
FAllDayEventAttr: TVpAllDayEventAttributes; FAllDayEventAttr: TVpAllDayEventAttributes;
FAllowInplaceEdit: Boolean; FAllowInplaceEdit: Boolean;
FAllowDragAndDrop: Boolean; FAllowDragAndDrop: Boolean;
FApplyCategoryInfos: Boolean;
FDragDropTransparent: Boolean; FDragDropTransparent: Boolean;
{ event variables } { event variables }
FBeforeEdit: TVpBeforeEditEvent; FBeforeEdit: TVpBeforeEditEvent;
@ -294,6 +296,7 @@ type
property AllDayEventAttributes: TVpAllDayEventAttributes read FAllDayEventAttr write FAllDayEventAttr; property AllDayEventAttributes: TVpAllDayEventAttributes read FAllDayEventAttr write FAllDayEventAttr;
property AllowDragAndDrop: Boolean read FAllowDragAndDrop write FAllowDragAndDrop default false; property AllowDragAndDrop: Boolean read FAllowDragAndDrop write FAllowDragAndDrop default false;
property AllowInplaceEditing: Boolean read FAllowInplaceEdit write FAllowInplaceEdit default true; property AllowInplaceEditing: Boolean read FAllowInplaceEdit write FAllowInplaceEdit default true;
property ApplyCategoryInfos: Boolean read FApplyCategoryInfos write SetApplyCategoryInfos default false;
property Color: TColor read FColor write SetColor; property Color: TColor read FColor write SetColor;
property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat; property DateLabelFormat: string read FDateLabelFormat write SetDateLabelFormat;
property DayHeadAttributes: TVpDayHeadAttr read FDayHeadAttributes write FDayHeadAttributes; property DayHeadAttributes: TVpDayHeadAttr read FDayHeadAttributes write FDayHeadAttributes;
@ -801,11 +804,20 @@ begin
FActiveEvent := AValue; FActiveEvent := AValue;
end; end;
procedure TVpWeekView.SetApplyCategoryInfos(AValue: Boolean);
begin
if FApplyCategoryInfos <> AValue then
begin
FApplyCategoryInfos := AValue;
Invalidate;
end;
end;
procedure TVpWeekView.SetDrawingStyle(Value: TVpDrawingStyle); procedure TVpWeekView.SetDrawingStyle(Value: TVpDrawingStyle);
begin begin
if FDrawingStyle <> Value then begin if FDrawingStyle <> Value then begin
FDrawingStyle := Value; FDrawingStyle := Value;
Repaint; Invalidate;
end; end;
end; end;
{=====} {=====}
@ -814,7 +826,7 @@ procedure TVpWeekView.SetLineColor(Value: TColor);
begin begin
if FLineColor <> Value then begin if FLineColor <> Value then begin
FLineColor := Value; FLineColor := Value;
Repaint; Invalidate;
end; end;
end; end;
{=====} {=====}

View File

@ -531,6 +531,7 @@ var
todayEndTime: TDateTime; todayEndTime: TDateTime;
strLen: Integer; strLen: Integer;
oldFontColor: TColor; oldFontColor: TColor;
eventCat: TVpCategoryInfo;
begin begin
oldFontColor := RenderCanvas.Font.Color; oldFontColor := RenderCanvas.Font.Color;
@ -554,6 +555,15 @@ begin
if AEvent.IsOverlayed then if AEvent.IsOverlayed then
RenderCanvas.Font.Color := clGray; RenderCanvas.Font.Color := clGray;
RenderCanvas.Brush.Color := RealColor; RenderCanvas.Brush.Color := RealColor;
if Assigned(FWeekView.Datastore) and FWeekView.ApplyCategoryInfos then
begin
eventCat := FWeekView.Datastore.CategoryColorMap.GetCategory(AEvent.Category);
if Assigned(eventCat) then
begin
RenderCanvas.Brush.Color := eventCat.BackgroundColor;
TPSFillRect(RenderCanvas, Angle, RenderIn, TextRect);
end;
end;
{ Build the event text } { Build the event text }
dayStr := FWeekView.BuildEventString(AEvent, todayStartTime, todayEndTime, false); dayStr := FWeekView.BuildEventString(AEvent, todayStartTime, todayEndTime, false);