You've already forked lazarus-ccr
tvplanit: Simplify day, week and monthview, as well as contact list hints. Fix crash in Linux when mouse is moved into a hint.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5901 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -9,7 +9,7 @@ object MainForm: TMainForm
|
|||||||
Menu = MainMenu1
|
Menu = MainMenu1
|
||||||
OnCloseQuery = FormCloseQuery
|
OnCloseQuery = FormCloseQuery
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '1.6.4.0'
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 125
|
Left = 125
|
||||||
Height = 576
|
Height = 576
|
||||||
|
@ -514,11 +514,6 @@ begin
|
|||||||
CategoryColorMap.Category0.Description := 'Appointment';
|
CategoryColorMap.Category0.Description := 'Appointment';
|
||||||
//CategoryColorMap.Category0.Bitmap.Transparent := true; // <-- not working
|
//CategoryColorMap.Category0.Bitmap.Transparent := true; // <-- not working
|
||||||
LoadGlyphFromRCDATA(CategoryColorMap.Category0.Bitmap, 'SORTASC');
|
LoadGlyphFromRCDATA(CategoryColorMap.Category0.Bitmap, 'SORTASC');
|
||||||
{
|
|
||||||
bmp := CreateBitmapFromRCDATA('SORTASC');
|
|
||||||
CategoryColorMap.Category0.Bitmap.Assign(bmp);
|
|
||||||
bmp.Free;
|
|
||||||
}
|
|
||||||
CategoryColorMap.Category1.BackgroundColor := 13290239;
|
CategoryColorMap.Category1.BackgroundColor := 13290239;
|
||||||
CategoryColorMap.Category1.Color := clRed;
|
CategoryColorMap.Category1.Color := clRed;
|
||||||
CategoryColorMap.Category1.Description := 'Urgent';
|
CategoryColorMap.Category1.Description := 'Urgent';
|
||||||
|
@ -251,6 +251,16 @@ msgstr "Datei"
|
|||||||
msgid "Help"
|
msgid "Help"
|
||||||
msgstr "Hilfe"
|
msgstr "Hilfe"
|
||||||
|
|
||||||
|
#: tmainform.menuitem3.caption
|
||||||
|
msgctxt "tmainform.menuitem3.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tmainform.menuitem4.caption
|
||||||
|
msgctxt "tmainform.menuitem4.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: tmainform.mnuabout.caption
|
#: tmainform.mnuabout.caption
|
||||||
msgid "About Visual PlanIt"
|
msgid "About Visual PlanIt"
|
||||||
msgstr "Über Visual PlanIt"
|
msgstr "Über Visual PlanIt"
|
||||||
|
@ -240,6 +240,16 @@ msgstr "Tiedosto"
|
|||||||
msgid "Help"
|
msgid "Help"
|
||||||
msgstr "Ohje"
|
msgstr "Ohje"
|
||||||
|
|
||||||
|
#: tmainform.menuitem3.caption
|
||||||
|
msgctxt "tmainform.menuitem3.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tmainform.menuitem4.caption
|
||||||
|
msgctxt "tmainform.menuitem4.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: tmainform.mnuabout.caption
|
#: tmainform.mnuabout.caption
|
||||||
msgid "About Visual PlanIt"
|
msgid "About Visual PlanIt"
|
||||||
msgstr "Tietoja Visual PlanIt:stä"
|
msgstr "Tietoja Visual PlanIt:stä"
|
||||||
|
@ -245,6 +245,16 @@ msgstr "Bestand"
|
|||||||
msgid "Help"
|
msgid "Help"
|
||||||
msgstr "Help"
|
msgstr "Help"
|
||||||
|
|
||||||
|
#: tmainform.menuitem3.caption
|
||||||
|
msgctxt "tmainform.menuitem3.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tmainform.menuitem4.caption
|
||||||
|
msgctxt "tmainform.menuitem4.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: tmainform.mnuabout.caption
|
#: tmainform.mnuabout.caption
|
||||||
msgid "About Visual PlanIt"
|
msgid "About Visual PlanIt"
|
||||||
msgstr "Over Visual PlanIt"
|
msgstr "Over Visual PlanIt"
|
||||||
|
@ -240,6 +240,16 @@ msgstr ""
|
|||||||
msgid "Help"
|
msgid "Help"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: tmainform.menuitem3.caption
|
||||||
|
msgctxt "TMAINFORM.MENUITEM3.CAPTION"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tmainform.menuitem4.caption
|
||||||
|
msgctxt "tmainform.menuitem4.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: tmainform.mnuabout.caption
|
#: tmainform.mnuabout.caption
|
||||||
msgid "About Visual PlanIt"
|
msgid "About Visual PlanIt"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -254,6 +254,16 @@ msgstr "Файл"
|
|||||||
msgid "Help"
|
msgid "Help"
|
||||||
msgstr "Справка"
|
msgstr "Справка"
|
||||||
|
|
||||||
|
#: tmainform.menuitem3.caption
|
||||||
|
msgctxt "tmainform.menuitem3.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tmainform.menuitem4.caption
|
||||||
|
msgctxt "tmainform.menuitem4.caption"
|
||||||
|
msgid "-"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: tmainform.mnuabout.caption
|
#: tmainform.mnuabout.caption
|
||||||
msgid "About Visual PlanIt"
|
msgid "About Visual PlanIt"
|
||||||
msgstr "О Visual PlanIt"
|
msgstr "О Visual PlanIt"
|
||||||
|
@ -368,6 +368,13 @@ type
|
|||||||
property ActiveRange: TVpTimeRange read FActiveRange write FActiveRange;
|
property ActiveRange: TVpTimeRange read FActiveRange write FActiveRange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TVpHintWindow = class(THintWindow)
|
||||||
|
public
|
||||||
|
function CalcHintRect(MaxWidth: Integer; const AHint: String;
|
||||||
|
AData: pointer): TRect; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$IFDEF NEW_ICONS}
|
{$IFDEF NEW_ICONS}
|
||||||
@ -1019,7 +1026,15 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{=====}
|
|
||||||
|
|
||||||
|
{ TVpHintWindow }
|
||||||
|
|
||||||
|
function TVpHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String;
|
||||||
|
AData: pointer): TRect;
|
||||||
|
begin
|
||||||
|
Result := inherited CalcHintRect(MAX_HINT_WIDTH, AHint, AData);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ const
|
|||||||
VK_2 = Ord('2'); VK_3 = Ord('3'); VK_4 = Ord('4'); VK_5 = Ord('5');
|
VK_2 = Ord('2'); VK_3 = Ord('3'); VK_4 = Ord('4'); VK_5 = Ord('5');
|
||||||
VK_6 = Ord('6'); VK_7 = Ord('7'); VK_8 = Ord('8'); VK_9 = Ord('9');
|
VK_6 = Ord('6'); VK_7 = Ord('7'); VK_8 = Ord('8'); VK_9 = Ord('9');
|
||||||
|
|
||||||
|
|
||||||
{------------------- Windows messages -----------------------}
|
{------------------- Windows messages -----------------------}
|
||||||
{Not a message code. Value of the first of the message codes used}
|
{Not a message code. Value of the first of the message codes used}
|
||||||
Vp_FIRST = $7F00; {***}
|
Vp_FIRST = $7F00; {***}
|
||||||
|
@ -110,6 +110,7 @@ type
|
|||||||
{ Contact Grid }
|
{ Contact Grid }
|
||||||
TVpContactGrid = class(TVpLinkableControl)
|
TVpContactGrid = class(TVpLinkableControl)
|
||||||
private
|
private
|
||||||
|
FComponentHint: TTranslateString;
|
||||||
FHintMode: TVpHintMode;
|
FHintMode: TVpHintMode;
|
||||||
protected{ private }
|
protected{ private }
|
||||||
FColumnWidth : Integer;
|
FColumnWidth : Integer;
|
||||||
@ -155,7 +156,6 @@ type
|
|||||||
cgColCount : Integer;
|
cgColCount : Integer;
|
||||||
cgVScrollDelta : Integer;
|
cgVScrollDelta : Integer;
|
||||||
FOldCursor : TCursor;
|
FOldCursor : TCursor;
|
||||||
FHintWindow: THintWindow;
|
|
||||||
FMouseContactIndex: Integer;
|
FMouseContactIndex: Integer;
|
||||||
|
|
||||||
{ property methods }
|
{ property methods }
|
||||||
@ -223,6 +223,7 @@ type
|
|||||||
function BuildHintString(AContact: TVpContact): String;
|
function BuildHintString(AContact: TVpContact): String;
|
||||||
procedure ShowHintWindow(APoint: TPoint; AContactIndex: Integer);
|
procedure ShowHintWindow(APoint: TPoint; AContactIndex: Integer);
|
||||||
procedure HideHintWindow;
|
procedure HideHintWindow;
|
||||||
|
procedure SetHint(const AValue: TTranslateString); override;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -428,11 +429,14 @@ var
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
HintWindowClass := TVpHintWindow;
|
||||||
cgGridState := gsNormal;
|
|
||||||
|
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
||||||
|
cgGridState := gsNormal;
|
||||||
|
|
||||||
{ Create internal classes and stuff }
|
{ Create internal classes and stuff }
|
||||||
cgClickTimer := TTimer.Create(self);
|
cgClickTimer := TTimer.Create(self);
|
||||||
FContactHeadAttr := TVpContactHeadAttr.Create(Self);
|
FContactHeadAttr := TVpContactHeadAttr.Create(Self);
|
||||||
|
|
||||||
{ Set styles and initialize internal variables }
|
{ Set styles and initialize internal variables }
|
||||||
{$IFDEF VERSION4}
|
{$IFDEF VERSION4}
|
||||||
@ -922,63 +926,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpContactGrid.ShowHintWindow(APoint: TPoint; AContactIndex: Integer);
|
procedure TVpContactGrid.ShowHintWindow(APoint: TPoint; AContactIndex: Integer);
|
||||||
const
|
|
||||||
MaxWidth = 400;
|
|
||||||
var
|
var
|
||||||
txt: String;
|
txt: String;
|
||||||
contact: TVpContact;
|
contact: TVpContact;
|
||||||
R, RHint,RCont, RScr: TRect;
|
|
||||||
begin
|
begin
|
||||||
if FHintMode = hmPlannerHint then
|
HideHintWindow;
|
||||||
begin
|
case FHintMode of
|
||||||
if (AContactIndex = -1) or ((Datastore = nil) or (Datastore.Resource = nil)) then
|
hmPlannerHint:
|
||||||
begin
|
begin
|
||||||
HideHintWindow;
|
if (AContactIndex = -1) or (Datastore = nil) or (Datastore.Resource = nil) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
contact := TVpContact(cgContactArray[AContactIndex].Contact);
|
||||||
|
txt := BuildHintString(contact);
|
||||||
contact := TVpContact(cgContactArray[AContactIndex].Contact);
|
|
||||||
txt := BuildHintString(contact);
|
|
||||||
|
|
||||||
if (txt <> '') and not (csDesigning in ComponentState) then
|
|
||||||
begin
|
|
||||||
// Build and show the hint window
|
|
||||||
if FHintWindow = nil then
|
|
||||||
FHintWindow := THintWindow.Create(nil);
|
|
||||||
RScr := Screen.WorkAreaRect;
|
|
||||||
RCont.TopLeft := ClientToScreen(cgContactArray[AContactIndex].WholeRect.TopLeft);
|
|
||||||
RCont.BottomRight := ClientToScreen(cgContactArray[AContactIndex].WholeRect.BottomRight);
|
|
||||||
RHint := FHintWindow.CalcHintRect(MaxWidth, txt, nil);
|
|
||||||
R := RHint;
|
|
||||||
OffsetRect(R, RCont.Left - WidthOf(R), RCont.Top);
|
|
||||||
if R.Left < RScr.Left then begin
|
|
||||||
R := RHint;
|
|
||||||
OffsetRect(R, RCont.Right, RCont.Top);
|
|
||||||
end;
|
end;
|
||||||
RHint := R;
|
hmComponentHint:
|
||||||
if (R.Bottom > RScr.Bottom) then begin
|
txt := FComponentHint;
|
||||||
R := RHint;
|
end;
|
||||||
OffsetRect(R, 0, R.Bottom - RScr.Bottom);
|
if (txt <> '') and not (csDesigning in ComponentState) and
|
||||||
end;
|
not ((cgInplaceEditor <> nil) and cgInplaceEditor.Visible)
|
||||||
FHintWindow.ActivateHint(R, txt);
|
then begin
|
||||||
end else
|
Hint := txt;
|
||||||
// Hide the hint window
|
Application.Hint := txt;
|
||||||
HideHintWindow;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if FHintMode = hmComponentHint then
|
|
||||||
begin
|
|
||||||
Application.Hint := Hint;
|
|
||||||
Application.ActivateHint(ClientToScreen(APoint), true);
|
Application.ActivateHint(ClientToScreen(APoint), true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpContactGrid.HideHintWindow;
|
procedure TVpContactGrid.HideHintWindow;
|
||||||
begin
|
begin
|
||||||
case FHintMode of
|
Application.CancelHint;
|
||||||
hmPlannerHint : FreeAndNil(FHintWindow);
|
end;
|
||||||
hmComponentHint : Application.CancelHint;
|
|
||||||
end;
|
procedure TVpContactGrid.SetHint(const AValue: TTranslateString);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if FHintMode = hmComponentHint then
|
||||||
|
FComponentHint := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpContactGrid.MouseEnter;
|
procedure TVpContactGrid.MouseEnter;
|
||||||
@ -1058,21 +1040,19 @@ var
|
|||||||
begin
|
begin
|
||||||
if cgGridState = gsNormal then begin
|
if cgGridState = gsNormal then begin
|
||||||
inherited MouseMove(Shift, X, Y);
|
inherited MouseMove(Shift, X, Y);
|
||||||
|
if ShowHint then begin
|
||||||
if ShowHint then
|
idx := GetContactIndexByCoord(Point(X, Y));
|
||||||
if (cgInPlaceEditor <> nil) and cgInPlaceEditor.Visible then
|
if idx = -1 then
|
||||||
HideHintWindow
|
HideHintWindow
|
||||||
else begin
|
else
|
||||||
idx := GetContactIndexByCoord(Point(X, Y));
|
if FMouseContactIndex <> idx then begin
|
||||||
if FMouseContactIndex <> idx then begin
|
ShowHintWindow(Point(X, Y), idx);
|
||||||
ShowHintWindow(Point(X, Y), idx);
|
FMouseContactIndex := idx;
|
||||||
FMouseContactIndex := idx;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end else
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{ Column sizing happens here...}
|
{ Column sizing happens here...}
|
||||||
{ if the in-place editor is active then kill it. }
|
{ if the in-place editor is active then kill it. }
|
||||||
if Assigned(cgInplaceEditor) and cgInPlaceEditor.Visible then
|
if Assigned(cgInplaceEditor) and cgInPlaceEditor.Visible then
|
||||||
|
@ -222,8 +222,8 @@ type
|
|||||||
|
|
||||||
TVpDayView = class(TVpLinkableControl)
|
TVpDayView = class(TVpLinkableControl)
|
||||||
private
|
private
|
||||||
|
FComponentHint: TTranslateString;
|
||||||
FHintMode: TVpHintMode;
|
FHintMode: TVpHintMode;
|
||||||
FHintWindow: THintWindow;
|
|
||||||
FMouseEvent: TVpEvent;
|
FMouseEvent: TVpEvent;
|
||||||
FOnHoliday: TVpHolidayEvent;
|
FOnHoliday: TVpHolidayEvent;
|
||||||
|
|
||||||
@ -339,6 +339,8 @@ type
|
|||||||
{ Hints }
|
{ Hints }
|
||||||
procedure ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
|
procedure ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
|
||||||
procedure HideHintWindow;
|
procedure HideHintWindow;
|
||||||
|
procedure SetHint(const AValue: TTranslateString); override;
|
||||||
|
procedure SetHintMode(const AValue: TVpHintMode);
|
||||||
|
|
||||||
{ internal methods }
|
{ internal methods }
|
||||||
function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer;
|
function dvCalcRowHeight(Scale: Extended; UseGran: TVpGranularity): Integer;
|
||||||
@ -478,7 +480,7 @@ type
|
|||||||
property IncludeWeekends: Boolean read FIncludeWeekends write SetIncludeWeekends default True;
|
property IncludeWeekends: Boolean read FIncludeWeekends write SetIncludeWeekends default True;
|
||||||
property NumDays: Integer read FNumDays write SetNumDays default 1;
|
property NumDays: Integer read FNumDays write SetNumDays default 1;
|
||||||
property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow;
|
property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow;
|
||||||
property HintMode: TVpHintMode read FHintMode write FHintMode default hmPlannerHint;
|
property HintMode: TVpHintMode read FHintMode write SetHintMode default hmPlannerHint;
|
||||||
{events}
|
{events}
|
||||||
property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit;
|
property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit;
|
||||||
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
|
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
|
||||||
@ -688,6 +690,7 @@ constructor TVpDayView.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
||||||
|
HintWindowClass := TVpHintWindow;
|
||||||
|
|
||||||
{ Create internal classes and stuff }
|
{ Create internal classes and stuff }
|
||||||
FTimeSlotColors := TVpTimeSlotColor.Create(self);
|
FTimeSlotColors := TVpTimeSlotColor.Create(self);
|
||||||
@ -822,7 +825,6 @@ end;
|
|||||||
destructor TVpDayView.Destroy;
|
destructor TVpDayView.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(dvInplaceEditor);
|
FreeAndNil(dvInplaceEditor);
|
||||||
FreeAndNil(FHintWindow);
|
|
||||||
|
|
||||||
FTimeSlotColors.Free;
|
FTimeSlotColors.Free;
|
||||||
FHeadAttr.Free;
|
FHeadAttr.Free;
|
||||||
@ -1021,38 +1023,22 @@ end;
|
|||||||
procedure TVpDayView.ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
|
procedure TVpDayView.ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
|
||||||
var
|
var
|
||||||
txt: String;
|
txt: String;
|
||||||
R, eventR: TRect;
|
|
||||||
begin
|
begin
|
||||||
if FHintMode = hmPlannerHint then
|
HideHintWindow;
|
||||||
begin
|
case FHintMode of
|
||||||
if (AEvent = nil) or
|
hmPlannerHint:
|
||||||
((Datastore = nil) or (Datastore.Resource = nil)) then
|
begin
|
||||||
begin
|
if (AEvent = nil) or (Datastore = nil) or (Datastore.Resource = nil) then
|
||||||
HideHintWindow;
|
exit;
|
||||||
exit;
|
txt := BuildEventString(AEvent, true);
|
||||||
end;
|
end;
|
||||||
|
hmComponentHint:
|
||||||
txt := BuildEventString(AEvent, true);
|
txt := FComponentHint;
|
||||||
|
end;
|
||||||
if (txt <> '') and
|
if (txt <> '') and not (csDesigning in ComponentState) and
|
||||||
not ((dvInPlaceEditor <> nil) and dvInplaceEditor.Visible) and
|
not ((dvInplaceEditor <> nil) and dvInplaceEditor.Visible) then
|
||||||
not (csDesigning in ComponentState) then
|
|
||||||
begin
|
|
||||||
if FHintWindow = nil then
|
|
||||||
FHintWindow := THintWindow.Create(nil);
|
|
||||||
eventR := GetEventRect(AEvent);
|
|
||||||
eventR.TopLeft := ClientToScreen(eventR.TopLeft);
|
|
||||||
eventR.BottomRight := ClientToScreen(eventR.BottomRight);
|
|
||||||
APoint := ClientToScreen(APoint);
|
|
||||||
R := FHintWindow.CalcHintRect(MAX_HINT_WIDTH, txt, nil);
|
|
||||||
OffsetRect(R, APoint.X - WidthOf(R), eventR.Bottom);
|
|
||||||
FHintWindow.ActivateHint(R, txt);
|
|
||||||
end else
|
|
||||||
HideHintWindow;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if FHintMode = hmComponentHint then
|
|
||||||
begin
|
begin
|
||||||
|
Hint := txt;
|
||||||
Application.Hint := Hint;
|
Application.Hint := Hint;
|
||||||
Application.ActivateHint(ClientToScreen(APoint), true);
|
Application.ActivateHint(ClientToScreen(APoint), true);
|
||||||
end;
|
end;
|
||||||
@ -1060,12 +1046,7 @@ end;
|
|||||||
|
|
||||||
procedure TVpDayView.HideHintWindow;
|
procedure TVpDayView.HideHintWindow;
|
||||||
begin
|
begin
|
||||||
case FHintMode of
|
Application.CancelHint;
|
||||||
hmPlannerHint:
|
|
||||||
FreeAndNil(FHintWindow);
|
|
||||||
hmComponentHint:
|
|
||||||
Application.CancelHint;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1878,8 +1859,11 @@ begin
|
|||||||
if ShowHint then
|
if ShowHint then
|
||||||
begin
|
begin
|
||||||
event := GetEventAtCoord(Point(X, Y));
|
event := GetEventAtCoord(Point(X, Y));
|
||||||
|
if event = nil then
|
||||||
|
HideHintWindow
|
||||||
|
else
|
||||||
if FMouseEvent <> event then begin
|
if FMouseEvent <> event then begin
|
||||||
Application.CancelHint;
|
// HideHintWindow;
|
||||||
ShowHintWindow(Point(X, Y), event);
|
ShowHintWindow(Point(X, Y), event);
|
||||||
FMouseEvent := event;
|
FMouseEvent := event;
|
||||||
end;
|
end;
|
||||||
@ -2469,6 +2453,23 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TVpDayView.SetHint(const AValue: TTranslateString);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if FHintMode = hmComponentHint then
|
||||||
|
FComponentHint := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TVpDayView.SetHintMode(const AValue: TVpHintMode);
|
||||||
|
begin
|
||||||
|
if AValue = FHintMode then
|
||||||
|
exit;
|
||||||
|
FHintMode := AValue;
|
||||||
|
if FHintMode = hmPlannerHint then
|
||||||
|
FComponentHint := Hint;
|
||||||
|
end;
|
||||||
|
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpDayView.dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean);
|
procedure TVpDayView.dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean);
|
||||||
|
@ -137,6 +137,7 @@ type
|
|||||||
|
|
||||||
TVpMonthView = class(TVpLinkableControl)
|
TVpMonthView = class(TVpLinkableControl)
|
||||||
private
|
private
|
||||||
|
FComponentHint: TTranslateString;
|
||||||
FHintMode: TVpHintMode;
|
FHintMode: TVpHintMode;
|
||||||
FOnHoliday: TVpHolidayEvent;
|
FOnHoliday: TVpHolidayEvent;
|
||||||
protected{ private }
|
protected{ private }
|
||||||
@ -168,7 +169,6 @@ type
|
|||||||
FDate: TDateTime;
|
FDate: TDateTime;
|
||||||
FDefaultPopup: TPopupMenu;
|
FDefaultPopup: TPopupMenu;
|
||||||
FRightClickChangeDate: Boolean;
|
FRightClickChangeDate: Boolean;
|
||||||
FHintWindow: THintWindow;
|
|
||||||
FMouseDate: TDateTime;
|
FMouseDate: TDateTime;
|
||||||
|
|
||||||
{ event variables }
|
{ event variables }
|
||||||
@ -245,6 +245,7 @@ type
|
|||||||
{ Hints }
|
{ Hints }
|
||||||
procedure ShowHintWindow(APoint: TPoint; ADate: TDateTime);
|
procedure ShowHintWindow(APoint: TPoint; ADate: TDateTime);
|
||||||
procedure HideHintWindow;
|
procedure HideHintWindow;
|
||||||
|
procedure SetHint(const AValue: TTranslateString); override;
|
||||||
|
|
||||||
{ Popup menu }
|
{ Popup menu }
|
||||||
procedure InitializeDefaultPopup;
|
procedure InitializeDefaultPopup;
|
||||||
@ -407,6 +408,7 @@ constructor TVpMonthView.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
||||||
|
HintWindowClass := TVpHintWindow;
|
||||||
|
|
||||||
{ Create internal classes and stuff }
|
{ Create internal classes and stuff }
|
||||||
FHeadAttr := TVpMonthViewAttr.Create(self);
|
FHeadAttr := TVpMonthViewAttr.Create(self);
|
||||||
@ -486,7 +488,6 @@ end;
|
|||||||
|
|
||||||
destructor TVpMonthView.Destroy;
|
destructor TVpMonthView.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FHintWindow);
|
|
||||||
FHeadAttr.Free;
|
FHeadAttr.Free;
|
||||||
FHolidayAttr.Free;
|
FHolidayAttr.Free;
|
||||||
FTodayAttr.Free;
|
FTodayAttr.Free;
|
||||||
@ -940,77 +941,74 @@ var
|
|||||||
holiday: String = '';
|
holiday: String = '';
|
||||||
todayDate: TDate;
|
todayDate: TDate;
|
||||||
begin
|
begin
|
||||||
if FHintMode = hmPlannerHint then
|
HideHintWindow;
|
||||||
begin
|
|
||||||
if (ADate = 0) or ((Datastore = nil) or (Datastore.Resource = nil)) then
|
|
||||||
begin
|
|
||||||
HideHintWindow;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// If the date is a holiday we put the holidayname at the top
|
if (csDesigning in ComponentState) then
|
||||||
IsHoliday(ADate, holiday);
|
exit;
|
||||||
|
|
||||||
// Collect all events of this day and add them separated by line feeds to
|
case FHintMode of
|
||||||
// the hint string (txt).
|
hmPlannerHint:
|
||||||
list := TList.Create;
|
begin
|
||||||
txt := '';
|
if (ADate = 0) or (Datastore = nil) or (Datastore.Resource = nil) then
|
||||||
try
|
exit;
|
||||||
Datastore.Resource.Schedule.EventsByDate(ADate, List);
|
txt := '';
|
||||||
for i:=0 to list.Count-1 do begin
|
// If the date is a holiday we put the holidayname at the top
|
||||||
event := TVpEvent(list[i]);
|
IsHoliday(ADate, holiday);
|
||||||
s := BuildEventString(event, true, false);
|
// Collect all events of this day and add them separated by line feeds to
|
||||||
txt := IfThen(txt = '', s, txt + LineEnding + s);
|
// the hint string (txt).
|
||||||
|
list := TList.Create;
|
||||||
|
try
|
||||||
|
Datastore.Resource.Schedule.EventsByDate(ADate, List);
|
||||||
|
for i:=0 to list.Count-1 do begin
|
||||||
|
event := TVpEvent(list[i]);
|
||||||
|
s := BuildEventString(event, true, false);
|
||||||
|
txt := IfThen(txt = '', s, txt + LineEnding + s);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
list.Free;
|
||||||
|
end;
|
||||||
|
// If we have any events then we put the current date at the top.
|
||||||
|
todayDate := SysUtils.Date();
|
||||||
|
if (txt = '') and (holiday = '') and (ADate = todayDate) then
|
||||||
|
txt := RSToday + LineEnding + FormatDateTime('ddddd', ADate)
|
||||||
|
else
|
||||||
|
if (txt <> '') or (holiday <> '') then begin
|
||||||
|
if (txt = '') and (holiday <> '') then
|
||||||
|
txt := FormatDateTime('ddddd', ADate) + LineEnding + holiday
|
||||||
|
else begin
|
||||||
|
txt := LineEnding + txt;
|
||||||
|
if holiday <> '' then
|
||||||
|
txt := holiday + LineEnding + txt;
|
||||||
|
txt := FormatDateTime('ddddd', ADate) + LineEnding + txt;
|
||||||
|
if ADate = todayDate then
|
||||||
|
txt := RSToday + LineEnding + txt;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
hmComponentHint:
|
||||||
list.Free;
|
txt := FComponentHint;
|
||||||
end;
|
end;
|
||||||
|
if (txt <> '') then begin
|
||||||
// If we have any events then we put the current date at the top.
|
Hint := txt;
|
||||||
todayDate := SysUtils.Date();
|
Application.Hint := txt;
|
||||||
if (txt = '') and (holiday = '') and (ADate = todayDate) then
|
Application.ActivateHint(ScreenToClient(APoint), true);
|
||||||
txt := RSToday + LineEnding + FormatDateTime('ddddd', ADate)
|
end else
|
||||||
else
|
if FHintMode = hmPlannerHint then begin
|
||||||
if (txt <> '') or (holiday <> '') then begin
|
Hint := '';
|
||||||
if (txt = '') and (holiday <> '') then
|
Application.Hint := '';
|
||||||
txt := FormatDateTime('ddddd', ADate) + LineEnding + holiday
|
|
||||||
else begin
|
|
||||||
txt := LineEnding + txt;
|
|
||||||
if holiday <> '' then
|
|
||||||
txt := holiday + LineEnding + txt;
|
|
||||||
txt := FormatDateTime('ddddd', ADate) + LineEnding + txt;
|
|
||||||
if ADate = todayDate then
|
|
||||||
txt := RSToday + LineEnding + txt;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if (txt <> '') and not (csDesigning in ComponentState) then
|
|
||||||
begin
|
|
||||||
// Build and show the hint window
|
|
||||||
if FHintWindow = nil then
|
|
||||||
FHintWindow := THintWindow.Create(nil);
|
|
||||||
APoint := ClientToScreen(APoint);
|
|
||||||
R := FHintWindow.CalcHintRect(MaxWidth, txt, nil);
|
|
||||||
OffsetRect(R, APoint.X - WidthOf(R), APoint.Y);
|
|
||||||
FHintWindow.ActivateHint(R, txt);
|
|
||||||
end else
|
|
||||||
// Hide the hint window
|
|
||||||
HideHintWindow;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if FHintMode = hmComponentHint then
|
|
||||||
begin
|
|
||||||
Application.Hint := Hint;
|
|
||||||
Application.ActivateHint(ClientToScreen(APoint), true);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpMonthView.HideHintWindow;
|
procedure TVpMonthView.HideHintWindow;
|
||||||
begin
|
begin
|
||||||
case FHintMode of
|
Application.CancelHint;
|
||||||
hmPlannerHint: FreeAndNil(FHintWindow);
|
end;
|
||||||
hmComponentHint: Application.CancelHint;
|
|
||||||
end;
|
procedure TVpMonthView.SetHint(const AValue: TTranslateString);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if FHintMode = hmComponentHint then
|
||||||
|
FComponentHint := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpMonthView.InitializeDefaultPopup;
|
procedure TVpMonthView.InitializeDefaultPopup;
|
||||||
@ -1244,9 +1242,11 @@ begin
|
|||||||
if ShowHint then
|
if ShowHint then
|
||||||
begin
|
begin
|
||||||
day := GetDateAtCoord(Point(X, Y));
|
day := GetDateAtCoord(Point(X, Y));
|
||||||
if FMouseDate <> day then begin
|
if day = 0 then
|
||||||
ShowHintWindow(Point(X, Y), day);
|
HideHintWindow
|
||||||
|
else if FMouseDate <> day then begin
|
||||||
FMouseDate := day;
|
FMouseDate := day;
|
||||||
|
ShowHintWindow(Point(X, Y), day);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1256,7 +1256,7 @@ begin
|
|||||||
if v <> FRightClickChangeDate then
|
if v <> FRightClickChangeDate then
|
||||||
FRightClickChangeDate := v;
|
FRightClickChangeDate := v;
|
||||||
end;
|
end;
|
||||||
{=====}
|
|
||||||
procedure TVpMonthView.SetWeekStartsOn(Value: TVpDayType);
|
procedure TVpMonthView.SetWeekStartsOn(Value: TVpDayType);
|
||||||
begin
|
begin
|
||||||
if Value <> FWeekStartsOn then begin
|
if Value <> FWeekStartsOn then begin
|
||||||
|
@ -119,9 +119,9 @@ type
|
|||||||
|
|
||||||
TVpWeekView = class(TVpLinkableControl)
|
TVpWeekView = class(TVpLinkableControl)
|
||||||
private
|
private
|
||||||
|
FComponentHint: TTranslateString;
|
||||||
FHintMode: TVpHintMode;
|
FHintMode: TVpHintMode;
|
||||||
FMouseEvent: TVpEvent;
|
FMouseEvent: TVpEvent;
|
||||||
FHintWindow: THintWindow;
|
|
||||||
FLayout: TVpWeekviewLayout;
|
FLayout: TVpWeekviewLayout;
|
||||||
FOnHoliday: TVpHolidayEvent;
|
FOnHoliday: TVpHolidayEvent;
|
||||||
procedure SetActiveEvent(AValue: TVpEvent);
|
procedure SetActiveEvent(AValue: TVpEvent);
|
||||||
@ -232,6 +232,7 @@ type
|
|||||||
{ hints }
|
{ hints }
|
||||||
procedure ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
|
procedure ShowHintWindow(APoint: TPoint; AEvent: TVpEvent);
|
||||||
procedure HideHintWindow;
|
procedure HideHintWindow;
|
||||||
|
procedure SetHint(const AValue: TTranslateString); override;
|
||||||
|
|
||||||
{ message handlers }
|
{ message handlers }
|
||||||
{$IFNDEF LCL}
|
{$IFNDEF LCL}
|
||||||
@ -435,6 +436,7 @@ constructor TVpWeekView.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
||||||
|
HintWindowClass := TVpHintWindow;
|
||||||
|
|
||||||
{ Create internal classes and stuff }
|
{ Create internal classes and stuff }
|
||||||
FDayHeadAttributes := TVpDayHeadAttr.Create(self);
|
FDayHeadAttributes := TVpDayHeadAttr.Create(self);
|
||||||
@ -508,7 +510,6 @@ end;
|
|||||||
|
|
||||||
destructor TVpWeekView.Destroy;
|
destructor TVpWeekView.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FHintWindow);
|
|
||||||
FreeAndNil(wvInplaceEditor);
|
FreeAndNil(wvInplaceEditor);
|
||||||
FDayHeadAttributes.Free;
|
FDayHeadAttributes.Free;
|
||||||
FAllDayEventAttr.Free;
|
FAllDayEventAttr.Free;
|
||||||
@ -1043,49 +1044,36 @@ var
|
|||||||
txt: String;
|
txt: String;
|
||||||
R, eventR: TRect;
|
R, eventR: TRect;
|
||||||
begin
|
begin
|
||||||
if FHintMode = hmPlannerHint then
|
HideHintWindow;
|
||||||
|
case FHintMode of
|
||||||
|
hmPlannerHint:
|
||||||
|
begin
|
||||||
|
if (AEvent = nil) or (Datastore = nil) or (Datastore.Resource = nil) then
|
||||||
|
exit;
|
||||||
|
txt := BuildEventString(AEvent, AEvent.StartTime, AEvent.EndTime, true);
|
||||||
|
end;
|
||||||
|
hmComponentHint:
|
||||||
|
txt := FComponentHint;
|
||||||
|
end;
|
||||||
|
if (txt <> '') and not ((wvInplaceEditor <> nil) and wvInplaceEditor.Visible)
|
||||||
|
and not (csDesigning in ComponentState) then
|
||||||
begin
|
begin
|
||||||
if (AEvent = nil) or
|
Hint := txt;
|
||||||
((Datastore = nil) or (Datastore.Resource = nil)) then
|
Application.Hint := txt;
|
||||||
begin
|
|
||||||
HideHintWindow;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
txt := BuildEventString(AEvent, AEvent.StartTime, AEvent.EndTime, true);
|
|
||||||
|
|
||||||
if (txt <> '') and
|
|
||||||
not ((wvInPlaceEditor <> nil) and wvInplaceEditor.Visible) and
|
|
||||||
not (csDesigning in ComponentState) then
|
|
||||||
begin
|
|
||||||
if FHintWindow = nil then
|
|
||||||
FHintWindow := THintWindow.Create(nil);
|
|
||||||
eventR := GetEventRect(AEvent);
|
|
||||||
eventR.TopLeft := ClientToScreen(eventR.TopLeft);
|
|
||||||
eventR.BottomRight := ClientToScreen(eventR.BottomRight);
|
|
||||||
APoint := ClientToScreen(APoint);
|
|
||||||
R := FHintWindow.CalcHintRect(MAX_HINT_WIDTH, txt, nil);
|
|
||||||
OffsetRect(R, APoint.X - WidthOf(R), eventR.Bottom);
|
|
||||||
FHintWindow.ActivateHint(R, txt);
|
|
||||||
end else
|
|
||||||
HideHintWindow;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if FHintMode = hmComponentHint then
|
|
||||||
begin
|
|
||||||
Application.Hint := Hint;
|
|
||||||
Application.ActivateHint(ClientToScreen(APoint), true);
|
Application.ActivateHint(ClientToScreen(APoint), true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpWeekView.HideHintWindow;
|
procedure TVpWeekView.HideHintWindow;
|
||||||
begin
|
begin
|
||||||
case FHintMode of
|
Application.CancelHint;
|
||||||
hmPlannerHint:
|
end;
|
||||||
FreeAndNil(FHintWindow);
|
|
||||||
hmComponentHint:
|
procedure TVpWeekView.SetHint(const AValue: TTranslateString);
|
||||||
Application.CancelHint;
|
begin
|
||||||
end;
|
inherited;
|
||||||
|
if FHintMode = hmComponentHint then
|
||||||
|
FComponentHint := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1721,8 +1709,10 @@ begin
|
|||||||
if ShowHint then
|
if ShowHint then
|
||||||
begin
|
begin
|
||||||
event := GetEventAtCoord(Point(X, Y));
|
event := GetEventAtCoord(Point(X, Y));
|
||||||
if FMouseEvent <> event then begin
|
if event = nil then
|
||||||
Application.CancelHint;
|
HideHintWindow
|
||||||
|
else if FMouseEvent <> event then begin
|
||||||
|
HideHintWindow;
|
||||||
ShowHintWindow(Point(X, Y), event);
|
ShowHintWindow(Point(X, Y), event);
|
||||||
FMouseEvent := event;
|
FMouseEvent := event;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user