Skip to content

Commit

Permalink
[M] Some changes of methods to remove Ora objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed May 10, 2016
1 parent aa46777 commit e72d1c1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 36 deletions.
4 changes: 2 additions & 2 deletions ORDESY.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">977</VersionInfo>
<VersionInfo Name="Build">978</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
Expand All @@ -105,7 +105,7 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.977</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">1.0.0.978</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
Expand Down
Binary file modified ORDESY.res
Binary file not shown.
58 changes: 24 additions & 34 deletions uORDESY.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1409,29 +1409,24 @@ function TORDESYProjectList.RemoveBaseByIndex(const aIndex: integer): boolean;

function TORDESYProjectList.RemoveProjectById(const aId: integer): boolean;
var
iProject: TORDESYProject;
i: integer;
begin
Result:= false;
try
iProject:= GetProjectById(aId);
if iProject <> nil then
for i := 0 to ProjectCount - 1 do
begin
for i := 0 to ProjectCount - 1 do
if FProjects[i].Id = aId then
begin
if FProjects[i] = iProject then
begin
FProjects[i].Free;
FProjects[i]:= FProjects[ high(FProjects)];
SetLength(FProjects, length(FProjects) - 1);
FSaved := false;
if Assigned(FOnProjectRemove) then
OnProjectRemove(Self);
if Assigned(FOnChange) then
OnChange(Self);
Result:= true;
Exit;
end;
FProjects[i].Free;
FProjects[i]:= FProjects[ high(FProjects)];
SetLength(FProjects, length(FProjects) - 1);
FSaved := false;
if Assigned(FOnProjectRemove) then
OnProjectRemove(Self);
if Assigned(FOnChange) then
OnChange(Self);
Result:= true;
Exit;
end;
end;
except
Expand Down Expand Up @@ -1485,29 +1480,24 @@ function TORDESYProjectList.RemoveProjectByIndex(

function TORDESYProjectList.RemoveSchemeById(const aId: integer): Boolean;
var
iScheme: TOraScheme;
i: integer;
begin
Result:= false;
try
iScheme:= GetOraSchemeById(aId);
if iScheme <> nil then
for i := 0 to ProjectCount - 1 do
begin
for i := 0 to ProjectCount - 1 do
if FOraSchemes[i].Id = aId then
begin
if FOraSchemes[i] = iScheme then
begin
FOraSchemes[i].Free;
FOraSchemes[i]:= FOraSchemes[ high(FOraSchemes)];
SetLength(FOraSchemes, length(FOraSchemes) - 1);
FSaved := false;
if Assigned(FOnSchemeRemove) then
OnSchemeRemove(Self);
if Assigned(FOnChange) then
OnChange(Self);
Result:= true;
Exit;
end;
FOraSchemes[i].Free;
FOraSchemes[i]:= FOraSchemes[ high(FOraSchemes)];
SetLength(FOraSchemes, length(FOraSchemes) - 1);
FSaved := false;
if Assigned(FOnSchemeRemove) then
OnSchemeRemove(Self);
if Assigned(FOnChange) then
OnChange(Self);
Result:= true;
Exit;
end;
end;
except
Expand Down

0 comments on commit e72d1c1

Please sign in to comment.