diff --git a/src/ce_libman.pas b/src/ce_libman.pas index 29095f26..d7b344c2 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -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]; diff --git a/src/ce_libmaneditor.pas b/src/ce_libmaneditor.pas index e0157cc8..792f0d29 100644 --- a/src/ce_libmaneditor.pas +++ b/src/ce_libmaneditor.pas @@ -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;