Several Changes from me in meantime
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2538 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
ff093aa4bf
commit
d433a47a64
@ -228,7 +228,7 @@ type
|
|||||||
|
|
||||||
procedure DeregisterAllWatchers;
|
procedure DeregisterAllWatchers;
|
||||||
procedure DeregisterWatcher (Watcher : THandle);
|
procedure DeregisterWatcher (Watcher : THandle);
|
||||||
function GetNextID(TableName: string): integer; virtual; abstract;
|
function GetNextID(TableName: string): int64; virtual; abstract;
|
||||||
property Resources: TVpResources read FResources;
|
property Resources: TVpResources read FResources;
|
||||||
procedure Load; virtual;
|
procedure Load; virtual;
|
||||||
procedure LoadEvents; virtual; abstract;
|
procedure LoadEvents; virtual; abstract;
|
||||||
|
@ -2121,6 +2121,11 @@ begin
|
|||||||
|
|
||||||
WorkRect := GetNextRectangle (ARegion, LineHeight,
|
WorkRect := GetNextRectangle (ARegion, LineHeight,
|
||||||
AvgCharSize, HPos, linepos);
|
AvgCharSize, HPos, linepos);
|
||||||
|
if (WorkRect.Top = 0)
|
||||||
|
and (WorkRect.left = 0)
|
||||||
|
and (WorkRect.Bottom = 0)
|
||||||
|
and (WorkRect.Right = 0) then
|
||||||
|
Workrect := Regionrect;
|
||||||
if WorkRect.Right - WorkRect.Left > 0 then begin
|
if WorkRect.Right - WorkRect.Left > 0 then begin
|
||||||
VpRotatedCanvas.TextOut (WorkRect.Left + FTextMargin,
|
VpRotatedCanvas.TextOut (WorkRect.Left + FTextMargin,
|
||||||
WorkRect.Top,
|
WorkRect.Top,
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
{* *}
|
{* *}
|
||||||
{* ***** END LICENSE BLOCK ***** *}
|
{* ***** END LICENSE BLOCK ***** *}
|
||||||
|
|
||||||
{$I Vp.INC}
|
{.$I Vp.INC}
|
||||||
|
|
||||||
unit VpConst;
|
unit VpConst;
|
||||||
{-Versioning defines and methods}
|
{-Versioning defines and methods}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
{* *}
|
{* *}
|
||||||
{* ***** END LICENSE BLOCK ***** *}
|
{* ***** END LICENSE BLOCK ***** *}
|
||||||
|
|
||||||
{$I Vp.INC}
|
{$I vp.inc}
|
||||||
|
|
||||||
unit VpContactGrid;
|
unit VpContactGrid;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
{* *}
|
{* *}
|
||||||
{* ***** END LICENSE BLOCK ***** *}
|
{* ***** END LICENSE BLOCK ***** *}
|
||||||
|
|
||||||
{$I Vp.INC}
|
{$I vp.inc}
|
||||||
|
|
||||||
unit VpData;
|
unit VpData;
|
||||||
{ Data classes for Visual PlanIt's resources, events, tasks, contacts, etc... }
|
{ Data classes for Visual PlanIt's resources, events, tasks, contacts, etc... }
|
||||||
@ -74,20 +74,20 @@ type
|
|||||||
FOwner: TObject;
|
FOwner: TObject;
|
||||||
FResourceList: TList;
|
FResourceList: TList;
|
||||||
function Compare(Descr1, Descr2: string): Integer;
|
function Compare(Descr1, Descr2: string): Integer;
|
||||||
function GetItem(Index: Integer): TVpResource;
|
function GetItem(Index: Int64): TVpResource;
|
||||||
function GetCount: Integer;
|
function GetCount: Integer;
|
||||||
function NextResourceID: Integer;
|
function NextResourceID: Int64;
|
||||||
public
|
public
|
||||||
constructor Create(Owner: TObject);
|
constructor Create(Owner: TObject);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function AddResource(ResID: Integer): TVpResource;
|
function AddResource(ResID: Int64): TVpResource;
|
||||||
function FindResourceByName (AName : string) : TVpResource;
|
function FindResourceByName (AName : string) : TVpResource;
|
||||||
function GetResource(ID: integer): TVpResource;
|
function GetResource(ID: Integer): TVpResource;
|
||||||
procedure ClearResources;
|
procedure ClearResources;
|
||||||
procedure RemoveResource(Resource: TVpResource);
|
procedure RemoveResource(Resource: TVpResource);
|
||||||
procedure Sort;
|
procedure Sort;
|
||||||
property Count: Integer read GetCount;
|
property Count: Integer read GetCount;
|
||||||
property Items[Index: Integer]: TVpResource read GetItem;
|
property Items[Index: Int64]: TVpResource read GetItem;
|
||||||
property Owner: TObject read FOwner;
|
property Owner: TObject read FOwner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -171,9 +171,9 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(Owner: TVpResource);
|
constructor Create(Owner: TVpResource);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function AddEvent(RecordID: Integer; StartTime, EndTime: TDateTime): TVpEvent;
|
function AddEvent(RecordID: Int64; StartTime, EndTime: TDateTime): TVpEvent;
|
||||||
procedure DeleteEvent(Event: TVpEvent);
|
procedure DeleteEvent(Event: TVpEvent);
|
||||||
function GetEvent(Index: Integer): TVpEvent;
|
function GetEvent(Index: Int64): TVpEvent;
|
||||||
function RepeatsOn(Event: TVpEvent; Day: TDateTime): Boolean;
|
function RepeatsOn(Event: TVpEvent; Day: TDateTime): Boolean;
|
||||||
procedure Sort;
|
procedure Sort;
|
||||||
procedure ClearEvents;
|
procedure ClearEvents;
|
||||||
@ -204,7 +204,7 @@ type
|
|||||||
FAlarmAdv: Integer;
|
FAlarmAdv: Integer;
|
||||||
FAlertDisplayed: Boolean;
|
FAlertDisplayed: Boolean;
|
||||||
FAlarmAdvType: TVpAlarmAdvType;
|
FAlarmAdvType: TVpAlarmAdvType;
|
||||||
FRecordID: Integer;
|
FRecordID: Int64;
|
||||||
FNote: string;
|
FNote: string;
|
||||||
FDescription: string;
|
FDescription: string;
|
||||||
FStartTime: TDateTime;
|
FStartTime: TDateTime;
|
||||||
@ -237,7 +237,7 @@ type
|
|||||||
procedure SetDescription(const Value: string);
|
procedure SetDescription(const Value: string);
|
||||||
procedure SetEndTime(Value: TDateTime);
|
procedure SetEndTime(Value: TDateTime);
|
||||||
procedure SetNote(const Value: string);
|
procedure SetNote(const Value: string);
|
||||||
procedure SetRecordID(Value: Integer);
|
procedure SetRecordID(Value: Int64);
|
||||||
procedure SetStartTime(Value: TDateTime);
|
procedure SetStartTime(Value: TDateTime);
|
||||||
procedure SetCustInterval(Value: Integer);
|
procedure SetCustInterval(Value: Integer);
|
||||||
procedure SetRepeatCode(Value: TVpRepeatType);
|
procedure SetRepeatCode(Value: TVpRepeatType);
|
||||||
@ -251,7 +251,7 @@ type
|
|||||||
property Changed: Boolean read FChanged write SetChanged;
|
property Changed: Boolean read FChanged write SetChanged;
|
||||||
property Deleted: Boolean read FDeleted write SetDeleted;
|
property Deleted: Boolean read FDeleted write SetDeleted;
|
||||||
property ItemIndex: Integer read FItemIndex;
|
property ItemIndex: Integer read FItemIndex;
|
||||||
property RecordID : Integer read FRecordID write SetRecordID;
|
property RecordID : Int64 read FRecordID write SetRecordID;
|
||||||
property StartTime : TDateTime read FStartTime write SetStartTime;
|
property StartTime : TDateTime read FStartTime write SetStartTime;
|
||||||
property EndTime : TDateTime read FEndTime write SetEndTime;
|
property EndTime : TDateTime read FEndTime write SetEndTime;
|
||||||
property Description : string read FDescription write SetDescription;
|
property Description : string read FDescription write SetDescription;
|
||||||
@ -296,7 +296,7 @@ type
|
|||||||
procedure BatchUpdate(value: Boolean);
|
procedure BatchUpdate(value: Boolean);
|
||||||
procedure Sort;
|
procedure Sort;
|
||||||
function Compare(Item1, Item2: TVpTask): Integer;
|
function Compare(Item1, Item2: TVpTask): Integer;
|
||||||
function AddTask(RecordID: Integer): TVpTask;
|
function AddTask(RecordID: Int64): TVpTask;
|
||||||
function Count : Integer;
|
function Count : Integer;
|
||||||
function CountByDay(Date: TDateTime): Integer;
|
function CountByDay(Date: TDateTime): Integer;
|
||||||
function Last: TVpTask;
|
function Last: TVpTask;
|
||||||
@ -572,7 +572,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TVpResources.GetItem(Index: Integer): TVpResource;
|
function TVpResources.GetItem(Index: Int64): TVpResource;
|
||||||
begin
|
begin
|
||||||
result := TVpResource(FResourceList.List^[Index]);
|
result := TVpResource(FResourceList.List^[Index]);
|
||||||
end;
|
end;
|
||||||
@ -584,9 +584,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TVpResources.NextResourceID: Integer;
|
function TVpResources.NextResourceID: Int64;
|
||||||
var
|
var
|
||||||
I, ID: Integer;
|
I : Integer;
|
||||||
|
ID: Int64;
|
||||||
Res: TVpResource;
|
Res: TVpResource;
|
||||||
begin
|
begin
|
||||||
ID := 0;
|
ID := 0;
|
||||||
@ -600,7 +601,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TVpResources.AddResource(ResID: Integer): TVpResource;
|
function TVpResources.AddResource(ResID: Int64): TVpResource;
|
||||||
var
|
var
|
||||||
Resource : TVpResource;
|
Resource : TVpResource;
|
||||||
begin
|
begin
|
||||||
@ -962,7 +963,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpEvent.SetRecordID(Value: Integer);
|
procedure TVpEvent.SetRecordID(Value: Int64);
|
||||||
begin
|
begin
|
||||||
if Value <> FRecordID then begin
|
if Value <> FRecordID then begin
|
||||||
FRecordID := Value;
|
FRecordID := Value;
|
||||||
@ -1101,7 +1102,7 @@ end;
|
|||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
{Adds the event to the eventlist and returns a pointer to it, or nil on failure}
|
{Adds the event to the eventlist and returns a pointer to it, or nil on failure}
|
||||||
function TVpSchedule.AddEvent(RecordID: Integer; StartTime,
|
function TVpSchedule.AddEvent(RecordID: Int64; StartTime,
|
||||||
EndTime: TDateTime): TVpEvent;
|
EndTime: TDateTime): TVpEvent;
|
||||||
begin
|
begin
|
||||||
result := nil;
|
result := nil;
|
||||||
@ -1157,7 +1158,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TVpSchedule.GetEvent(Index: Integer): TVpEvent;
|
function TVpSchedule.GetEvent(Index: Int64): TVpEvent;
|
||||||
begin
|
begin
|
||||||
{ Returns an event on success or nil on failure }
|
{ Returns an event on success or nil on failure }
|
||||||
result := FEventList.Items[Index];
|
result := FEventList.Items[Index];
|
||||||
@ -2114,7 +2115,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TVpTasks.AddTask(RecordID: Integer): TVpTask;
|
function TVpTasks.AddTask(RecordID: Int64): TVpTask;
|
||||||
var
|
var
|
||||||
Task: TVpTask;
|
Task: TVpTask;
|
||||||
begin
|
begin
|
||||||
|
@ -817,6 +817,7 @@ begin
|
|||||||
Width := 265;
|
Width := 265;
|
||||||
|
|
||||||
FDefaultPopup := TPopupMenu.Create (Self);
|
FDefaultPopup := TPopupMenu.Create (Self);
|
||||||
|
Self.PopupMenu := FDefaultPopup;
|
||||||
LoadLanguage;
|
LoadLanguage;
|
||||||
|
|
||||||
dvHookUp;
|
dvHookUp;
|
||||||
@ -1983,9 +1984,6 @@ begin
|
|||||||
else
|
else
|
||||||
for i := 0 to FDefaultPopup.Items.Count - 1 do
|
for i := 0 to FDefaultPopup.Items.Count - 1 do
|
||||||
FDefaultPopup.Items[i].Enabled := True;
|
FDefaultPopup.Items[i].Enabled := True;
|
||||||
|
|
||||||
FDefaultPopup.Popup (x + ClientOrigin.x,
|
|
||||||
y + ClientOrigin.y);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3916,7 +3914,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
if ((EventRect.Bottom > IconRect.Bottom) and
|
if ((EventRect.Bottom > IconRect.Bottom) and
|
||||||
(EventRect.Left > IconRect.Right)) or
|
(EventRect.Left > IconRect.Right)) or
|
||||||
(WrapStyle = wsNoFlow) then begin
|
(WrapStyle = wsIconFlow) then begin
|
||||||
DeleteObject (WorkRegion1);
|
DeleteObject (WorkRegion1);
|
||||||
DeleteObject (WorkRegion2);
|
DeleteObject (WorkRegion2);
|
||||||
DeleteObject (TextRegion);
|
DeleteObject (TextRegion);
|
||||||
|
@ -366,6 +366,7 @@ begin
|
|||||||
Width := 300;
|
Width := 300;
|
||||||
|
|
||||||
FDefaultPopup := TPopupMenu.Create (Self);
|
FDefaultPopup := TPopupMenu.Create (Self);
|
||||||
|
Self.PopupMenu := FDefaultPopup;
|
||||||
LoadLanguage;
|
LoadLanguage;
|
||||||
|
|
||||||
mvHookUp;
|
mvHookUp;
|
||||||
@ -1490,9 +1491,6 @@ begin
|
|||||||
if FRightClickChangeDate then
|
if FRightClickChangeDate then
|
||||||
mvSetDateByCoord (Point (Msg.XPos, Msg.YPos));
|
mvSetDateByCoord (Point (Msg.XPos, Msg.YPos));
|
||||||
ClientOrigin := GetClientOrigin;
|
ClientOrigin := GetClientOrigin;
|
||||||
|
|
||||||
FDefaultPopup.Popup (Msg.XPos + ClientOrigin.x,
|
|
||||||
Msg.YPos + ClientOrigin.y);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
@ -117,6 +117,8 @@ type
|
|||||||
{ TVpWeekView }
|
{ TVpWeekView }
|
||||||
|
|
||||||
TVpWeekView = class(TVpLinkableControl)
|
TVpWeekView = class(TVpLinkableControl)
|
||||||
|
private
|
||||||
|
procedure SetActiveEvent(AValue: TVpEvent);
|
||||||
protected{ private }
|
protected{ private }
|
||||||
FActiveDate : TDateTime;
|
FActiveDate : TDateTime;
|
||||||
FColumnWidth : Integer;
|
FColumnWidth : Integer;
|
||||||
@ -124,7 +126,7 @@ type
|
|||||||
FDateLabelFormat : string;
|
FDateLabelFormat : string;
|
||||||
FDayHeadAttributes : TVpDayHeadAttr;
|
FDayHeadAttributes : TVpDayHeadAttr;
|
||||||
FDrawingStyle : TVpDrawingStyle;
|
FDrawingStyle : TVpDrawingStyle;
|
||||||
FActiveEvent : TVpEvent;
|
FaActiveEvent : TVpEvent;
|
||||||
FHeadAttr : TVpWvHeadAttributes;
|
FHeadAttr : TVpWvHeadAttributes;
|
||||||
FEventFont : TFont;
|
FEventFont : TFont;
|
||||||
FLineColor : TColor;
|
FLineColor : TColor;
|
||||||
@ -206,6 +208,7 @@ type
|
|||||||
procedure WMSize(var Msg: TLMSize); message LM_SIZE;
|
procedure WMSize(var Msg: TLMSize); message LM_SIZE;
|
||||||
procedure WMLButtonDown(var Msg : TLMLButtonDown); message LM_LBUTTONDOWN;
|
procedure WMLButtonDown(var Msg : TLMLButtonDown); message LM_LBUTTONDOWN;
|
||||||
procedure WMLButtonDblClk(var Msg : TLMLButtonDblClk); message LM_LBUTTONDBLCLK;
|
procedure WMLButtonDblClk(var Msg : TLMLButtonDblClk); message LM_LBUTTONDBLCLK;
|
||||||
|
//TODO: Bug 0020755 braks this in GTK2...
|
||||||
procedure WMRButtonDown(var Msg : TLMRButtonDown); message LM_RBUTTONDOWN;
|
procedure WMRButtonDown(var Msg : TLMRButtonDown); message LM_RBUTTONDOWN;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
@ -232,7 +235,7 @@ type
|
|||||||
StopLine : Integer;
|
StopLine : Integer;
|
||||||
UseGran : TVpGranularity;
|
UseGran : TVpGranularity;
|
||||||
DisplayOnly : Boolean); override;
|
DisplayOnly : Boolean); override;
|
||||||
property ActiveEvent: TVpEvent read FActiveEvent;
|
property ActiveEvent: TVpEvent read FaActiveEvent write SetActiveEvent;
|
||||||
property Date: TDateTime read FActiveDate write SetActiveDate;
|
property Date: TDateTime read FActiveDate write SetActiveDate;
|
||||||
property VisibleLines: Integer read FVisibleLines;
|
property VisibleLines: Integer read FVisibleLines;
|
||||||
published
|
published
|
||||||
@ -466,6 +469,7 @@ begin
|
|||||||
Width := 300;
|
Width := 300;
|
||||||
|
|
||||||
FDefaultPopup := TPopupMenu.Create (Self);
|
FDefaultPopup := TPopupMenu.Create (Self);
|
||||||
|
Self.PopupMenu := FDefaultPopup;
|
||||||
LoadLanguage;
|
LoadLanguage;
|
||||||
|
|
||||||
FAllDayEventAttr.BackgroundColor := Color;
|
FAllDayEventAttr.BackgroundColor := Color;
|
||||||
@ -1208,8 +1212,9 @@ var
|
|||||||
begin
|
begin
|
||||||
DoIt := not Verify;
|
DoIt := not Verify;
|
||||||
|
|
||||||
if FActiveEvent <> nil then begin
|
EndEdit(nil);
|
||||||
Str := '"' + FActiveEvent.Description + '"';
|
if ActiveEvent <> nil then begin
|
||||||
|
Str := '"' + ActiveEvent.Description + '"';
|
||||||
|
|
||||||
if Verify then
|
if Verify then
|
||||||
DoIt := (MessageDlg(RSDelete + ' ' + Str + ' ' + RSFromSchedule
|
DoIt := (MessageDlg(RSDelete + ' ' + Str + ' ' + RSFromSchedule
|
||||||
@ -1217,8 +1222,8 @@ begin
|
|||||||
[mbYes, mbNo], 0) = mrYes);
|
[mbYes, mbNo], 0) = mrYes);
|
||||||
|
|
||||||
if DoIt then begin
|
if DoIt then begin
|
||||||
FActiveEvent.Deleted := true;
|
ActiveEvent.Deleted := true;
|
||||||
FActiveEvent := nil;
|
ActiveEvent := nil;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
@ -1245,6 +1250,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
procedure TVpWeekView.SetActiveEvent(AValue: TVpEvent);
|
||||||
|
begin
|
||||||
|
if FaActiveEvent=AValue then Exit;
|
||||||
|
FaActiveEvent:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TVpWeekView.SetDrawingStyle(Value: TVpDrawingStyle);
|
procedure TVpWeekView.SetDrawingStyle(Value: TVpDrawingStyle);
|
||||||
begin
|
begin
|
||||||
if FDrawingStyle <> Value then begin
|
if FDrawingStyle <> Value then begin
|
||||||
@ -1404,6 +1415,9 @@ begin
|
|||||||
if DataStore = nil then
|
if DataStore = nil then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
|
wvSetDateByCoord(Point(Msg.XPos, Msg.YPos));
|
||||||
|
EventAtCoord (Point (Msg.XPos, Msg.YPos));
|
||||||
|
|
||||||
// if the mouse was pressed down in the client area, then select the cell.
|
// if the mouse was pressed down in the client area, then select the cell.
|
||||||
if not focused then SetFocus;
|
if not focused then SetFocus;
|
||||||
|
|
||||||
@ -1411,7 +1425,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
{ The mouse click landed inside the client area }
|
{ The mouse click landed inside the client area }
|
||||||
{ If we have hit an active event then we must want to edit it }
|
{ If we have hit an active event then we must want to edit it }
|
||||||
if FActiveEvent <> nil then begin
|
if ActiveEvent <> nil then begin
|
||||||
{ edit this event }
|
{ edit this event }
|
||||||
wvSpawnEventEditDialog(False);
|
wvSpawnEventEditDialog(False);
|
||||||
end
|
end
|
||||||
@ -1419,7 +1433,7 @@ begin
|
|||||||
{ otherwise, we must want to create a new event }
|
{ otherwise, we must want to create a new event }
|
||||||
StartTime := trunc(Date) + 1 / 2; { default to 12:00 noon }
|
StartTime := trunc(Date) + 1 / 2; { default to 12:00 noon }
|
||||||
EndTime := StartTime + (30 / MinutesInDay); { StartTime + 30 minutes }
|
EndTime := StartTime + (30 / MinutesInDay); { StartTime + 30 minutes }
|
||||||
FActiveEvent := DataStore.Resource.Schedule.AddEvent(
|
ActiveEvent := DataStore.Resource.Schedule.AddEvent(
|
||||||
DataStore.GetNextID('Events'), StartTime, EndTime);
|
DataStore.GetNextID('Events'), StartTime, EndTime);
|
||||||
{ edit this new event }
|
{ edit this new event }
|
||||||
wvSpawnEventEditDialog(True);
|
wvSpawnEventEditDialog(True);
|
||||||
@ -1439,17 +1453,16 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if not Assigned (PopupMenu) then begin
|
if not Assigned (PopupMenu) then begin
|
||||||
if not focused then
|
// if not focused then
|
||||||
SetFocus;
|
// SetFocus;
|
||||||
{ The mouse click landed inside the client area }
|
{ The mouse click landed inside the client area }
|
||||||
wvSetDateByCoord(Point(Msg.XPos, Msg.YPos));
|
wvSetDateByCoord(Point(Msg.XPos, Msg.YPos));
|
||||||
EventAtCoord (Point (Msg.XPos, Msg.YPos));
|
EventAtCoord (Point (Msg.XPos, Msg.YPos));
|
||||||
wvClickTimer.Enabled := false;
|
wvClickTimer.Enabled := false;
|
||||||
ClientOrigin := GetClientOrigin;
|
ClientOrigin := GetClientOrigin;
|
||||||
|
|
||||||
if not Assigned (FActiveEvent) then
|
if not Assigned (ActiveEvent) then
|
||||||
for i := 0 to FDefaultPopup.Items.Count - 1 do begin
|
for i := 0 to FDefaultPopup.Items.Count - 1 do begin
|
||||||
if (FDefaultPopup.Items[i].Tag = 1) or (ReadOnly) then
|
if (FDefaultPopup.Items[i].Tag = 1) or (ReadOnly) then
|
||||||
FDefaultPopup.Items[i].Enabled := False;
|
FDefaultPopup.Items[i].Enabled := False;
|
||||||
@ -1457,9 +1470,6 @@ begin
|
|||||||
else
|
else
|
||||||
for i := 0 to FDefaultPopup.Items.Count - 1 do
|
for i := 0 to FDefaultPopup.Items.Count - 1 do
|
||||||
FDefaultPopup.Items[i].Enabled := True;
|
FDefaultPopup.Items[i].Enabled := True;
|
||||||
|
|
||||||
FDefaultPopup.Popup (Msg.XPos + ClientOrigin.x,
|
|
||||||
Msg.YPos + ClientOrigin.y);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
@ -1575,7 +1585,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
StartTime := trunc(Date) + 1 / 2; { default to 12:00 noon }
|
StartTime := trunc(Date) + 1 / 2; { default to 12:00 noon }
|
||||||
EndTime := StartTime + (30 / MinutesInDay); { StartTime + 30 minutes }
|
EndTime := StartTime + (30 / MinutesInDay); { StartTime + 30 minutes }
|
||||||
FActiveEvent := DataStore.Resource.Schedule.AddEvent (
|
ActiveEvent := DataStore.Resource.Schedule.AddEvent (
|
||||||
DataStore.GetNextID ('Events'), StartTime, EndTime);
|
DataStore.GetNextID ('Events'), StartTime, EndTime);
|
||||||
{ edit this new event }
|
{ edit this new event }
|
||||||
wvSpawnEventEditDialog (True);
|
wvSpawnEventEditDialog (True);
|
||||||
@ -1586,7 +1596,7 @@ procedure TVpWeekView.PopupDeleteEvent (Sender : TObject);
|
|||||||
begin
|
begin
|
||||||
if ReadOnly then
|
if ReadOnly then
|
||||||
Exit;
|
Exit;
|
||||||
if FActiveEvent <> nil then
|
if ActiveEvent <> nil then
|
||||||
DeleteActiveEvent (True);
|
DeleteActiveEvent (True);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
@ -1595,7 +1605,7 @@ procedure TVpWeekView.PopupEditEvent (Sender : TObject);
|
|||||||
begin
|
begin
|
||||||
if ReadOnly then
|
if ReadOnly then
|
||||||
Exit;
|
Exit;
|
||||||
if FActiveEvent <> nil then
|
if ActiveEvent <> nil then
|
||||||
{ edit this Event }
|
{ edit this Event }
|
||||||
wvSpawnEventEditDialog(False);
|
wvSpawnEventEditDialog(False);
|
||||||
end;
|
end;
|
||||||
@ -1603,7 +1613,7 @@ end;
|
|||||||
|
|
||||||
procedure TVpWeekView.EditSelectedEvent;
|
procedure TVpWeekView.EditSelectedEvent;
|
||||||
begin
|
begin
|
||||||
if FActiveEvent <> nil then
|
if ActiveEvent <> nil then
|
||||||
wvSpawnEventEditDialog(false);
|
wvSpawnEventEditDialog(false);
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
@ -1690,27 +1700,27 @@ begin
|
|||||||
|
|
||||||
AllowIt := false;
|
AllowIt := false;
|
||||||
if Assigned(FOwnerEditEvent) then
|
if Assigned(FOwnerEditEvent) then
|
||||||
FOwnerEditEvent(self, FActiveEvent, DataStore.Resource, AllowIt)
|
FOwnerEditEvent(self, ActiveEvent, DataStore.Resource, AllowIt)
|
||||||
else begin
|
else begin
|
||||||
EventDlg := TVpEventEditDialog.Create(nil);
|
EventDlg := TVpEventEditDialog.Create(nil);
|
||||||
try
|
try
|
||||||
EventDlg.DataStore := DataStore;
|
EventDlg.DataStore := DataStore;
|
||||||
AllowIt := EventDlg.Execute(FActiveEvent, FTimeFormat);
|
AllowIt := EventDlg.Execute(ActiveEvent, FTimeFormat);
|
||||||
finally
|
finally
|
||||||
EventDlg.Free;
|
EventDlg.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
FActiveEvent.Changed := true;
|
ActiveEvent.Changed := true;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
if Assigned(FOnAddEvent) then
|
if Assigned(FOnAddEvent) then
|
||||||
FOnAddEvent(self, FActiveEvent);
|
FOnAddEvent(self, ActiveEvent);
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end else begin
|
end else begin
|
||||||
if NewEvent then begin
|
if NewEvent then begin
|
||||||
DataStore.Resource.Schedule.DeleteEvent(FActiveEvent);
|
DataStore.Resource.Schedule.DeleteEvent(ActiveEvent);
|
||||||
FActiveEvent := nil;
|
ActiveEvent := nil;
|
||||||
end;
|
end;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
@ -1752,7 +1762,7 @@ begin
|
|||||||
for I := 0 to pred(Length(wvEventArray)) do begin
|
for I := 0 to pred(Length(wvEventArray)) do begin
|
||||||
if wvEventArray[I].Event = nil then begin
|
if wvEventArray[I].Event = nil then begin
|
||||||
{ we've hit the end of visible events without finding a match }
|
{ we've hit the end of visible events without finding a match }
|
||||||
FActiveEvent := nil;
|
ActiveEvent := nil;
|
||||||
wvActiveEventRec.Top := 0;
|
wvActiveEventRec.Top := 0;
|
||||||
wvActiveEventRec.Bottom := 0;
|
wvActiveEventRec.Bottom := 0;
|
||||||
wvActiveEventRec.Right := 0;
|
wvActiveEventRec.Right := 0;
|
||||||
@ -1767,7 +1777,7 @@ begin
|
|||||||
and (Pt.Y < wvEventArray[I].Rec.Bottom) then begin
|
and (Pt.Y < wvEventArray[I].Rec.Bottom) then begin
|
||||||
{ point falls inside this event's rectangle }
|
{ point falls inside this event's rectangle }
|
||||||
wvHotPoint := Pt;
|
wvHotPoint := Pt;
|
||||||
FActiveEvent := TVpEvent(wvEventArray[I].Event);
|
ActiveEvent := TVpEvent(wvEventArray[I].Event);
|
||||||
wvActiveEventRec := wvEventArray[I].Rec;
|
wvActiveEventRec := wvEventArray[I].Rec;
|
||||||
result := true;
|
result := true;
|
||||||
Exit;
|
Exit;
|
||||||
@ -1775,7 +1785,7 @@ begin
|
|||||||
|
|
||||||
else begin
|
else begin
|
||||||
{ point is not within the boundaries of this event's rectangle. }
|
{ point is not within the boundaries of this event's rectangle. }
|
||||||
FActiveEvent := nil;
|
ActiveEvent := nil;
|
||||||
wvActiveEventRec.Top := 0;
|
wvActiveEventRec.Top := 0;
|
||||||
wvActiveEventRec.Bottom := 0;
|
wvActiveEventRec.Bottom := 0;
|
||||||
wvActiveEventRec.Right := 0;
|
wvActiveEventRec.Right := 0;
|
||||||
@ -1800,11 +1810,11 @@ procedure TVpWeekView.EditEvent;
|
|||||||
var
|
var
|
||||||
AllowIt: Boolean;
|
AllowIt: Boolean;
|
||||||
begin
|
begin
|
||||||
if FActiveEvent <> nil then begin
|
if ActiveEvent <> nil then begin
|
||||||
AllowIt := true;
|
AllowIt := true;
|
||||||
{ call the user defined BeforeEdit event }
|
{ call the user defined BeforeEdit event }
|
||||||
if Assigned(FBeforeEdit) then
|
if Assigned(FBeforeEdit) then
|
||||||
FBeforeEdit(Self, FActiveEvent, AllowIt);
|
FBeforeEdit(Self, ActiveEvent, AllowIt);
|
||||||
|
|
||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
{ create and spawn the in-place editor }
|
{ create and spawn the in-place editor }
|
||||||
@ -1815,7 +1825,7 @@ begin
|
|||||||
wvActiveEventRec.Top,
|
wvActiveEventRec.Top,
|
||||||
wvActiveEventRec.Right - (TextMargin*2),
|
wvActiveEventRec.Right - (TextMargin*2),
|
||||||
wvActiveEventRec.Bottom- (TextMargin*2));
|
wvActiveEventRec.Bottom- (TextMargin*2));
|
||||||
wvInPlaceEditor.Text := FActiveEvent.Description;
|
wvInPlaceEditor.Text := ActiveEvent.Description;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
wvInPlaceEditor.SetFocus;
|
wvInPlaceEditor.SetFocus;
|
||||||
end;
|
end;
|
||||||
@ -1919,11 +1929,11 @@ end;
|
|||||||
procedure TVpWeekView.EndEdit(Sender: TObject);
|
procedure TVpWeekView.EndEdit(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if wvInPlaceEditor <> nil then begin
|
if wvInPlaceEditor <> nil then begin
|
||||||
if wvInPlaceEditor.Text <> FActiveEvent.Description then begin
|
if wvInPlaceEditor.Text <> ActiveEvent.Description then begin
|
||||||
FActiveEvent.Description := wvInPlaceEditor.Text;
|
ActiveEvent.Description := wvInPlaceEditor.Text;
|
||||||
FActiveEvent.Changed := true;
|
ActiveEvent.Changed := true;
|
||||||
if Assigned(FAfterEdit) then
|
if Assigned(FAfterEdit) then
|
||||||
FAfterEdit(self, FActiveEvent);
|
FAfterEdit(self, ActiveEvent);
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
end;
|
end;
|
||||||
wvInPlaceEditor.Free;
|
wvInPlaceEditor.Free;
|
||||||
|
@ -669,7 +669,7 @@ end;
|
|||||||
procedure TVpMemoryStream.SetPointer(Ptr : Pointer; Size : Integer);
|
procedure TVpMemoryStream.SetPointer(Ptr : Pointer; Size : Integer);
|
||||||
begin
|
begin
|
||||||
Assert(not Assigned(Memory));
|
Assert(not Assigned(Memory));
|
||||||
// inherited;
|
// inherited SetPointer(Ptr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{===TVpFileStream====================================================}
|
{===TVpFileStream====================================================}
|
||||||
|
Loading…
Reference in New Issue
Block a user