mirror of https://gitlab.com/basile.b/dexed.git
refactored librarymanager, global variable put off the less and less "main" form
This commit is contained in:
parent
bffa23a27f
commit
e49f60cc0a
|
@ -45,6 +45,9 @@ type
|
|||
procedure updateDCD;
|
||||
end;
|
||||
|
||||
var
|
||||
LibMan: TLibraryManager;
|
||||
|
||||
implementation
|
||||
|
||||
constructor TLibraryManager.create(aOwner: TComponent);
|
||||
|
@ -155,4 +158,7 @@ end;
|
|||
|
||||
initialization
|
||||
registerClasses([TLibraryManager, TLibraryItem]);
|
||||
LibMan := TLibraryManager.create(nil);
|
||||
finalization
|
||||
LibMan.Free;
|
||||
end.
|
||||
|
|
|
@ -35,7 +35,7 @@ implementation
|
|||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
ce_main, ce_libman;
|
||||
ce_libman;
|
||||
|
||||
procedure TCELibManEditorWidget.ListEdited(Sender: TObject; Item: TListItem;
|
||||
var AValue: string);
|
||||
|
@ -132,17 +132,14 @@ var
|
|||
i: NativeInt;
|
||||
begin
|
||||
List.Clear;
|
||||
with CEMainForm do
|
||||
if LibMan = nil then exit;
|
||||
for i:= 0 to LibMan.libraries.Count-1 do
|
||||
begin
|
||||
if LibraryManager = nil then exit;
|
||||
for i:= 0 to LibraryManager.libraries.Count-1 do
|
||||
begin
|
||||
itm := TLibraryItem(LibraryManager.libraries.Items[i]);
|
||||
row := List.Items.Add;
|
||||
row.Caption := itm.libAlias;
|
||||
row.SubItems.Add(itm.libFile);
|
||||
row.SubItems.Add(itm.libSourcePath);
|
||||
end;
|
||||
itm := TLibraryItem(LibMan.libraries.Items[i]);
|
||||
row := List.Items.Add;
|
||||
row.Caption := itm.libAlias;
|
||||
row.SubItems.Add(itm.libFile);
|
||||
row.SubItems.Add(itm.libSourcePath);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -151,19 +148,16 @@ var
|
|||
itm: TLibraryItem;
|
||||
row: TListItem;
|
||||
begin
|
||||
with CEMainForm do
|
||||
if LibMan = nil then exit;
|
||||
LibMan.libraries.Clear;
|
||||
for row in List.Items do
|
||||
begin
|
||||
if LibraryManager = nil then exit;
|
||||
LibraryManager.libraries.Clear;
|
||||
for row in List.Items do
|
||||
begin
|
||||
itm := TLibraryItem(LibraryManager.libraries.Add);
|
||||
itm.libAlias := row.Caption;
|
||||
itm.libFile := row.SubItems.Strings[0];
|
||||
itm.libSourcePath := row.SubItems.Strings[1];
|
||||
end;
|
||||
LibraryManager.updateDCD;
|
||||
itm := TLibraryItem(LibMan.libraries.Add);
|
||||
itm.libAlias := row.Caption;
|
||||
itm.libFile := row.SubItems.Strings[0];
|
||||
itm.libSourcePath := row.SubItems.Strings[1];
|
||||
end;
|
||||
LibMan.updateDCD;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -188,7 +188,6 @@ type
|
|||
fTlsEdWidg: TCEToolsEditorWidget;
|
||||
fProjMru: TMruFileList;
|
||||
fFileMru: TMruFileList;
|
||||
fLibMan: TLibraryManager;
|
||||
fPrInpWidg: TCEProcInputWidget;
|
||||
fInitialized: boolean;
|
||||
{$IFDEF WIN32}
|
||||
|
@ -279,7 +278,6 @@ type
|
|||
procedure openFile(const aFilename: string);
|
||||
//
|
||||
property WidgetList: TCEWidgetList read fWidgList;
|
||||
property LibraryManager: TLibraryManager read fLibMan;
|
||||
property CustomTools: TCETools read fTools;
|
||||
end;
|
||||
|
||||
|
@ -380,10 +378,9 @@ procedure TCEMainForm.InitLibMan;
|
|||
var
|
||||
fname: string;
|
||||
begin
|
||||
fLibMan := TLibraryManager.create(self);
|
||||
fname := getDocPath + 'libraryManager.txt';
|
||||
if fileExists(fname) then
|
||||
fLibMan.loadFromFile(fname);
|
||||
LibMan.loadFromFile(fname);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.InitTools;
|
||||
|
@ -579,7 +576,7 @@ begin
|
|||
opts := TCEOptions.create(nil);
|
||||
try
|
||||
forceDirectory(getDocPath);
|
||||
fLibMan.saveToFile(getDocPath + 'libraryManager.txt');
|
||||
LibMan.saveToFile(getDocPath + 'libraryManager.txt');
|
||||
fTools.saveToFile(getDocPath + 'tools.txt');
|
||||
opts.saveToFile(getDocPath + 'options2.txt');
|
||||
finally
|
||||
|
@ -1292,8 +1289,8 @@ begin
|
|||
dmdproc.Parameters.Add('-w');
|
||||
dmdproc.Parameters.Add('-wi');
|
||||
dmdproc.Parameters.Add('-of' + fname + exeExt);
|
||||
LibraryManager.getLibFiles(nil, dmdproc.Parameters);
|
||||
LibraryManager.getLibSources(nil, dmdproc.Parameters);
|
||||
LibMan.getLibFiles(nil, dmdproc.Parameters);
|
||||
LibMan.getLibSources(nil, dmdproc.Parameters);
|
||||
dmdproc.Execute;
|
||||
while dmdproc.Running do asyncprocOutput(dmdProc);
|
||||
|
||||
|
@ -1541,7 +1538,7 @@ procedure TCEMainForm.newProj;
|
|||
begin
|
||||
fProject := TCEProject.Create(nil);
|
||||
fProject.Name := 'CurrentProject';
|
||||
fProject.libraryManager := fLibMan;
|
||||
fProject.libraryManager := LibMan;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.saveProj;
|
||||
|
|
|
@ -84,7 +84,7 @@ type
|
|||
implementation
|
||||
{$R *.lfm}
|
||||
|
||||
uses ce_libman, ce_symstring, ce_main;
|
||||
uses ce_libman, ce_symstring;
|
||||
|
||||
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||
constructor TCEStaticExplorerWidget.create(aOwner: TComponent);
|
||||
|
@ -389,10 +389,8 @@ begin
|
|||
end;
|
||||
|
||||
//adds the libman entries
|
||||
with CEMainForm do begin
|
||||
Librarymanager.getLibFiles(nil, fDmdProc.Parameters);
|
||||
Librarymanager.getLibSources(nil, fDmdProc.Parameters);
|
||||
end;
|
||||
LibMan.getLibFiles(nil, fDmdProc.Parameters);
|
||||
LibMan.getLibSources(nil, fDmdProc.Parameters);
|
||||
|
||||
// option to produce the Json file.
|
||||
fDmdProc.Parameters.Add('-c');
|
||||
|
|
Loading…
Reference in New Issue