mirror of https://gitlab.com/basile.b/dexed.git
project interface, set conf index
This commit is contained in:
parent
f82e39bd71
commit
93dcaaad4b
|
@ -66,7 +66,8 @@ type
|
||||||
function importPath(index: integer): string;
|
function importPath(index: integer): string;
|
||||||
//
|
//
|
||||||
function configurationCount: integer;
|
function configurationCount: integer;
|
||||||
procedure setActiveConfiguration(index: integer);
|
function getActiveConfigurationIndex: integer;
|
||||||
|
procedure setActiveConfigurationIndex(index: integer);
|
||||||
function configurationName(index: integer): string;
|
function configurationName(index: integer): string;
|
||||||
//
|
//
|
||||||
function compile: boolean;
|
function compile: boolean;
|
||||||
|
@ -266,11 +267,16 @@ begin
|
||||||
exit(fConfigsCount);
|
exit(fConfigsCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEDubProject.setActiveConfiguration(index: integer);
|
function TCEDubProject.getActiveConfigurationIndex: integer;
|
||||||
|
begin
|
||||||
|
exit(fBuiltTypeIx * fConfigs.Count + fConfigIx);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEDubProject.setActiveConfigurationIndex(index: integer);
|
||||||
begin
|
begin
|
||||||
fBuiltTypeIx := index div fConfigs.Count;
|
fBuiltTypeIx := index div fConfigs.Count;
|
||||||
fConfigIx := index mod fConfigs.Count;
|
fConfigIx := index mod fConfigs.Count;
|
||||||
updateSourcesFromJson;
|
doModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCEDubProject.configurationName(index: integer): string;
|
function TCEDubProject.configurationName(index: integer): string;
|
||||||
|
@ -373,7 +379,7 @@ begin
|
||||||
if fConfigIx = 0 then exit;
|
if fConfigIx = 0 then exit;
|
||||||
//
|
//
|
||||||
item := fJSON.Find('configurations');
|
item := fJSON.Find('configurations');
|
||||||
if item = nil then exit;
|
if not assigned(item) then exit;
|
||||||
//
|
//
|
||||||
confs := TJSONArray(item);
|
confs := TJSONArray(item);
|
||||||
if fConfigIx > confs.Count -1 then exit;
|
if fConfigIx > confs.Count -1 then exit;
|
||||||
|
@ -386,8 +392,8 @@ var
|
||||||
value: TJSONData;
|
value: TJSONData;
|
||||||
begin
|
begin
|
||||||
value := fJSON.Find('name');
|
value := fJSON.Find('name');
|
||||||
if value <> nil then fPackageName := value.AsString
|
if not assigned(value) then fPackageName := ''
|
||||||
else fPackageName := '';
|
else fPackageName := value.AsString;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEDubProject.udpateConfigsFromJson;
|
procedure TCEDubProject.udpateConfigsFromJson;
|
||||||
|
@ -460,13 +466,13 @@ begin
|
||||||
try
|
try
|
||||||
// auto folders & files
|
// auto folders & files
|
||||||
item := fJSON.Find('mainSourceFile');
|
item := fJSON.Find('mainSourceFile');
|
||||||
if item <> nil then
|
if assigned(item) then
|
||||||
fSrcs.Add(ExtractRelativepath(fBasePath, item.AsString));
|
fSrcs.Add(ExtractRelativepath(fBasePath, item.AsString));
|
||||||
tryAddFromFolder(fBasePath + 'src');
|
tryAddFromFolder(fBasePath + 'src');
|
||||||
tryAddFromFolder(fBasePath + 'source');
|
tryAddFromFolder(fBasePath + 'source');
|
||||||
// custom folders
|
// custom folders
|
||||||
item := fJSON.Find('sourcePaths');
|
item := fJSON.Find('sourcePaths');
|
||||||
if item <> nil then
|
if assigned(item) then
|
||||||
begin
|
begin
|
||||||
arr := TJSONArray(item);
|
arr := TJSONArray(item);
|
||||||
for i := 0 to arr.Count-1 do
|
for i := 0 to arr.Count-1 do
|
||||||
|
@ -477,21 +483,21 @@ begin
|
||||||
end;
|
end;
|
||||||
// custom files
|
// custom files
|
||||||
item := fJSON.Find('sourceFiles');
|
item := fJSON.Find('sourceFiles');
|
||||||
if item <> nil then
|
if assigned(item) then
|
||||||
begin
|
begin
|
||||||
arr := TJSONArray(item);
|
arr := TJSONArray(item);
|
||||||
for i := 0 to arr.Count-1 do
|
for i := 0 to arr.Count-1 do
|
||||||
fSrcs.Add(ExtractRelativepath(fBasePath, arr.Strings[i]));
|
fSrcs.Add(ExtractRelativepath(fBasePath, arr.Strings[i]));
|
||||||
end;
|
end;
|
||||||
conf := getCurrentCustomConfig;
|
conf := getCurrentCustomConfig;
|
||||||
if conf <> nil then
|
if assigned(conf) then
|
||||||
begin
|
begin
|
||||||
item := conf.Find('mainSourceFile');
|
item := conf.Find('mainSourceFile');
|
||||||
if item <> nil then
|
if assigned(item) then
|
||||||
fSrcs.Add(ExtractRelativepath(fBasePath, item.AsString));
|
fSrcs.Add(ExtractRelativepath(fBasePath, item.AsString));
|
||||||
// custom folders in current config
|
// custom folders in current config
|
||||||
item := conf.Find('sourcePaths');
|
item := conf.Find('sourcePaths');
|
||||||
if item <> nil then
|
if assigned(item) then
|
||||||
begin
|
begin
|
||||||
arr := TJSONArray(item);
|
arr := TJSONArray(item);
|
||||||
for i := 0 to arr.Count-1 do
|
for i := 0 to arr.Count-1 do
|
||||||
|
@ -502,7 +508,7 @@ begin
|
||||||
end;
|
end;
|
||||||
// custom files in current config
|
// custom files in current config
|
||||||
item := conf.Find('sourceFiles');
|
item := conf.Find('sourceFiles');
|
||||||
if item <> nil then
|
if assigned(item) then
|
||||||
begin
|
begin
|
||||||
arr := TJSONArray(item);
|
arr := TJSONArray(item);
|
||||||
for i := 0 to arr.Count-1 do
|
for i := 0 to arr.Count-1 do
|
||||||
|
@ -547,11 +553,11 @@ var
|
||||||
src: string;
|
src: string;
|
||||||
begin
|
begin
|
||||||
fBinKind := executable;
|
fBinKind := executable;
|
||||||
if fJSON = nil then exit;
|
if not assigned(fJSON) then exit;
|
||||||
// note: in Coedit this is only used to known if output can be launched
|
// note: in Coedit this is only used to known if output can be launched
|
||||||
found := findTargetKindInd(fJSON);
|
found := findTargetKindInd(fJSON);
|
||||||
conf := getCurrentCustomConfig;
|
conf := getCurrentCustomConfig;
|
||||||
if conf <> nil then
|
if assigned(conf) then
|
||||||
found := found or findTargetKindInd(conf);
|
found := found or findTargetKindInd(conf);
|
||||||
if not found then
|
if not found then
|
||||||
begin
|
begin
|
||||||
|
@ -589,7 +595,7 @@ procedure TCEDubProject.updateImportPathsFromJson;
|
||||||
var
|
var
|
||||||
conf: TJSONObject;
|
conf: TJSONObject;
|
||||||
begin
|
begin
|
||||||
if fJSON = nil then exit;
|
if not assigned(fJSON) then exit;
|
||||||
//
|
//
|
||||||
addFrom(fJSON);
|
addFrom(fJSON);
|
||||||
conf := getCurrentCustomConfig;
|
conf := getCurrentCustomConfig;
|
||||||
|
|
|
@ -53,9 +53,11 @@ type
|
||||||
// returns the count of configuration
|
// returns the count of configuration
|
||||||
function configurationCount: integer;
|
function configurationCount: integer;
|
||||||
// sets the active configuration
|
// sets the active configuration
|
||||||
procedure setActiveConfiguration(index: integer);
|
procedure setActiveConfigurationIndex(index: integer);
|
||||||
// returns the name of the index-th configuration
|
// returns the name of the index-th configuration
|
||||||
function configurationName(index: integer): string;
|
function configurationName(index: integer): string;
|
||||||
|
// return the index of the active configration index
|
||||||
|
function getActiveConfigurationIndex: integer;
|
||||||
|
|
||||||
// project sources ---------------------------------------------------------
|
// project sources ---------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,9 @@ type
|
||||||
function modified: boolean;
|
function modified: boolean;
|
||||||
//
|
//
|
||||||
function configurationCount: integer;
|
function configurationCount: integer;
|
||||||
procedure setActiveConfiguration(index: integer);
|
procedure setActiveConfigurationIndex(index: integer);
|
||||||
function configurationName(index: integer): string;
|
function configurationName(index: integer): string;
|
||||||
|
function getActiveConfigurationIndex: integer;
|
||||||
//
|
//
|
||||||
function sourcesCount: integer;
|
function sourcesCount: integer;
|
||||||
function sourceRelative(index: integer): string;
|
function sourceRelative(index: integer): string;
|
||||||
|
@ -838,11 +839,16 @@ begin
|
||||||
exit(fConfigs.Count);
|
exit(fConfigs.Count);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCENativeProject.setActiveConfiguration(index: integer);
|
procedure TCENativeProject.setActiveConfigurationIndex(index: integer);
|
||||||
begin
|
begin
|
||||||
setConfIx(index);
|
setConfIx(index);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCENativeProject.getActiveConfigurationIndex: integer;
|
||||||
|
begin
|
||||||
|
exit(fConfIx);
|
||||||
|
end;
|
||||||
|
|
||||||
function TCENativeProject.configurationName(index: integer): string;
|
function TCENativeProject.configurationName(index: integer): string;
|
||||||
begin
|
begin
|
||||||
if index > fConfigs.Count -1 then index := fConfigs.Count -1;
|
if index > fConfigs.Count -1 then index := fConfigs.Count -1;
|
||||||
|
|
Loading…
Reference in New Issue