You've already forked lazarus-ccr
tvplanit: Cosmetic format changes in units vpbase and vpflxds
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4727 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -96,7 +96,6 @@ type
|
||||
|
||||
TVpGetEditorCaption = procedure(var Caption : string) of object;
|
||||
|
||||
|
||||
{ XML exceptions }
|
||||
EXML = class (Exception);
|
||||
|
||||
@ -104,8 +103,7 @@ type
|
||||
private
|
||||
seFilePos : Longint;
|
||||
public
|
||||
constructor CreateError(const FilePos : Longint;
|
||||
const Reason : DOMString);
|
||||
constructor CreateError(const FilePos: Longint; const Reason: DOMString);
|
||||
property FilePos: Longint
|
||||
read seFilePos;
|
||||
end;
|
||||
@ -116,21 +114,15 @@ type
|
||||
feLine: Longint;
|
||||
feLinePos: Longint;
|
||||
public
|
||||
constructor CreateError(const FilePos, Line, LinePos : Longint;
|
||||
const Reason : DOMString);
|
||||
property Reason : DOMString
|
||||
read feReason;
|
||||
property Line : Longint
|
||||
read feLine;
|
||||
property LinePos : Longint
|
||||
read feLinePos;
|
||||
constructor CreateError(const FilePos, Line, LinePos: Longint; const Reason: DOMString);
|
||||
property Reason : DOMString read feReason;
|
||||
property Line : Longint read feLine;
|
||||
property LinePos : Longint read feLinePos;
|
||||
end;
|
||||
|
||||
EVpParserError = class(EVpFilterError)
|
||||
protected
|
||||
public
|
||||
constructor CreateError(Line, LinePos : Longint;
|
||||
const Reason : DOMString);
|
||||
constructor CreateError(Line, LinePos: Longint; const Reason: DOMString);
|
||||
end;
|
||||
|
||||
{ implements the Version property with its associated design time About box }
|
||||
@ -162,13 +154,11 @@ type
|
||||
{$ENDIF}
|
||||
|
||||
protected
|
||||
procedure DoOnMouseWheel(Shift : TShiftState;
|
||||
Delta, XPos, YPos : SmallInt); dynamic;
|
||||
procedure DoOnMouseWheel(Shift: TShiftState; Delta, XPos, YPos: SmallInt); dynamic;
|
||||
procedure CreateWnd; override;
|
||||
property AfterEnter: TNotifyEvent read FAfterEnter write FAfterEnter;
|
||||
property AfterExit: TNotifyEvent read FAfterExit write FAfterExit;
|
||||
property OnMouseWheel : TVpMouseWheelEvent read FOnMouseWheel
|
||||
write FOnMouseWheel;
|
||||
property OnMouseWheel: TVpMouseWheelEvent read FOnMouseWheel write FOnMouseWheel;
|
||||
|
||||
public
|
||||
constructor Create (AOwner : TComponent); override;
|
||||
@ -214,8 +204,7 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
property BackgroundColor : TColor
|
||||
read FBackgroundColor write SetBackgroundColor
|
||||
property BackgroundColor : TColor read FBackgroundColor write SetBackgroundColor
|
||||
default clWindow;
|
||||
property Bitmap : TBitmap read FBitmap write SetBitmap;
|
||||
property Color: TColor read FColor write SetColor;
|
||||
@ -296,8 +285,7 @@ type
|
||||
function GetCount : Integer;
|
||||
procedure Loaded;
|
||||
public
|
||||
constructor Create(AOwner : TPersistent;
|
||||
ItemClass : TCollectionItemClass); virtual;
|
||||
constructor Create(AOwner : TPersistent; ItemClass : TCollectionItemClass); virtual;
|
||||
destructor Destroy; override;
|
||||
property ItemEditor: TForm read FItemEditor write FItemEditor;
|
||||
function Add: TVpCollectionItem; dynamic;
|
||||
@ -312,16 +300,11 @@ type
|
||||
function ItemByName(const Name: string) : TVpCollectionItem;
|
||||
function ParentForm: TForm;
|
||||
property Count: Integer read GetCount;
|
||||
property Item[Index: Integer] : TVpCollectionItem
|
||||
read GetItem write SetItem; default;
|
||||
property OnGetEditorCaption : TVpGetEditorCaption
|
||||
read FOnGetEditorCaption write FOnGetEditorCaption;
|
||||
property ReadOnly : Boolean
|
||||
read FReadOnly write FReadOnly default False;
|
||||
property OnChanged : TNotifyEvent
|
||||
read FOnChanged write FOnChanged;
|
||||
property OnItemSelected : TVpItemSelectedEvent
|
||||
read FOnItemSelected write FOnItemSelected;
|
||||
property Item[Index: Integer] : TVpCollectionItem read GetItem write SetItem; default;
|
||||
property OnGetEditorCaption : TVpGetEditorCaption read FOnGetEditorCaption write FOnGetEditorCaption;
|
||||
property ReadOnly : Boolean read FReadOnly write FReadOnly default False;
|
||||
property OnChanged : TNotifyEvent read FOnChanged write FOnChanged;
|
||||
property OnItemSelected : TVpItemSelectedEvent read FOnItemSelected write FOnItemSelected;
|
||||
end;
|
||||
|
||||
TVpContainerList = class(TList)
|
||||
@ -378,8 +361,7 @@ type
|
||||
property Holiday: TColor read FHoliday write SetHoliday;
|
||||
property Weekday: TColor read FWeekday write SetWeekday;
|
||||
property Weekend: TColor read FWeekend write SetWeekend;
|
||||
property ActiveRange: TVpTimeRange
|
||||
read FActiveRange write FActiveRange;
|
||||
property ActiveRange: TVpTimeRange read FActiveRange write FActiveRange;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -404,11 +386,10 @@ end;
|
||||
|
||||
{ EAdFilterError }
|
||||
|
||||
constructor EVpFilterError.CreateError(const FilePos, Line,
|
||||
LinePos: Integer; const Reason: DOMString);
|
||||
constructor EVpFilterError.CreateError(const FilePos, Line, LinePos: Integer;
|
||||
const Reason: DOMString);
|
||||
begin
|
||||
inherited CreateError(FilePos, Reason);
|
||||
|
||||
feLine := Line;
|
||||
feLinePos := LinePos;
|
||||
feReason := Reason;
|
||||
@ -446,8 +427,8 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpCustomControl.DoOnMouseWheel(Shift: TShiftState; Delta, XPos,
|
||||
YPos: SmallInt);
|
||||
procedure TVpCustomControl.DoOnMouseWheel(Shift: TShiftState;
|
||||
Delta, XPos, YPos: SmallInt);
|
||||
begin
|
||||
if Assigned(FOnMouseWheel) then
|
||||
FOnMouseWheel(Self, Shift, Delta, XPos, YPos);
|
||||
@ -475,15 +456,16 @@ begin
|
||||
with Msg do
|
||||
DoOnMouseWheel(KeysToShiftState(LOWORD(wParam)) {fwKeys},
|
||||
HIWORD(wParam) {zDelta},
|
||||
LOWORD(lParam) {xPos}, HIWORD(lParam) {yPos});
|
||||
LOWORD(lParam) {xPos},
|
||||
HIWORD(lParam) {yPos}
|
||||
);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
(*****************************************************************************)
|
||||
{ TVpCollection }
|
||||
|
||||
constructor TVpCollection.Create(AOwner : TPersistent;
|
||||
ItemClass : TCollectionItemClass);
|
||||
constructor TVpCollection.Create(AOwner: TPersistent; ItemClass: TCollectionItemClass);
|
||||
begin
|
||||
FOwner := AOwner;
|
||||
Inherited Create(ItemClass);
|
||||
@ -660,9 +642,10 @@ end;
|
||||
procedure TVpFont.Changed;
|
||||
begin
|
||||
inherited;
|
||||
Assert((FOwner is TControl) or (FOwner is TVpPersistent),
|
||||
Format('TVpFont.Changed: Unexpected parent class: %s',
|
||||
[FOwner.ClassName]));
|
||||
Assert(
|
||||
(FOwner is TControl) or (FOwner is TVpPersistent),
|
||||
Format('TVpFont.Changed: Unexpected parent class: %s', [FOwner.ClassName])
|
||||
);
|
||||
if FOwner is TControl then
|
||||
TControl(FOwner).Invalidate
|
||||
else if FOwner is TVpPersistent then
|
||||
@ -683,7 +666,6 @@ end;
|
||||
constructor TVpCategoryColorMap.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FCat0 := TVpCategoryInfo.Create;
|
||||
FCat0.Color := clNavy;
|
||||
FCat0.Description := RSCategoryDesc0;
|
||||
@ -787,7 +769,6 @@ end;
|
||||
constructor TVpCategoryInfo.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FBitmap := TBitmap.Create;
|
||||
FBackgroundColor := clWindow;
|
||||
end;
|
||||
@ -795,7 +776,6 @@ end;
|
||||
destructor TVpCategoryInfo.Destroy;
|
||||
begin
|
||||
FBitmap.Free;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -857,7 +837,6 @@ begin
|
||||
{ start to be one hour earlier than the end }
|
||||
if FRangeBegin > Value then
|
||||
FRangeBegin := TVpHours(Ord(Value) - 1);
|
||||
|
||||
FRangeEnd := Value;
|
||||
SetEndTime((Ord(Value) * 60) / MinutesInDay);
|
||||
end;
|
||||
@ -868,7 +847,6 @@ begin
|
||||
if Value < StartTime then
|
||||
StartTime := Value - (30 / MinutesInDay);
|
||||
FEndTime := Value;
|
||||
|
||||
if FOwner is TVpTimeSlotColor then
|
||||
(FOwner as TVpTimeSlotColor).Changed;
|
||||
end;
|
||||
@ -879,7 +857,6 @@ begin
|
||||
if Value > EndTime then
|
||||
EndTime := Value + (30 / MinutesInDay);
|
||||
FStartTime := Value;
|
||||
|
||||
if FOwner is TVpTimeSlotColor then
|
||||
(FOwner as TVpTimeSlotColor).Changed;
|
||||
end;
|
||||
|
@ -348,9 +348,8 @@ begin
|
||||
try
|
||||
FResourceDataSrc.DataSet.Open;
|
||||
except
|
||||
if Assigned(OnCreateTable) then begin
|
||||
if Assigned(OnCreateTable) then
|
||||
OnCreateTable(Self, ResourceTableName);
|
||||
end;
|
||||
try
|
||||
FResourceDataSrc.DataSet.Open;
|
||||
except
|
||||
@ -364,9 +363,8 @@ begin
|
||||
try
|
||||
FEventsDataSrc.DataSet.Open;
|
||||
except
|
||||
if Assigned(OnCreateTable) then begin
|
||||
if Assigned(OnCreateTable) then
|
||||
OnCreateTable(Self, EventsTableName);
|
||||
end;
|
||||
try
|
||||
FEventsDataSrc.DataSet.Open;
|
||||
except
|
||||
@ -380,9 +378,8 @@ begin
|
||||
try
|
||||
FContactsDataSrc.DataSet.Open;
|
||||
except
|
||||
if Assigned(OnCreateTable) then begin
|
||||
if Assigned(OnCreateTable) then
|
||||
OnCreateTable(Self, ContactsTableName);
|
||||
end;
|
||||
try
|
||||
FContactsDataSrc.DataSet.Open;
|
||||
except
|
||||
@ -396,9 +393,8 @@ begin
|
||||
try
|
||||
FTasksDataSrc.DataSet.Open;
|
||||
except
|
||||
if Assigned(OnCreateTable) then begin
|
||||
if Assigned(OnCreateTable) then
|
||||
OnCreateTable(Self, TasksTableName);
|
||||
end;
|
||||
try
|
||||
FTasksDataSrc.DataSet.Open;
|
||||
except
|
||||
@ -430,8 +426,7 @@ end;
|
||||
procedure TVpFlexDataStore.Load;
|
||||
var
|
||||
Res: TVpResource;
|
||||
{FieldName}
|
||||
FN: string;
|
||||
FN: string; // Field name
|
||||
begin
|
||||
if (csLoading in ComponentState) then
|
||||
Exit;
|
||||
@ -538,21 +533,17 @@ var
|
||||
{Field Name}
|
||||
FN1, FN2, FN3 : string;
|
||||
begin
|
||||
if (FEventsDataSrc = nil)
|
||||
or (FEventsDataSrc.DataSet = nil) then
|
||||
if (FEventsDataSrc = nil) or (FEventsDataSrc.DataSet = nil) then
|
||||
Exit;
|
||||
|
||||
if (FResource <> nil) then begin
|
||||
{ Load this resource's events into memory }
|
||||
SetFilterCriteria(FEventsDataSrc.DataSet,
|
||||
True,
|
||||
FResource.ResourceID,
|
||||
TimeRange.StartTime,
|
||||
TimeRange.EndTime);
|
||||
SetFilterCriteria(FEventsDataSrc.DataSet, True, FResource.ResourceID,
|
||||
TimeRange.StartTime, TimeRange.EndTime);
|
||||
|
||||
if (FEventsDataSrc = nil)
|
||||
or (FEventsDataSrc.DataSet = nil)
|
||||
or (not FEventsDataSrc.DataSet.Active) then
|
||||
if (FEventsDataSrc = nil) or
|
||||
(FEventsDataSrc.DataSet = nil) or (not FEventsDataSrc.DataSet.Active)
|
||||
then
|
||||
Exit;
|
||||
|
||||
with FEventsDataSrc.Dataset do begin
|
||||
@ -564,8 +555,8 @@ begin
|
||||
FN3 := GetFieldName(FEventMappings, 'EndTime');
|
||||
if (FN1 <> '') and (FN2 <> '') and (FN3 <> '') then begin
|
||||
Event := Resource.Schedule.AddEvent(FieldByName(FN1).AsInteger,
|
||||
FieldByName(FN2).AsDateTime,
|
||||
FieldByName(FN3).AsDateTime);
|
||||
FieldByName(FN2).AsDateTime, FieldByName(FN3).AsDateTime);
|
||||
|
||||
if Event <> nil then begin
|
||||
Event.Loading := true;
|
||||
|
||||
@ -688,12 +679,10 @@ var
|
||||
begin
|
||||
if (FResource <> nil) then begin
|
||||
{load this resource's contacts into memory}
|
||||
if (FContactsDataSrc <> nil)
|
||||
and (FContactsDataSrc.DataSet <> nil)
|
||||
and (FContactsDataSrc.DataSet.Active) then
|
||||
if (FContactsDataSrc <> nil) and (FContactsDataSrc.DataSet <> nil) and FContactsDataSrc.DataSet.Active
|
||||
then
|
||||
with FContactsDataSrc.DataSet do begin
|
||||
SetFilterCriteria(FContactsDataSrc.DataSet, False,
|
||||
FResource.ResourceID, 0, 0);
|
||||
SetFilterCriteria(FContactsDataSrc.DataSet, False, FResource.ResourceID, 0, 0);
|
||||
First;
|
||||
while not EOF do begin
|
||||
Contact := Resource.Contacts.AddContact(GetNextID(ContactsTableName));
|
||||
@ -881,12 +870,10 @@ var
|
||||
begin
|
||||
if (FResource <> nil) then begin
|
||||
{load this resource's contacts into memory}
|
||||
if (FTasksDataSrc <> nil)
|
||||
and (FTasksDataSrc.DataSet <> nil)
|
||||
and (FTasksDataSrc.DataSet.Active) then begin
|
||||
if (FTasksDataSrc <> nil) and (FTasksDataSrc.DataSet <> nil) and (FTasksDataSrc.DataSet.Active) then
|
||||
begin
|
||||
with FTasksDataSrc.DataSet do begin
|
||||
SetFilterCriteria(FTasksDataSrc.DataSet, False, FResource.ResourceID,
|
||||
0, 0);
|
||||
SetFilterCriteria(FTasksDataSrc.DataSet, False, FResource.ResourceID, 0, 0);
|
||||
First;
|
||||
while not EOF do begin
|
||||
Task := Resource.Tasks.AddTask(GetNextID(TasksTableName));
|
||||
@ -1000,7 +987,6 @@ begin
|
||||
then FResourceDataSrc.DataSet.Open;
|
||||
|
||||
if FResourceDataSrc.DataSet.Active then begin
|
||||
|
||||
with FResourceDataSrc.DataSet do begin
|
||||
{ if a resource }
|
||||
FN := GetFieldName(FResourceMappings, 'ResourceID');
|
||||
@ -1115,20 +1101,17 @@ var
|
||||
FN: string;
|
||||
begin
|
||||
{if no events dataset has been defined then bail.}
|
||||
if (FEventsDataSrc = nil)
|
||||
or (FEventsDataSrc.DataSet = nil) then
|
||||
if (FEventsDataSrc = nil) or (FEventsDataSrc.DataSet = nil) then
|
||||
Exit;
|
||||
|
||||
if (Resource <> nil) and Resource.EventsDirty then begin
|
||||
{ Dump this resource's dirty events to the DB }
|
||||
if (FResourceDataSrc <> nil)
|
||||
and (FResourceDataSrc.DataSet <> nil) then begin
|
||||
|
||||
if (FResourceDataSrc <> nil) and (FResourceDataSrc.DataSet <> nil) then
|
||||
begin
|
||||
FResourceDataSrc.DataSet.Open;
|
||||
|
||||
FN := GetFieldName(FEventMappings, 'ResourceID');
|
||||
if (FN <> '')
|
||||
and FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, [])
|
||||
if (FN <> '') and FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, [])
|
||||
then begin
|
||||
SetFilterCriteria(FEventsDataSrc.DataSet, False, Resource.ResourceID,
|
||||
0, 0);
|
||||
@ -1160,7 +1143,6 @@ begin
|
||||
if Event.RecordID <> -1 then
|
||||
EventsTable.FieldByName(FN).AsInteger := Event.RecordID;
|
||||
|
||||
|
||||
FN := GetFieldName(FEventMappings, 'StartTime');
|
||||
if FN <> '' then
|
||||
EventsTable.FieldByName(FN).AsDateTime := Event.StartTime;
|
||||
@ -1287,11 +1269,9 @@ begin
|
||||
if Event.RecordID = -1 then begin
|
||||
FN := GetFieldName(EventMappings, 'RecordID');
|
||||
if FN <> '' then
|
||||
Event.RecordID
|
||||
:= EventsTable.FieldByName(FN).AsInteger;
|
||||
Event.RecordID := EventsTable.FieldByName(FN).AsInteger;
|
||||
end;
|
||||
|
||||
|
||||
(* Bad Phillip.
|
||||
if Event.RecordID = -1 then
|
||||
Event.RecordID := EventsTable.FieldByName('RecordID').AsInteger;
|
||||
@ -1332,8 +1312,8 @@ begin
|
||||
{ if the delete flag is set then delete the record }
|
||||
{ and free the event instance }
|
||||
if Contact.Deleted then begin
|
||||
if ContactsTable.Locate(FN, Contact.RecordID, [])
|
||||
then ContactsTable.Delete;
|
||||
if ContactsTable.Locate(FN, Contact.RecordID, []) then
|
||||
ContactsTable.Delete;
|
||||
Contact.Free;
|
||||
Continue;
|
||||
end;
|
||||
@ -1552,14 +1532,14 @@ var
|
||||
begin
|
||||
if (Resource <> nil) and Resource.TasksDirty then begin
|
||||
|
||||
if (FResourceDataSrc <> nil)
|
||||
and (FResourceDataSrc.Dataset <> nil) then begin
|
||||
if (FResourceDataSrc <> nil) and (FResourceDataSrc.Dataset <> nil) then
|
||||
begin
|
||||
FResourceDataSrc.DataSet.Open;
|
||||
if FResourceDataSrc.DataSet.Active then begin
|
||||
FN := GetFieldName(FTaskMappings, 'ResourceID');
|
||||
{ Dump this resource's dirty contacts to the DB }
|
||||
if not FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, [])
|
||||
then Exit;
|
||||
if not FResourceDataSrc.DataSet.Locate(FN, Resource.ResourceID, []) then
|
||||
Exit;
|
||||
end; {if FResourceDataSrc.DataSet.Active}
|
||||
end; {if (FResourceDataSrc ...}
|
||||
|
||||
@ -1569,9 +1549,7 @@ begin
|
||||
for I := pred(Resource.Tasks.Count) downto 0 do begin
|
||||
|
||||
with FTasksDataSrc.DataSet do begin
|
||||
|
||||
Task := Resource.Tasks.GetTask(I);
|
||||
|
||||
FN := GetFieldName(FTaskMappings, 'RecordID');
|
||||
|
||||
{ if the delete flag is set then delete the record }
|
||||
@ -1584,15 +1562,14 @@ begin
|
||||
end;
|
||||
|
||||
if Task.Changed then begin
|
||||
if Locate(FN, Task.RecordID, [])
|
||||
then
|
||||
if Locate(FN, Task.RecordID, []) then
|
||||
{ this event already exists in the database so update it }
|
||||
Edit
|
||||
else
|
||||
{ this record doesn't exist in the database, so it's a new event }
|
||||
Append;
|
||||
try
|
||||
|
||||
try
|
||||
{ DataStore descendants that can use an autoincrement RecordID }
|
||||
{ field set the RecordID to -1 by default. If the RecordID is }
|
||||
{ -1 then this is a new record and we shouldn't overwrite }
|
||||
@ -1726,7 +1703,6 @@ begin
|
||||
|
||||
FN := GetFieldName(FResourceMappings, 'ResourceID');
|
||||
if (FN <> '') then begin
|
||||
|
||||
if (Res <> nil) and Res.Deleted then begin
|
||||
PurgeEvents(Res);
|
||||
PurgeContacts(Res);
|
||||
@ -1850,9 +1826,8 @@ procedure TVpFlexDataStore.PurgeEvents(Res: TVpResource);
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
for I := 0 to pred(Res.Schedule.EventCount) do begin
|
||||
for I := 0 to pred(Res.Schedule.EventCount) do
|
||||
TVpEvent(Res.Schedule.GetEvent(I)).Deleted := true;
|
||||
end;
|
||||
PostEvents;
|
||||
Res.Schedule.ClearEvents;
|
||||
end;
|
||||
@ -1863,9 +1838,8 @@ procedure TVpFlexDataStore.PurgeContacts(Res: TVpResource);
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
for I := 0 to pred(Res.Contacts.Count) do begin
|
||||
for I := 0 to pred(Res.Contacts.Count) do
|
||||
TVpContact(Res.Contacts.GetContact(I)).Deleted := true;
|
||||
end;
|
||||
PostContacts;
|
||||
Res.Contacts.ClearContacts;
|
||||
end;
|
||||
@ -1876,9 +1850,8 @@ procedure TVpFlexDataStore.PurgeTasks(Res: TVpResource);
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
for I := 0 to pred(Res.Tasks.Count) do begin
|
||||
for I := 0 to pred(Res.Tasks.Count) do
|
||||
TVpTask(Res.Tasks.GetTask(I)).Deleted := true;
|
||||
end;
|
||||
PostTasks;
|
||||
Res.Tasks.ClearTasks;
|
||||
end;
|
||||
@ -2079,7 +2052,6 @@ begin
|
||||
{ for each table. }
|
||||
|
||||
result := -1;
|
||||
|
||||
if Assigned(OnGetNextID) then
|
||||
result := OnGetNextID(Self, TableName);
|
||||
end;
|
||||
@ -2203,5 +2175,4 @@ end;
|
||||
{=====}
|
||||
|
||||
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user