libman, update after alias changed + fix update after addition

This commit is contained in:
Basile Burg 2016-10-30 13:07:13 +01:00
parent fa5c3c5d9d
commit fc0bc94c60
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
2 changed files with 19 additions and 13 deletions

View File

@ -96,7 +96,6 @@ type
function getLibraryByAlias(const value: string): TLibraryItem;
function getLibraryByImport(const value: string): TLibraryItem;
procedure setCollection(value: TCollection);
procedure updateItemsByAlias;
function getLibrariesCount: integer;
procedure FPOObservedChanged(ASender: TObject; Operation: TFPObservedOperation; Data : Pointer);
published
@ -124,6 +123,8 @@ type
procedure updateDCD;
// find the aliases of the libraries used by the libraries.
procedure updateCrossDependencies;
procedure updateAfterAddition(lib: TLibraryItem);
procedure updateItemsByAlias;
property librariesCount: integer read getLibrariesCount;
property libraryByIndex[value: integer]: TLibraryItem read getLibraryByIndex;
property libraryByAlias[const value: string]: TLibraryItem read getLibraryByAlias;
@ -472,15 +473,15 @@ begin
end;
fItemsByAlias.delete(lib.libAlias);
end;
ooAddItem:
begin
fItemsByAlias.insert(lib.libAlias, lib);
// TODO-cupdate on addition, item ctor is not yet finished !
//updateCrossDependencies;
end;
end;
end;
procedure TLibraryManager.updateAfterAddition(lib: TLibraryItem);
begin
fItemsByAlias.insert(lib.libAlias, lib);
updateCrossDependencies;
end;
function TLibraryManager.getLibraryByIndex(index: integer): TLibraryItem;
begin
exit(TLibraryItem(fCollection.Items[index]));
@ -687,6 +688,7 @@ var
dep: TLibraryItem;
imp: string;
begin
updateItemsByAlias;
for i := 0 to fCollection.Count-1 do
begin
lib := libraryByIndex[i];

View File

@ -77,7 +77,7 @@ type
procedure projCompiling(project: ICECommonProject);
procedure projCompiled(project: ICECommonProject; success: boolean);
function itemForRow(row: TListItem): TLibraryItem;
procedure RowToLibrary(row: TListItem);
procedure RowToLibrary(row: TListItem; added: boolean = false);
function sourceRoot(project: ICECommonProject): string;
procedure lexFindToken(const token: PLexToken; out stop: boolean);
//
@ -536,7 +536,7 @@ begin
row.SubItems.Add(prj.filename);
row.SubItems.Add(enableStr[true]);
row.Selected:=true;
RowToLibrary(row);
RowToLibrary(row, true);
row.MakeVisible(false);
itf.message('The package to register is a source library.' +
'It is not pre-compiled but its sources are registered', nil, amcMisc, amkInf);
@ -570,7 +570,7 @@ begin
row.SubItems.Add(prj.filename);
row.SubItems.Add(enableStr[true]);
row.Selected:=true;
RowToLibrary(row);
RowToLibrary(row, true);
row.MakeVisible(false);
showWidget;
end else
@ -605,6 +605,7 @@ begin
exit;
end;
List.Selected.Caption := al;
LibMan.updateItemsByAlias;
RowToLibrary(List.Selected);
end;
end;
@ -694,7 +695,7 @@ begin
row.Selected:= true;
row.MakeVisible(false);
SetFocus;
RowToLibrary(row);
RowToLibrary(row, true);
finally
str.free;
end;
@ -839,7 +840,7 @@ begin
List.EndUpdate;
end;
procedure TCELibManEditorWidget.RowToLibrary(row: TListItem);
procedure TCELibManEditorWidget.RowToLibrary(row: TListItem; added: boolean = false);
var
itm: TLibraryItem;
begin
@ -855,7 +856,10 @@ begin
itm.updateModulesInfo;
LibMan.updateDCD;
LibMan.updateCrossDependencies;
if added then
LibMan.updateCrossDependencies
else
Libman.updateAfterAddition(itm);
end;
function TCELibManEditorWidget.sourceRoot(project: ICECommonProject): string;