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