You've already forked lazarus-ccr
tvplanit: Fix alarm and recurrance icons in DayView.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4830 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -112,40 +112,24 @@ object MainForm: TMainForm
|
||||
RowHeadAttributes.MinuteFont.Height = -12
|
||||
RowHeadAttributes.Color = clBtnFace
|
||||
IconAttributes.AlarmBitmap.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00000000000000
|
||||
0000000000000303030003030300020202000101010401010151000000660000
|
||||
004D0000000001010100010101020101010001010100FFFFFF00000000000000
|
||||
0000000000000303030003030300030303000202022F2F2F2F96EFDEDEFF0000
|
||||
00710000000001010100010101460101012301010100FFFFFF00000000000000
|
||||
000000000000030303070303031C0303034B2523238A989191E9E4D2D2FF0000
|
||||
0085000000000101010001010119010101870101011BFFFFFF00000000770000
|
||||
00ED000000ED040404893F3A3A9F7C7272C2CAB9B9F4A49B9BFFCFBDBDFF0808
|
||||
088A0505050001010149010101260101013201010170FFFFFF00000000DB2D2D
|
||||
2DF83C3C3CFFCBB9B9FFC7B5B5FFC2B0B0FFBCAAAAFF9B9292FFBEACACFF1212
|
||||
12860A0A0A0001010119010101800101010D01010187FFFFFF00010101C05C5C
|
||||
5CFF4E4E4EFFB1A7A7FFB0A5A5FFAFA3A3FFADA0A0FF9A9393FFB9AAAAFF2020
|
||||
20812020200001010100010101870101010001010187FFFFFF00010101AE5F5F
|
||||
5FEA7A7A7AFFCFCFCFFFCCCCCCFFC7C6C6FFC0BEBEFFA9A8A8FFC9C6C6FF2F2F
|
||||
2F791818180000000015000000700000000B00000075FFFFFF00010101560101
|
||||
01AB010101AB3E3E3E726C6C6C8C9A9A9AB6CFCFCFF2B6B6B6FFD2D2D2FF3E3E
|
||||
3E721F1F1F00000000370000001E0000002600000055FFFFFF00010101000101
|
||||
01000101010048484806484848184B4B4B3E65656578BDBDBDE6E3E3E3FF4B4B
|
||||
4B6C4B4B4B0000000000000000100000005B00000013FFFFFF00010101000101
|
||||
01000101010048484800484848004D4D4D00535353297676768BECECECFF5454
|
||||
546754545400000000000000002B0000001600000000FFFFFF00010101000101
|
||||
010001010100484848004848480051515100555555045555554D555555665555
|
||||
554D555555002B2B2B00000000000000000000000000FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
||||
F6000000424DF600000000000000760000002800000010000000100000000100
|
||||
0400000000008000000000000000000000000000000000000000000000000000
|
||||
80000080000000808000800000008000800080800000C0C0C000808080000000
|
||||
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00300130000031
|
||||
00333310009090001333330097F0F7900333380970FFF07908333099FF0FFFF9
|
||||
90333090FFF0FF0090333099FFF0FFF99033380970F0FF790833330097F0F790
|
||||
0333000009999900000307780000008778030777703030777803308770803077
|
||||
8033338003303300833333333300033333333333333333333333
|
||||
}
|
||||
IconAttributes.RecurringBitmap.Data = {
|
||||
F6000000424DF600000000000000760000002800000010000000100000000100
|
||||
04000000000080000000C40E0000C40E00001000000010000000000000000000
|
||||
8000008000000080800080000000800080008080000080808000C0C0C0000000
|
||||
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00888888888888
|
||||
8888888888888888888888888888888888888888888888888888888888888888
|
||||
8888888078888888888888708888800000888808888888000088880888888880
|
||||
0088880888888808008888708888708880888887000078888888888888888888
|
||||
8888888888888888888888888888888888888888888888888888
|
||||
}
|
||||
ShowResourceName = True
|
||||
LineColor = clGray
|
||||
@ -642,6 +626,7 @@ object MainForm: TMainForm
|
||||
top = 280
|
||||
end
|
||||
object VpBufDSDataStore1: TVpBufDSDataStore
|
||||
CategoryColorMap.Category0.BackgroundColor = clSkyBlue
|
||||
CategoryColorMap.Category0.Color = clNavy
|
||||
CategoryColorMap.Category0.Description = 'Category 0'
|
||||
CategoryColorMap.Category1.Color = clRed
|
||||
|
@ -190,7 +190,7 @@ type
|
||||
property Color: TColor read FColor write SetColor;
|
||||
end;
|
||||
|
||||
TVpDayViewIconAttributes = class (TPersistent)
|
||||
TVpDayViewIconAttributes = class(TPersistent)
|
||||
private
|
||||
FShowAlarmBitmap: Boolean;
|
||||
FShowCategoryBitmap: Boolean;
|
||||
@ -681,12 +681,12 @@ begin
|
||||
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
||||
|
||||
{ Create internal classes and stuff }
|
||||
FTimeSlotColors := TVpTimeSlotColor.Create (self);
|
||||
FHeadAttr := TVpCHAttributes.Create (self);
|
||||
FRowHeadAttr := TVpRHAttributes.Create (self);
|
||||
FTimeSlotColors := TVpTimeSlotColor.Create(self);
|
||||
FHeadAttr := TVpCHAttributes.Create(self);
|
||||
FRowHeadAttr := TVpRHAttributes.Create(self);
|
||||
FAllDayEventAttr := TVpAllDayEventAttributes.Create(self);
|
||||
dvClickTimer := TTimer.Create (self);
|
||||
FIconAttributes := TVpDayViewIconAttributes.Create (Self);
|
||||
FIconAttributes := TVpDayViewIconAttributes.Create(Self);
|
||||
|
||||
{ create Nav buttons }
|
||||
dvDayUpBtn := TSpeedButton.Create(self);
|
||||
@ -694,7 +694,7 @@ begin
|
||||
dvDayDownBtn := TSpeedButton.Create(self);
|
||||
dvDayDownBtn.Parent := self;
|
||||
dvTodayBtn := TSpeedButton.Create(self);
|
||||
dvTodayBtn.Parent := self;
|
||||
dvTodayBtn.Parent := self;
|
||||
dvWeekDownBtn := TSpeedButton.Create(self);
|
||||
dvWeekDownBtn.Parent := self;
|
||||
dvWeekUpBtn := TSpeedButton.Create(self);
|
||||
@ -712,11 +712,11 @@ begin
|
||||
dvDayUpBtn.Transparent := true;
|
||||
dvWeekUpBtn.Transparent := true;
|
||||
{ load their images }
|
||||
dvDayUpBtn.Glyph.LoadFromResourceName(HINSTANCE,'VPRIGHTARROW');
|
||||
dvDayDownBtn.Glyph.LoadFromResourceName(HINSTANCE,'VPLEFTARROW');
|
||||
dvTodayBtn.Glyph.LoadFromResourceName(HINSTANCE,'VPTODAY');
|
||||
dvWeekUpBtn.Glyph.LoadFromResourceName(HINSTANCE,'VPRIGHTARROWS');
|
||||
dvWeekDownBtn.Glyph.LoadFromResourceName(HINSTANCE,'VPLEFTARROWS');
|
||||
dvDayUpBtn.Glyph.LoadFromResourceName(HINSTANCE, 'VPRIGHTARROW');
|
||||
dvDayDownBtn.Glyph.LoadFromResourceName(HINSTANCE, 'VPLEFTARROW');
|
||||
dvTodayBtn.Glyph.LoadFromResourceName(HINSTANCE, 'VPTODAY');
|
||||
dvWeekUpBtn.Glyph.LoadFromResourceName(HINSTANCE, 'VPRIGHTARROWS');
|
||||
dvWeekDownBtn.Glyph.LoadFromResourceName(HINSTANCE, 'VPLEFTARROWS');
|
||||
{ set their OnClick handler }
|
||||
dvDayUpBtn.OnClick := dvNavButtonsClick;
|
||||
dvDayDownBtn.OnClick := dvNavButtonsClick;
|
||||
@ -1845,7 +1845,7 @@ begin
|
||||
then begin
|
||||
FActiveEvent := TVpEvent(dvEventArray[I].Event);
|
||||
dvActiveEventRec := dvEventArray[I].Rec;
|
||||
dvActiveIconRec := dvEventArray[I].IconRect;
|
||||
dvActiveIconRec := dvEventArray[I].IconRect;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
@ -1945,9 +1945,9 @@ begin
|
||||
dvInPlaceEditor.OnExit := EndEdit;
|
||||
end;
|
||||
dvInPlaceEditor.SetBounds(
|
||||
dvActiveIconRec.Left + FGutterWidth + TextMargin,
|
||||
dvActiveIconRec.Right + TextMargin,
|
||||
dvActiveEventRec.Top + TextMargin,
|
||||
dvActiveEventRec.Right - dvActiveIconRec.Left - FGutterWidth - TextMargin,
|
||||
dvActiveEventRec.Right - dvActiveIconRec.Right - TextMargin,
|
||||
dvActiveEventRec.Bottom - dvActiveEventRec.Top - TextMargin
|
||||
);
|
||||
dvInPlaceEditor.Show;
|
||||
|
@ -759,12 +759,13 @@ var
|
||||
end;
|
||||
|
||||
var
|
||||
OKToDrawEditFrame : Boolean;
|
||||
OKToDrawEditFrame: Boolean;
|
||||
TextRegion : HRGN;
|
||||
WorkRegion1: HRGN;
|
||||
WorkRegion2: HRGN;
|
||||
CW: Integer;
|
||||
EventIsEditing: Boolean;
|
||||
EventCategory: TVpCategoryInfo;
|
||||
OldPen: TPen;
|
||||
OldBrush: TBrush;
|
||||
OldFont: TFont;
|
||||
@ -896,8 +897,8 @@ begin
|
||||
{ amount of time represented by one line, divided by the height of }
|
||||
{ a line in pixels. }
|
||||
with TVpDayViewOpener(FDayView) do
|
||||
if (dvLineMatrix[Col, StartLine].Rec.Bottom - dvLineMatrix[Col, StartLine].Rec.Top) > 0 then
|
||||
PixelDuration := (LineDuration / (dvLineMatrix[Col, StartLine].Rec.Bottom - dvLineMatrix[Col, StartLine].Rec.Top))
|
||||
if HeightOf(dvLineMatrix[Col, StartLine].Rec) > 0 then
|
||||
PixelDuration := LineDuration / HeightOf(dvLineMatrix[Col, StartLine].Rec)
|
||||
else
|
||||
PixelDuration := 0;
|
||||
|
||||
@ -909,6 +910,17 @@ begin
|
||||
{ if we have hit the end of the events, then bail out }
|
||||
if Event = nil then
|
||||
Break;
|
||||
|
||||
{ Collect useful information needed later }
|
||||
EventCategory := FDayView.Datastore.CategoryColorMap.GetCategory(Event.Category);
|
||||
|
||||
EventIsEditing := false;
|
||||
if (TVpDayViewOpener(FDayView).dvInPlaceEditor <> nil) and
|
||||
TVpDayViewOpener(FDayView).dvInplaceEditor.Visible and
|
||||
(FDayView.ActiveEvent = Event)
|
||||
then
|
||||
EventIsEditing := true;
|
||||
|
||||
(* -- original
|
||||
{ remove the date portion from the start and end times }
|
||||
EventSTime := Event.StartTime;
|
||||
@ -929,13 +941,13 @@ begin
|
||||
{ remove the date portion from the start and end times }
|
||||
EventSTime := Event.StartTime;
|
||||
EventETime := Event.EndTime;
|
||||
if (EventSTime < trunc(ARenderDate)) and (Event.RepeatCode=rtNone) then //First Event
|
||||
if (EventSTime < trunc(ARenderDate)) and (Event.RepeatCode = rtNone) then // First Event
|
||||
EventSTime := trunc(ARenderDate)
|
||||
else if (Event.RepeatCode <> rtNone) then
|
||||
EventSTime := frac(EventSTime) + trunc(ARenderDate);
|
||||
if (trunc(EventETime) > trunc(ARenderDate)) and (Event.RepeatCode = rtNone) then //First Event
|
||||
EventETime := 0.999+trunc(ARenderDate)
|
||||
else if (Event.RepeatCode<>rtNone) then
|
||||
if (trunc(EventETime) > trunc(ARenderDate)) and (Event.RepeatCode = rtNone) then // First Event
|
||||
EventETime := 0.999 + trunc(ARenderDate)
|
||||
else if (Event.RepeatCode <> rtNone) then
|
||||
EventETime := frac(EventETime) + trunc(ARenderDate);
|
||||
EventSTime := EventSTime - trunc(ARenderDate);
|
||||
EventETime := EventETime - trunc(ARenderDate);
|
||||
@ -963,22 +975,24 @@ begin
|
||||
EventRect.Bottom := TVpDayViewOpener(FDayView).dvLineMatrix[Col, EventELine].Rec.Bottom;
|
||||
if EventRect.Bottom < VisibleRect.Top then
|
||||
EventRect.Bottom := VisibleRect.Bottom;
|
||||
EventWidth := (VisibleRect.Right - VisibleRect.Left) div EventArray[I].WidthDivisor;
|
||||
EventWidth := WidthOf(VisibleRect) div EventArray[I].WidthDivisor;
|
||||
|
||||
{ Slide the rect over to correspond with the level }
|
||||
if EventArray[I].Level > 0 then
|
||||
EventRect.Left := EventRect.Left + (EventWidth * EventArray[I].Level)
|
||||
EventRect.Left := EventRect.Left + EventWidth * EventArray[I].Level
|
||||
{ added because level 0 events were one pixel too far to the right }
|
||||
else
|
||||
EventRect.Left := EventRect.Left - 1;
|
||||
|
||||
EventRect.Right := EventRect.Left + EventWidth - FDayView.GutterWidth;
|
||||
|
||||
{ Draw the event rectangle }
|
||||
{ paint Event text area clWindow }
|
||||
if Assigned(FDayView.DataStore) then
|
||||
RenderCanvas.Brush.Color := FDayView.Datastore.CategoryColorMap.GetCategory(Event.Category).BackgroundColor
|
||||
else
|
||||
if Assigned(FDayView.DataStore) then begin
|
||||
if EventIsEditing then
|
||||
RenderCanvas.Brush.Color := clWindow
|
||||
else
|
||||
RenderCanvas.Brush.Color := EventCategory.BackgroundColor
|
||||
end else
|
||||
RenderCanvas.Brush.Color := WindowColor;
|
||||
TPSFillRect(RenderCanvas, Angle, RenderIn, EventRect);
|
||||
|
||||
@ -986,7 +1000,7 @@ begin
|
||||
{ corresponding to the event's category }
|
||||
{ These colors are used even when printing }
|
||||
if Assigned(FDayView.DataStore) then
|
||||
RenderCanvas.Brush.Color := FDayView.DataStore.CategoryColorMap.GetColor(Event.Category);
|
||||
RenderCanvas.Brush.Color := EventCategory.Color; //FDayView.DataStore.CategoryColorMap.GetColor(Event.Category);
|
||||
|
||||
{ find the pixel offset to use for determining where to start and }
|
||||
{ stop drawing colored area according to the start time and end time of the event. }
|
||||
@ -1018,10 +1032,10 @@ begin
|
||||
|
||||
{ Paint the gutter inside the EventRect all events }
|
||||
if (EventArray[I].Level = 0) then
|
||||
GutterRect.Left := EventRect.Left - Trunc (FDayView.GutterWidth * Scale)
|
||||
GutterRect.Left := EventRect.Left - Trunc(FDayView.GutterWidth * Scale)
|
||||
else
|
||||
GutterRect.Left := EventRect.Left;
|
||||
GutterRect.Right := GutterRect.Left + Round (FDayView.GutterWidth * Scale);
|
||||
GutterRect.Right := GutterRect.Left + Round(FDayView.GutterWidth * Scale);
|
||||
GutterRect.Top := EventRect.Top + StartPixelOffset;
|
||||
GutterRect.Bottom := EventRect.Bottom - EndPixelOffset;
|
||||
|
||||
@ -1029,7 +1043,7 @@ begin
|
||||
|
||||
RenderCanvas.Brush.Color := WindowColor;
|
||||
|
||||
if (TVpDayViewOpener(FDayView).dvInPlaceEditor <> nil) and
|
||||
{ if (TVpDayViewOpener(FDayView).dvInPlaceEditor <> nil) and
|
||||
TVpDayViewOpener(FDayView).dvInplaceEditor.Visible then
|
||||
begin
|
||||
if FDayView.ActiveEvent = Event then
|
||||
@ -1038,7 +1052,7 @@ begin
|
||||
EventIsEditing := False;
|
||||
end else
|
||||
EventIsEditing := False;
|
||||
|
||||
}
|
||||
{ build the event string }
|
||||
IconRect.Left := EventRect.Left;
|
||||
IconRect.Top := EventRect.Top;
|
||||
@ -1095,7 +1109,6 @@ begin
|
||||
if FDayView.WrapStyle = wsNone then begin
|
||||
{ if the string is longer than the availble space then chop }
|
||||
{ off the and and place those little '...'s at the end }
|
||||
|
||||
if RenderCanvas.TextWidth(EventString) > EventRect.Right - IconRect.Right - Round(FDayView.GutterWidth * Scale) - TextMargin
|
||||
then
|
||||
EventString := GetDisplayString(
|
||||
@ -1242,14 +1255,22 @@ var
|
||||
DrawPos: Integer;
|
||||
|
||||
procedure DrawIcon(bmp: TBitmap; w, h: Integer; IncDrawPos: Boolean = false);
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
if (bmp.Width <> 0) and (bmp.Height <> 0) then
|
||||
begin
|
||||
bmp.Transparent := True;
|
||||
R := Rect(0, 0, w, h);
|
||||
OffsetRect(R, AIconRect.Left + 1, AIconRect.Top + 1);
|
||||
RenderCanvas.StretchDraw(R, bmp);
|
||||
{
|
||||
RenderCanvas.CopyRect( // wp: was FDayview.Canvas -- does not look correct...
|
||||
Rect(AIconRect.Left + 1, AIconRect.Top +1, AIconRect.Left + w + 1, AIconRect.Top + h + 1),
|
||||
Rect(AIconRect.Left + 1, AIconRect.Top + 1, AIconRect.Left + w + 1, AIconRect.Top + h + 1),
|
||||
bmp.Canvas,
|
||||
Rect(0, 0, bmp.Width, bmp.Height)
|
||||
);
|
||||
}
|
||||
if IncDrawPos then
|
||||
inc(DrawPos, w);
|
||||
end;
|
||||
@ -1412,13 +1433,16 @@ begin
|
||||
ShowCategory := False;
|
||||
ShowCustom := False;
|
||||
|
||||
// FDayView.IconAttributes.AlarmBitmap.SaveToFile('d:\test.bmp');
|
||||
|
||||
|
||||
if Event.AlarmSet then begin
|
||||
dvBmpAlarm.Assign(FDayView.IconAttributes.AlarmBitmap);
|
||||
ShowAlarm := (dvBmpAlarm.Width <> 0) and (dvBmpAlarm.Height <> 0);
|
||||
end;
|
||||
|
||||
if Event.RepeatCode <> rtNone then begin
|
||||
dvBmpRecurring.Assign (FDayView.IconAttributes.RecurringBitmap);
|
||||
dvBmpRecurring.Assign(FDayView.IconAttributes.RecurringBitmap);
|
||||
ShowRecurring := (dvBmpRecurring.Width <> 0) and (dvBmpRecurring.Height <> 0);
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user