tvplanit: Deactivate drag-and-drop code in dayview unit by a define (DRAGDROP). This fixes the drag-and-drop mouse cursor appearing after editing an event in dayview.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4768 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-18 12:09:16 +00:00
parent 6509b909e8
commit 6dc495dea2

View File

@ -53,6 +53,13 @@
{.$DEFINE DEBUGDV} { Causes the DayView to operate in debug mode } {.$DEFINE DEBUGDV} { Causes the DayView to operate in debug mode }
{ Include drag-and-drop, not working with Lazarus }
{$IFDEF DELPHI}
{$DEFINE DRAGDROP}
{$ELSE}
{$UNDEF DRAGDROP}
{$ENDIF}
unit VpDayView; unit VpDayView;
interface interface
@ -279,8 +286,11 @@ type
dvClientVArea : Integer; dvClientVArea : Integer;
dvMouseDownPoint : TPoint; dvMouseDownPoint : TPoint;
dvMouseDown : Boolean; dvMouseDown : Boolean;
dvEndingEditing : Boolean;
{$IFDEF DRAGDROP}
dvDragging : Boolean; dvDragging : Boolean;
dvEndingEditing : Boolean; dvDragStartTime : TDateTime;
{$ENDIF}
{ Nav Buttons } { Nav Buttons }
dvDayUpBtn : TSpeedButton; dvDayUpBtn : TSpeedButton;
@ -289,7 +299,6 @@ type
dvWeekUpBtn : TSpeedButton; dvWeekUpBtn : TSpeedButton;
dvWeekDownBtn : TSpeedButton; dvWeekDownBtn : TSpeedButton;
dvDragStartTime : TDateTime;
dvLineMatrix : TVpLineMatrix; dvLineMatrix : TVpLineMatrix;
dvColRectArray : TVpColRectArray; dvColRectArray : TVpColRectArray;
dvEventArray : TVpEventArray; dvEventArray : TVpEventArray;
@ -325,12 +334,14 @@ type
procedure SetActiveCol(Value: Integer); procedure SetActiveCol(Value: Integer);
procedure SetWrapStyle (const v : TVpDVWrapStyle); procedure SetWrapStyle (const v : TVpDVWrapStyle);
procedure SetDotDotDotColor (const v : TColor); procedure SetDotDotDotColor (const v : TColor);
procedure SetShowEventTimes(Value: Boolean); procedure SetShowEventTimes(Value: Boolean);
{ drag-drop methods } { drag-drop methods }
{$IFDEF DRAGDROP}
procedure DoStartDrag(var DragObject: TDragObject); override; procedure DoStartDrag(var DragObject: TDragObject); override;
procedure DoEndDrag(Target: TObject; X, Y: Integer); override; procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState; procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); override; var Accept: Boolean); override;
{$ENDIF}
{ internal methods } { internal methods }
function dvCalcRowHeight (Scale: Extended; UseGran: TVpGranularity): Integer; function dvCalcRowHeight (Scale: Extended; UseGran: TVpGranularity): Integer;
function dvCalcVisibleLines (RenderHeight : Integer; function dvCalcVisibleLines (RenderHeight : Integer;
@ -402,11 +413,12 @@ type
procedure LoadLanguage; procedure LoadLanguage;
procedure DeleteActiveEvent(Verify: Boolean); procedure DeleteActiveEvent(Verify: Boolean);
{$IFDEF DRAGDROP}
procedure DragDrop(Source: TObject; X, Y: Integer); override; procedure DragDrop(Source: TObject; X, Y: Integer); override;
{$ENDIF}
function HourToLine (const Value: TVpHours; const UseGran: TVpGranularity): Integer; function HourToLine (const Value: TVpHours; const UseGran: TVpGranularity): Integer;
procedure Invalidate; override; procedure Invalidate; override;
procedure LinkHandler(Sender: TComponent; procedure LinkHandler(Sender: TComponent; NotificationType: TVpNotificationType;
NotificationType: TVpNotificationType;
const Value: Variant); override; const Value: Variant); override;
procedure EditSelectedEvent; procedure EditSelectedEvent;
@ -804,10 +816,12 @@ begin
SetLength(dvEventArray, MaxVisibleEvents); SetLength(dvEventArray, MaxVisibleEvents);
DragMode := dmManual; {$IFDEF DRAGDROP}
DragMode := dmManual;
dvDragging := false;
{$ENDIF}
dvMouseDownPoint := Point(0, 0); dvMouseDownPoint := Point(0, 0);
dvMouseDown := false; dvMouseDown := false;
dvDragging := false;
{ size } { size }
Height := 225; Height := 225;
@ -1296,8 +1310,9 @@ begin
end; end;
{=====} {=====}
{$IFDEF DRAGDROP}
procedure TVpDayView.DoStartDrag(var DragObject: TDragObject); procedure TVpDayView.DoStartDrag(var DragObject: TDragObject);
begin exit; begin //exit;
DvDragStartTime := 0.0; DvDragStartTime := 0.0;
if ReadOnly then if ReadOnly then
Exit; Exit;
@ -1315,7 +1330,7 @@ end;
{=====} {=====}
procedure TVpDayView.DoEndDrag(Target: TObject; X, Y: Integer); procedure TVpDayView.DoEndDrag(Target: TObject; X, Y: Integer);
begin exit; begin //exit;
if ReadOnly then if ReadOnly then
Exit; Exit;
TVpEventDragObject(Target).Free; TVpEventDragObject(Target).Free;
@ -1324,7 +1339,7 @@ end;
procedure TVpDayView.DragOver(Source: TObject; X, Y: Integer; State: TDragState; procedure TVpDayView.DragOver(Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); var Accept: Boolean);
begin exit; begin //exit;
if ReadOnly then begin if ReadOnly then begin
Accept := False; Accept := False;
Exit; Exit;
@ -1346,7 +1361,7 @@ var
DragToTime : TDateTime; DragToTime : TDateTime;
i : Integer; i : Integer;
begin exit; begin //exit;
if ReadOnly then if ReadOnly then
Exit; Exit;
Event := TVpEventDragObject(Source).Event; Event := TVpEventDragObject(Source).Event;
@ -1388,6 +1403,7 @@ begin exit;
// TVpEventDragObject(Source).EndDrag(False); // TVpEventDragObject(Source).EndDrag(False);
end; end;
{=====} {=====}
{$ENDIF}
function TVpDayView.dvCalcRowHeight (Scale : Extended; function TVpDayView.dvCalcRowHeight (Scale : Extended;
UseGran : TVpGranularity) : Integer; UseGran : TVpGranularity) : Integer;
@ -1906,9 +1922,11 @@ begin
inherited MouseUp(Button, Shift, X, Y); inherited MouseUp(Button, Shift, X, Y);
if Button = mbLeft then if Button = mbLeft then
begin begin
dvMouseDownPoint := Point(0, 0); dvMouseDownPoint := Point(0, 0);
dvMouseDown := false; dvMouseDown := false;
dvDragging := false; {$IFDEF DRAGDROP}
dvDragging := false;
{$ENDIF}
end end
else else
begin begin
@ -1919,6 +1937,7 @@ procedure TVpDayView.MouseMove(Shift: TShiftState; X, Y: Integer);
begin begin
inherited MouseMove(Shift, X, Y); inherited MouseMove(Shift, X, Y);
if (FActiveEvent <> nil) and (not ReadOnly) then begin if (FActiveEvent <> nil) and (not ReadOnly) then begin
{$IFDEF DRAGDROP}
if (not dvDragging) and dvMouseDown if (not dvDragging) and dvMouseDown
and ((dvMouseDownPoint.x <> x) or (dvMouseDownPoint.y <> y)) and ((dvMouseDownPoint.x <> x) or (dvMouseDownPoint.y <> y))
then begin then begin
@ -1926,6 +1945,7 @@ begin
dvClickTimer.Enabled := false; dvClickTimer.Enabled := false;
BeginDrag(true); BeginDrag(true);
end; end;
{$ENDIF}
end; end;
end; end;