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