mirror of https://gitlab.com/basile.b/dexed.git
refact widgets that replace the free project with projutils functions
This commit is contained in:
parent
9a1f542253
commit
c957a0099d
|
@ -397,7 +397,7 @@
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
</Unit48>
|
</Unit48>
|
||||||
<Unit49>
|
<Unit49>
|
||||||
<Filename Value="..\src\ce_anyprojloader.pas"/>
|
<Filename Value="..\src\ce_projutils.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit49>
|
</Unit49>
|
||||||
</Units>
|
</Units>
|
||||||
|
|
|
@ -11,7 +11,7 @@ uses
|
||||||
ce_main, ce_writableComponent, ce_staticmacro, ce_inspectors,
|
ce_main, ce_writableComponent, ce_staticmacro, ce_inspectors,
|
||||||
ce_editoroptions, ce_dockoptions, ce_shortcutseditor, ce_mru, ce_processes,
|
ce_editoroptions, ce_dockoptions, ce_shortcutseditor, ce_mru, ce_processes,
|
||||||
ce_dubproject, ce_dialogs, ce_dubprojeditor, ce_controls, ce_dfmt,
|
ce_dubproject, ce_dialogs, ce_dubprojeditor, ce_controls, ce_dfmt,
|
||||||
ce_lcldragdrop, ce_stringrange, ce_dlangmaps, ce_projgroup, ce_anyprojloader;
|
ce_lcldragdrop, ce_stringrange, ce_dlangmaps, ce_projgroup, ce_projutils;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ type
|
||||||
|
|
||||||
TCEDubProject = class(TComponent, ICECommonProject)
|
TCEDubProject = class(TComponent, ICECommonProject)
|
||||||
private
|
private
|
||||||
|
fProjectName: string;
|
||||||
fInGroup: boolean;
|
fInGroup: boolean;
|
||||||
fDubProc: TCEProcess;
|
fDubProc: TCEProcess;
|
||||||
fPreCompilePath: string;
|
fPreCompilePath: string;
|
||||||
|
@ -88,6 +89,7 @@ type
|
||||||
function targetUpToDate: boolean;
|
function targetUpToDate: boolean;
|
||||||
//
|
//
|
||||||
property json: TJSONObject read fJSON;
|
property json: TJSONObject read fJSON;
|
||||||
|
property packageName: string read fPackageName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// these 9 built types always exist
|
// these 9 built types always exist
|
||||||
|
|
|
@ -7,7 +7,7 @@ interface
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, ComCtrls,
|
Classes, SysUtils, Controls, ComCtrls,
|
||||||
ce_common, ce_nativeproject, ce_dubproject, ce_interfaces,
|
ce_common, ce_nativeproject, ce_dubproject, ce_interfaces,
|
||||||
ce_dialogs;
|
ce_dialogs, ce_projutils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -126,13 +126,14 @@ end;
|
||||||
procedure TDDHandler.DragDrop(Sender, Source: TObject; X, Y: Integer);
|
procedure TDDHandler.DragDrop(Sender, Source: TObject; X, Y: Integer);
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
proj: boolean = false;
|
fmt: TCEProjectFileFormat;
|
||||||
begin
|
begin
|
||||||
if Source.isNil then exit;
|
if Source.isNil then exit;
|
||||||
fname := getFilename(Source);
|
fname := getFilename(Source);
|
||||||
if not fname.fileExists then exit;
|
if not fname.fileExists then exit;
|
||||||
|
|
||||||
if isValidNativeProject(fname) then
|
fmt := projectFormat(fname);
|
||||||
|
if fmt in [pffCe, pffDub] then
|
||||||
begin
|
begin
|
||||||
if assigned(fFreeProj) then
|
if assigned(fFreeProj) then
|
||||||
begin
|
begin
|
||||||
|
@ -140,24 +141,13 @@ begin
|
||||||
exit;
|
exit;
|
||||||
fFreeProj.getProject.Free;
|
fFreeProj.getProject.Free;
|
||||||
end;
|
end;
|
||||||
TCENativeProject.create(nil);
|
if fmt = pffCe then
|
||||||
proj := true;
|
TCENativeProject.create(nil)
|
||||||
|
else
|
||||||
|
TCEDubProject.create(nil);
|
||||||
|
fProj.loadFromFile(fname);
|
||||||
end
|
end
|
||||||
else if isValidDubProject(fname) then
|
else getMultiDocHandler.openDocument(fname);
|
||||||
begin
|
|
||||||
if assigned(fFreeProj) and not fFreeProj.inGroup then
|
|
||||||
begin
|
|
||||||
if fProj.modified and (dlgFileChangeClose(fFreeProj.filename) = mrCancel) then
|
|
||||||
exit;
|
|
||||||
fFreeProj.getProject.Free;
|
|
||||||
end;
|
|
||||||
TCEDubProject.create(nil);
|
|
||||||
proj := true;
|
|
||||||
end;
|
|
||||||
if assigned(fProj) and proj then
|
|
||||||
fProj.loadFromFile(fname)
|
|
||||||
else
|
|
||||||
getMultiDocHandler.openDocument(fname);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
|
@ -9,7 +9,7 @@ uses
|
||||||
Menus, ComCtrls, Buttons, LazFileUtils, strutils, fphttpclient, StdCtrls, xfpjson,
|
Menus, ComCtrls, Buttons, LazFileUtils, strutils, fphttpclient, StdCtrls, xfpjson,
|
||||||
ce_widget, ce_interfaces, ce_nativeproject, ce_dmdwrap, ce_common, ce_dialogs,
|
ce_widget, ce_interfaces, ce_nativeproject, ce_dmdwrap, ce_common, ce_dialogs,
|
||||||
ce_sharedres, process, ce_dubproject, ce_observer, ce_dlang, ce_stringrange,
|
ce_sharedres, process, ce_dubproject, ce_observer, ce_dlang, ce_stringrange,
|
||||||
ce_libman;
|
ce_libman, ce_projutils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -509,12 +509,14 @@ end;
|
||||||
procedure TCELibManEditorWidget.btnOpenProjClick(Sender: TObject);
|
procedure TCELibManEditorWidget.btnOpenProjClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
|
fmt: TCEProjectFileFormat;
|
||||||
begin
|
begin
|
||||||
if List.Selected.isNil then exit;
|
if List.Selected.isNil then exit;
|
||||||
fname := List.Selected.SubItems[2];
|
fname := List.Selected.SubItems[2];
|
||||||
if not fname.fileExists then exit;
|
if not fname.fileExists then exit;
|
||||||
//
|
//
|
||||||
if isValidNativeProject(fname) then
|
fmt := projectFormat(fname);
|
||||||
|
if fmt in [pffCe, pffDub] then
|
||||||
begin
|
begin
|
||||||
if assigned(fFreeProj) then
|
if assigned(fFreeProj) then
|
||||||
begin
|
begin
|
||||||
|
@ -522,18 +524,10 @@ begin
|
||||||
exit;
|
exit;
|
||||||
fFreeProj.getProject.Free;
|
fFreeProj.getProject.Free;
|
||||||
end;
|
end;
|
||||||
TCENativeProject.create(nil);
|
if fmt = pffCe then
|
||||||
fProj.loadFromFile(fname);
|
TCENativeProject.create(nil)
|
||||||
end
|
else
|
||||||
else if isValidDubProject(fname) then
|
TCEDubProject.create(nil);
|
||||||
begin
|
|
||||||
if assigned(fFreeProj) then
|
|
||||||
begin
|
|
||||||
if fFreeProj.modified and (dlgFileChangeClose(fFreeProj.filename) = mrCancel) then
|
|
||||||
exit;
|
|
||||||
fFreeProj.getProject.Free;
|
|
||||||
end;
|
|
||||||
TCEDubProject.create(nil);
|
|
||||||
fProj.loadFromFile(fname);
|
fProj.loadFromFile(fname);
|
||||||
end
|
end
|
||||||
else dlgOkInfo('the project file for this library seems to be invalid');
|
else dlgOkInfo('the project file for this library seems to be invalid');
|
||||||
|
|
|
@ -3712,6 +3712,42 @@ object CEMainForm: TCEMainForm
|
||||||
end
|
end
|
||||||
object MenuItem88: TMenuItem
|
object MenuItem88: TMenuItem
|
||||||
Action = actProjGroupCompile
|
Action = actProjGroupCompile
|
||||||
|
Bitmap.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001F000000080000003300000033000000040000002400000000000000000000
|
||||||
|
0000000000000000000000000000000000330000003300000033000000332D73
|
||||||
|
BAAF1B3D60523F93D4FF3F93D4FF102438413578BAC300000024000000000000
|
||||||
|
0000000000230000002F00000000B88445FFC89451FFCE934AFF6D8192FF40A9
|
||||||
|
EAFF429EDDFF52D0F8FF52D0F8FF439EDCFF48AAE2FF3980C8B6000000000000
|
||||||
|
0023AA7A3EBFB68243ED00000033B58142FFF5C378FFFCC371FFAD7E49FF3B9E
|
||||||
|
E3FF4ECFFBFF41B0EDFF42B1EDFF50CFFAFF439EDCFF1B3D5F5200000000AA7A
|
||||||
|
3FBED2A76FFFD7A561FFB88241FFD39F58FFEDB96BFFF7B962FF288DE3FF4CCF
|
||||||
|
FCFF40B0EDFFC39F7BFF987653CB42B1EEFF52D0F9FF3F92D5FF00000000B984
|
||||||
|
43E9DDBB8CFFEEC486FFE8B466FFF1CC96FFF7DCB5FFFFDEADFF288CDFFF4CCE
|
||||||
|
FBFF3FAFEDFFFAB66DFFC7751FCE41B1EFFF52D0F9FF3F92D5FF000000330000
|
||||||
|
0033B78242FFE4B163FFEBC68EFFEACFA9FFD1A774FFD9A970FFCCBBA4FF399C
|
||||||
|
E1FF4CCEFBFF3FB0EEFF40B1EFFF4FCFFCFF429EDCFF16324E31B98545FFB782
|
||||||
|
42FFC8934EFFDFAB5EFFE4C494FFB68245DAB8813F3CBE823B2561809CFF37A8
|
||||||
|
EFFF399DE3FF4CCFFDFF4AC7F8FF3D9EE1FF45AAE4FF3982CB9FC38F4EFFE2B5
|
||||||
|
72FFDEB06AFFDBA658FFC59555FF926935300000000000000000AA7333436A83
|
||||||
|
99FFCD9F5FFF298DE2FF2B8FE1FFB48B5AFF3081D29100000000C5995FFFF1DC
|
||||||
|
BBFFECD2ACFFD6A152FFC18C49FF70502A620000000C0000000C704F2861C88D
|
||||||
|
44FFDFA24CFFEACEA6FFF1D7B2FFD79A51FF0000000000000000B98442FFB680
|
||||||
|
3EFFCEA673FFDBAE6EFFCB954BFFB88344FF6E4F2A616E4F2A61B88344FFCD97
|
||||||
|
4AFFDCAE6DFFD0A772FFB9813CFFBE843FFF0000000000000000000000000000
|
||||||
|
002FBA8547FFCE9949FFDAB276FFC9944BFFBE8943FFBE8943FFC9944BFFDAB2
|
||||||
|
76FFCE9949FFBA8546FF0000002F00000000000000000000000000000000B782
|
||||||
|
42ECD3AE7CFFE7CBA4FFEAD4B2FFE8D0ADFFCF9D56FFCF9D56FFE8D0ADFFEAD4
|
||||||
|
B2FFE7CBA4FFD3AE7CFFB78242EC00000000000000000000000000000000B985
|
||||||
|
44AFCCA26CFFD4B080FFB98343FFCCA470FFC9984EFFC9984EFFCCA470FFB983
|
||||||
|
43FFD4B080FFCCA26CFFB98544AF000000000000000000000000000000000000
|
||||||
|
0000B98544AFB98443E900000000B78140FFE9D4B4FFE9D4B4FFB78140FF0000
|
||||||
|
0000B98443E9B98544AF00000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000BA8545FFB9843FFFB9843FFFBA8545FF0000
|
||||||
|
0000000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object MenuItem8: TMenuItem
|
object MenuItem8: TMenuItem
|
||||||
|
@ -4153,6 +4189,42 @@ object CEMainForm: TCEMainForm
|
||||||
end
|
end
|
||||||
object MenuItem89: TMenuItem
|
object MenuItem89: TMenuItem
|
||||||
Action = actProjGroupCompile
|
Action = actProjGroupCompile
|
||||||
|
Bitmap.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
001F000000080000003300000033000000040000002400000000000000000000
|
||||||
|
0000000000000000000000000000000000330000003300000033000000332D73
|
||||||
|
BAAF1B3D60523F93D4FF3F93D4FF102438413578BAC300000024000000000000
|
||||||
|
0000000000230000002F00000000B88445FFC89451FFCE934AFF6D8192FF40A9
|
||||||
|
EAFF429EDDFF52D0F8FF52D0F8FF439EDCFF48AAE2FF3980C8B6000000000000
|
||||||
|
0023AA7A3EBFB68243ED00000033B58142FFF5C378FFFCC371FFAD7E49FF3B9E
|
||||||
|
E3FF4ECFFBFF41B0EDFF42B1EDFF50CFFAFF439EDCFF1B3D5F5200000000AA7A
|
||||||
|
3FBED2A76FFFD7A561FFB88241FFD39F58FFEDB96BFFF7B962FF288DE3FF4CCF
|
||||||
|
FCFF40B0EDFFC39F7BFF987653CB42B1EEFF52D0F9FF3F92D5FF00000000B984
|
||||||
|
43E9DDBB8CFFEEC486FFE8B466FFF1CC96FFF7DCB5FFFFDEADFF288CDFFF4CCE
|
||||||
|
FBFF3FAFEDFFFAB66DFFC7751FCE41B1EFFF52D0F9FF3F92D5FF000000330000
|
||||||
|
0033B78242FFE4B163FFEBC68EFFEACFA9FFD1A774FFD9A970FFCCBBA4FF399C
|
||||||
|
E1FF4CCEFBFF3FB0EEFF40B1EFFF4FCFFCFF429EDCFF16324E31B98545FFB782
|
||||||
|
42FFC8934EFFDFAB5EFFE4C494FFB68245DAB8813F3CBE823B2561809CFF37A8
|
||||||
|
EFFF399DE3FF4CCFFDFF4AC7F8FF3D9EE1FF45AAE4FF3982CB9FC38F4EFFE2B5
|
||||||
|
72FFDEB06AFFDBA658FFC59555FF926935300000000000000000AA7333436A83
|
||||||
|
99FFCD9F5FFF298DE2FF2B8FE1FFB48B5AFF3081D29100000000C5995FFFF1DC
|
||||||
|
BBFFECD2ACFFD6A152FFC18C49FF70502A620000000C0000000C704F2861C88D
|
||||||
|
44FFDFA24CFFEACEA6FFF1D7B2FFD79A51FF0000000000000000B98442FFB680
|
||||||
|
3EFFCEA673FFDBAE6EFFCB954BFFB88344FF6E4F2A616E4F2A61B88344FFCD97
|
||||||
|
4AFFDCAE6DFFD0A772FFB9813CFFBE843FFF0000000000000000000000000000
|
||||||
|
002FBA8547FFCE9949FFDAB276FFC9944BFFBE8943FFBE8943FFC9944BFFDAB2
|
||||||
|
76FFCE9949FFBA8546FF0000002F00000000000000000000000000000000B782
|
||||||
|
42ECD3AE7CFFE7CBA4FFEAD4B2FFE8D0ADFFCF9D56FFCF9D56FFE8D0ADFFEAD4
|
||||||
|
B2FFE7CBA4FFD3AE7CFFB78242EC00000000000000000000000000000000B985
|
||||||
|
44AFCCA26CFFD4B080FFB98343FFCCA470FFC9984EFFC9984EFFCCA470FFB983
|
||||||
|
43FFD4B080FFCCA26CFFB98544AF000000000000000000000000000000000000
|
||||||
|
0000B98544AFB98443E900000000B78140FFE9D4B4FFE9D4B4FFB78140FF0000
|
||||||
|
0000B98443E9B98544AF00000000000000000000000000000000000000000000
|
||||||
|
0000000000000000000000000000BA8545FFB9843FFFB9843FFFBA8545FF0000
|
||||||
|
0000000000000000000000000000000000000000000000000000
|
||||||
|
}
|
||||||
end
|
end
|
||||||
object MenuItem90: TMenuItem
|
object MenuItem90: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
|
|
|
@ -2904,6 +2904,7 @@ begin
|
||||||
fMsgs.message('start compiling a project group...', nil, amcAll, amkInf);
|
fMsgs.message('start compiling a project group...', nil, amcAll, amkInf);
|
||||||
for i:= 0 to fProjectGroup.projectCount-1 do
|
for i:= 0 to fProjectGroup.projectCount-1 do
|
||||||
begin
|
begin
|
||||||
|
//TODO-cprojectgroup: verify that compilation is not paralell since the projects use an async proc.
|
||||||
fProjectGroup.getProject(i).activate;
|
fProjectGroup.getProject(i).activate;
|
||||||
fProject.compile;
|
fProject.compile;
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -8,7 +8,7 @@ uses
|
||||||
Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls, Graphics,
|
Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls, Graphics,
|
||||||
ExtCtrls, Menus, ComCtrls, Buttons, lcltype, strutils, ce_widget, ce_sharedres,
|
ExtCtrls, Menus, ComCtrls, Buttons, lcltype, strutils, ce_widget, ce_sharedres,
|
||||||
ce_common, ce_interfaces, ce_observer, ce_writableComponent, ce_dubproject,
|
ce_common, ce_interfaces, ce_observer, ce_writableComponent, ce_dubproject,
|
||||||
ce_nativeproject, EditBtn, ce_dialogs, ce_synmemo;
|
ce_nativeproject, EditBtn, ce_dialogs, ce_synmemo, ce_projutils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ end;
|
||||||
procedure TCEMiniExplorerWidget.btnEditClick(Sender: TObject);
|
procedure TCEMiniExplorerWidget.btnEditClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
proj: boolean = false;
|
fmt: TCEProjectFileFormat;
|
||||||
begin
|
begin
|
||||||
if lstFiles.Selected.isNil then exit;
|
if lstFiles.Selected.isNil then exit;
|
||||||
if lstFiles.Selected.Data.isNil then exit;
|
if lstFiles.Selected.Data.isNil then exit;
|
||||||
|
@ -474,7 +474,8 @@ begin
|
||||||
{$IFNDEF WINDOWS}
|
{$IFNDEF WINDOWS}
|
||||||
fname := fname[2..fname.length];
|
fname := fname[2..fname.length];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if isValidNativeProject(fname) then
|
fmt := projectFormat(fname);
|
||||||
|
if fmt in [pffCe, pffDub] then
|
||||||
begin
|
begin
|
||||||
if assigned(fFreeProj) then
|
if assigned(fFreeProj) then
|
||||||
begin
|
begin
|
||||||
|
@ -482,24 +483,13 @@ begin
|
||||||
exit;
|
exit;
|
||||||
fFreeProj.getProject.Free;
|
fFreeProj.getProject.Free;
|
||||||
end;
|
end;
|
||||||
TCENativeProject.create(nil);
|
if fmt = pffCe then
|
||||||
proj := true;
|
TCENativeProject.create(nil)
|
||||||
|
else
|
||||||
|
TCEDubProject.create(nil);
|
||||||
|
fProj.loadFromFile(fname);
|
||||||
end
|
end
|
||||||
else if isValidDubProject(fname) then
|
else getMultiDocHandler.openDocument(fname);
|
||||||
begin
|
|
||||||
if assigned(fFreeProj) then
|
|
||||||
begin
|
|
||||||
if fFreeProj.modified and (dlgFileChangeClose(fFreeProj.filename) = mrCancel) then
|
|
||||||
exit;
|
|
||||||
fFreeProj.getProject.Free;
|
|
||||||
end;
|
|
||||||
TCEDubProject.create(nil);
|
|
||||||
proj := true;
|
|
||||||
end;
|
|
||||||
if assigned(fProj) and proj then
|
|
||||||
fProj.loadFromFile(fname)
|
|
||||||
else
|
|
||||||
getMultiDocHandler.openDocument(fname);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMiniExplorerWidget.lstFilesDblClick(Sender: TObject);
|
procedure TCEMiniExplorerWidget.lstFilesDblClick(Sender: TObject);
|
||||||
|
|
|
@ -7,7 +7,7 @@ uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, ExtCtrls, Menus,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, ExtCtrls, Menus,
|
||||||
Buttons, dialogs, ComCtrls, StdCtrls,
|
Buttons, dialogs, ComCtrls, StdCtrls,
|
||||||
ce_widget, ce_common, ce_interfaces, ce_writableComponent, ce_observer,
|
ce_widget, ce_common, ce_interfaces, ce_writableComponent, ce_observer,
|
||||||
ce_nativeproject, ce_dubproject, ce_anyprojloader, ce_sharedres;
|
ce_nativeproject, ce_dubproject, ce_projutils, ce_sharedres;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -474,14 +474,19 @@ begin
|
||||||
Data:= p;
|
Data:= p;
|
||||||
case p.project.getFormat of
|
case p.project.getFormat of
|
||||||
pfNative: Caption := p.fFilename.extractFileName;
|
pfNative: Caption := p.fFilename.extractFileName;
|
||||||
pfDub: Caption := TCEDubProject(p.project.getProject).json.Strings['name'];
|
pfDub: Caption := TCEDubProject(p.project.getProject).packageName;
|
||||||
end;
|
end;
|
||||||
SubItems.Add(typeStr[p.fProj.getFormat]);
|
SubItems.Add(typeStr[p.fProj.getFormat]);
|
||||||
SubItems.Add(p.fProj.configurationName(p.fProj.getActiveConfigurationIndex));
|
SubItems.Add(p.fProj.configurationName(p.fProj.getActiveConfigurationIndex));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if fFreeProj <> nil then
|
if fFreeProj <> nil then
|
||||||
StaticText1.Caption:= 'Free standing: ' + shortenPath(fFreeProj.filename, 30)
|
begin
|
||||||
|
case fFreeProj.getFormat of
|
||||||
|
pfNative: StaticText1.Caption:= 'Free standing: ' + fFreeProj.filename.extractFileName;
|
||||||
|
pfDub: StaticText1.Caption:= 'Free standing: ' + TCEDubProject(fFreeProj.getProject).packageName;
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
StaticText1.Caption:= 'No free standing project';
|
StaticText1.Caption:= 'No free standing project';
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
unit ce_anyprojloader;
|
unit ce_projutils;
|
||||||
{$I ce_defines.inc}
|
{$I ce_defines.inc}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
@ -7,6 +7,9 @@ uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
ce_nativeproject, ce_dubproject, ce_interfaces, ce_common, ce_observer;
|
ce_nativeproject, ce_dubproject, ce_interfaces, ce_common, ce_observer;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCEProjectFileFormat = (pffNone, pffCe, pffDub);
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Loads either a DUB or a CE project. If the filename is invalid or if it
|
* Loads either a DUB or a CE project. If the filename is invalid or if it
|
||||||
* doesn't points to a valid project, nil is returned, otherwise a project.
|
* doesn't points to a valid project, nil is returned, otherwise a project.
|
||||||
|
@ -15,8 +18,38 @@ uses
|
||||||
*)
|
*)
|
||||||
function loadProject(const filename: string; discret: boolean): ICECommonProject;
|
function loadProject(const filename: string; discret: boolean): ICECommonProject;
|
||||||
|
|
||||||
|
(**
|
||||||
|
* Indicates wether a file is a project, either CE or DUB.
|
||||||
|
*)
|
||||||
|
function isProject(const filename: string): boolean;
|
||||||
|
|
||||||
|
(**
|
||||||
|
* Indicates wether a file is a project, either CE or DUB.
|
||||||
|
*)
|
||||||
|
function projectFormat(const filename: string): TCEProjectFileFormat;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function isProject(const filename: string): boolean;
|
||||||
|
begin
|
||||||
|
if filename.extractFileExt = '.json' then
|
||||||
|
result := isValidDubProject(filename)
|
||||||
|
else
|
||||||
|
result := isValidNativeProject(filename);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function projectFormat(const filename: string): TCEProjectFileFormat;
|
||||||
|
begin
|
||||||
|
result := pffNone;
|
||||||
|
if filename.extractFileExt = '.json' then
|
||||||
|
begin
|
||||||
|
if isValidDubProject(filename) then
|
||||||
|
result := pffDub;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if isValidNativeProject(filename) then result := pffCe;
|
||||||
|
end;
|
||||||
|
|
||||||
function loadProject(const filename: string; discret: boolean): ICECommonProject;
|
function loadProject(const filename: string; discret: boolean): ICECommonProject;
|
||||||
var
|
var
|
||||||
isDubProject: boolean = false;
|
isDubProject: boolean = false;
|
Loading…
Reference in New Issue