mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 16:49:07 +02:00
IDE: build modes: value
git-svn-id: trunk@23104 -
This commit is contained in:
parent
c64b628c67
commit
f5604c0e91
@ -701,8 +701,8 @@ var
|
|||||||
begin
|
begin
|
||||||
// get values from dialog
|
// get values from dialog
|
||||||
// build
|
// build
|
||||||
BuildWorkingDir:=Trim(SpecialCharsToSpaces(BuildWorkDirCombobox.Text));
|
BuildWorkingDir:=SpecialCharsToSpaces(BuildWorkDirCombobox.Text,true);
|
||||||
BuildCommand:=Trim(SpecialCharsToSpaces(BuildCommandMemo.Lines.Text));
|
BuildCommand:=SpecialCharsToSpaces(BuildCommandMemo.Lines.Text,true);
|
||||||
BuildScanForFPCMsg:=BuildScanForFPCMsgCheckbox.Checked;
|
BuildScanForFPCMsg:=BuildScanForFPCMsgCheckbox.Checked;
|
||||||
BuildScanForMakeMsg:=BuildScanForMakeMsgCheckbox.Checked;
|
BuildScanForMakeMsg:=BuildScanForMakeMsgCheckbox.Checked;
|
||||||
BuildScan:=[];
|
BuildScan:=[];
|
||||||
@ -713,8 +713,8 @@ begin
|
|||||||
AlwaysBuildBeforeRun:=AlwaysCompileFirstCheckbox.Checked;
|
AlwaysBuildBeforeRun:=AlwaysCompileFirstCheckbox.Checked;
|
||||||
RunFlags:=[];
|
RunFlags:=[];
|
||||||
if AlwaysBuildBeforeRun then Include(RunFlags,idedrfBuildBeforeRun);
|
if AlwaysBuildBeforeRun then Include(RunFlags,idedrfBuildBeforeRun);
|
||||||
RunWorkingDir:=Trim(SpecialCharsToSpaces(RunWorkDirCombobox.Text));
|
RunWorkingDir:=SpecialCharsToSpaces(RunWorkDirCombobox.Text,true);
|
||||||
RunCommand:=Trim(SpecialCharsToSpaces(RunCommandMemo.Lines.Text));
|
RunCommand:=SpecialCharsToSpaces(RunCommandMemo.Lines.Text,true);
|
||||||
|
|
||||||
// set values to directivelist
|
// set values to directivelist
|
||||||
//DebugLn(['TBuildFileDialog.WriteDirectiveList ']);
|
//DebugLn(['TBuildFileDialog.WriteDirectiveList ']);
|
||||||
|
@ -1004,7 +1004,7 @@ begin
|
|||||||
// custom options
|
// custom options
|
||||||
CurCustomOptions:=InheritedOptionStrings[icoCustomOptions];
|
CurCustomOptions:=InheritedOptionStrings[icoCustomOptions];
|
||||||
if CurCustomOptions<>'' then
|
if CurCustomOptions<>'' then
|
||||||
Result := Result + ' ' + SpecialCharsToSpaces(CurCustomOptions);
|
Result := Result + ' ' + SpecialCharsToSpaces(CurCustomOptions,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MergeLinkerOptions(const OldOptions, AddOptions: string): string;
|
function MergeLinkerOptions(const OldOptions, AddOptions: string): string;
|
||||||
@ -2098,7 +2098,7 @@ begin
|
|||||||
if Result='' then exit;
|
if Result='' then exit;
|
||||||
|
|
||||||
// eliminate line breaks
|
// eliminate line breaks
|
||||||
Result:=SpecialCharsToSpaces(Result);
|
Result:=SpecialCharsToSpaces(Result,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseCompilerOptions.GetOptionsForCTDefines: string;
|
function TBaseCompilerOptions.GetOptionsForCTDefines: string;
|
||||||
@ -3498,7 +3498,7 @@ begin
|
|||||||
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
BaseDirectory:=GetParsedValue(pcosBaseDir);
|
||||||
s:=TrimSearchPath(s,BaseDirectory);
|
s:=TrimSearchPath(s,BaseDirectory);
|
||||||
end else if Option=pcosCustomOptions then begin
|
end else if Option=pcosCustomOptions then begin
|
||||||
s:=SpecialCharsToSpaces(s);
|
s:=SpecialCharsToSpaces(s,true);
|
||||||
end;
|
end;
|
||||||
Result:=s;
|
Result:=s;
|
||||||
end;
|
end;
|
||||||
@ -3933,11 +3933,13 @@ function TBuildModeGraph.FixModeName(const ModeName: string;
|
|||||||
var
|
var
|
||||||
CurMode: TBuildMode;
|
CurMode: TBuildMode;
|
||||||
begin
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if s='' then exit;
|
||||||
if (CheckToo<>nil) and (SysUtils.CompareText(CheckToo.Name,s)=0) then
|
if (CheckToo<>nil) and (SysUtils.CompareText(CheckToo.Name,s)=0) then
|
||||||
exit(false);
|
exit;
|
||||||
CurMode:=FindModeWithName(s);
|
CurMode:=FindModeWithName(s);
|
||||||
if (CurMode<>nil) and (CurMode<>Ignore) then
|
if (CurMode<>nil) and (CurMode<>Ignore) then
|
||||||
exit(false);
|
exit;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3945,14 +3947,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
Prefix: String;
|
Prefix: String;
|
||||||
begin
|
begin
|
||||||
Result:=ModeName;
|
Result:=SpecialCharsToSpaces(ModeName,true);
|
||||||
if Result<>'' then
|
|
||||||
Result:=copy(Result,1,strlen(PChar(Result)));
|
|
||||||
if Result<>'' then
|
|
||||||
UTF8FixBroken(PChar(Result));
|
|
||||||
for i:=length(Result) downto 1 do
|
|
||||||
if Result[i] in [#0..#31,#127] then
|
|
||||||
System.Delete(Result,i,1);
|
|
||||||
if NameOk(Result) then exit;
|
if NameOk(Result) then exit;
|
||||||
Prefix:=Result;
|
Prefix:=Result;
|
||||||
i:=0;
|
i:=0;
|
||||||
|
@ -25,8 +25,10 @@ unit BuildModesEditor;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, FileUtil, LResources, Forms, Grids, Menus,
|
Classes, SysUtils, LCLProc, Controls, FileUtil, LResources, Forms, Grids,
|
||||||
ComCtrls, CompilerOptions, IDEImagesIntf;
|
Menus, ComCtrls,
|
||||||
|
IDEImagesIntf,
|
||||||
|
CompilerOptions, IDEProcs;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -59,6 +61,8 @@ type
|
|||||||
protected
|
protected
|
||||||
function ValidateEntry(const ACol,ARow:Integer; const OldValue:string;
|
function ValidateEntry(const ACol,ARow:Integer; const OldValue:string;
|
||||||
var NewValue:string): boolean; override;
|
var NewValue:string): boolean; override;
|
||||||
|
function ValidateCell(const ACol, ARow: Integer;
|
||||||
|
var NewValue:string): boolean;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -87,6 +91,7 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function BuildModeFlagTypeCaptions(f: TBuildModeFlagType): string;
|
function BuildModeFlagTypeCaptions(f: TBuildModeFlagType): string;
|
||||||
|
function CaptionToBuildModeFlagType(s: string): TBuildModeFlagType;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -103,6 +108,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CaptionToBuildModeFlagType(s: string): TBuildModeFlagType;
|
||||||
|
begin
|
||||||
|
if s='' then exit(bmftNone);
|
||||||
|
for Result:=low(Result) to high(Result) do
|
||||||
|
if SysUtils.CompareText(s,BuildModeFlagTypeCaptions(Result))=0 then exit;
|
||||||
|
if IsValidIdent(s) then
|
||||||
|
Result:=bmftSetVariable
|
||||||
|
else
|
||||||
|
Result:=bmftNone;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TBuildModesGrid }
|
{ TBuildModesGrid }
|
||||||
|
|
||||||
function TBuildModesGrid.GetModeRows(Index: integer): TBuildModeGridRow;
|
function TBuildModesGrid.GetModeRows(Index: integer): TBuildModeGridRow;
|
||||||
@ -166,18 +182,48 @@ end;
|
|||||||
|
|
||||||
function TBuildModesGrid.ValidateEntry(const ACol, ARow: Integer;
|
function TBuildModesGrid.ValidateEntry(const ACol, ARow: Integer;
|
||||||
const OldValue: string; var NewValue: string): boolean;
|
const OldValue: string; var NewValue: string): boolean;
|
||||||
var
|
|
||||||
CurMode: TBuildModeGridRow;
|
|
||||||
begin
|
begin
|
||||||
|
//DebugLn(['TBuildModesGrid.ValidateEntry ',aCol]);
|
||||||
Result:=inherited ValidateEntry(aCol, aRow, OldValue, NewValue);
|
Result:=inherited ValidateEntry(aCol, aRow, OldValue, NewValue);
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
|
Result:=ValidateCell(ACol,ARow,NewValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBuildModesGrid.ValidateCell(const ACol, ARow: Integer;
|
||||||
|
var NewValue: string): boolean;
|
||||||
|
var
|
||||||
|
CurMode: TBuildModeGridRow;
|
||||||
|
TypeCol: Integer;
|
||||||
|
ValueCol: Integer;
|
||||||
|
FlagType: TBuildModeFlagType;
|
||||||
|
begin
|
||||||
|
Result:=true;
|
||||||
if (aRow>=1) and (aRow<=ModeRowCount) then begin
|
if (aRow>=1) and (aRow<=ModeRowCount) then begin
|
||||||
CurMode:=ModeRows[aRow-1];
|
CurMode:=ModeRows[aRow-1];
|
||||||
|
TypeCol:=GroupModeCount+1;
|
||||||
|
ValueCol:=TypeCol+1;
|
||||||
|
//DebugLn(['TBuildModesGrid.ValidateCell aCol=',acol,' aRow=',arow,' ValueCol=',ValueCol]);
|
||||||
if aCol=0 then begin
|
if aCol=0 then begin
|
||||||
|
// set new mode name
|
||||||
NewValue:=Graph.FixModeName(NewValue,CurMode.Mode);
|
NewValue:=Graph.FixModeName(NewValue,CurMode.Mode);
|
||||||
CurMode.Mode.Name:=NewValue;
|
CurMode.Mode.Name:=NewValue;
|
||||||
end else begin
|
end else if ACol=TypeCol then begin
|
||||||
|
NewValue:=SpecialCharsToSpaces(NewValue,true);
|
||||||
|
FlagType:=CaptionToBuildModeFlagType(NewValue);
|
||||||
|
if (CurMode.Flag=nil) and (FlagType<>bmftNone) then begin
|
||||||
|
// create flag
|
||||||
|
CurMode.FFlag:=CurMode.Mode.AddFlag(FlagType,'','');
|
||||||
|
end else if CurMode.Flag<>nil then
|
||||||
|
// set new FlagType
|
||||||
|
CurMode.Flag.FlagType:=FlagType;
|
||||||
|
end else if ACol=ValueCol then begin
|
||||||
|
NewValue:=SpecialCharsToSpaces(NewValue,true);
|
||||||
|
if (CurMode.Flag=nil) or (CurMode.Flag.FlagType=bmftNone) then
|
||||||
|
// no flag => no value
|
||||||
|
NewValue:=''
|
||||||
|
else
|
||||||
|
// set new value
|
||||||
|
CurMode.Flag.Value:=NewValue;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -208,7 +208,7 @@ function BinaryStrToText(const s: string): string;
|
|||||||
function SplitString(const s: string; Delimiter: char): TStrings;
|
function SplitString(const s: string; Delimiter: char): TStrings;
|
||||||
procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings;
|
procedure SplitString(const s: string; Delimiter: char; AddTo: TStrings;
|
||||||
ClearList: boolean = true);
|
ClearList: boolean = true);
|
||||||
function SpecialCharsToSpaces(const s: string): string;
|
function SpecialCharsToSpaces(const s: string; FixUTF8: boolean): string;
|
||||||
function SpecialCharsToHex(const s: string): string;
|
function SpecialCharsToHex(const s: string): string;
|
||||||
function LineBreaksToDelimiter(const s: string; Delimiter: char): string;
|
function LineBreaksToDelimiter(const s: string; Delimiter: char): string;
|
||||||
function LineBreaksToSystemLineBreaks(const s: string): string;
|
function LineBreaksToSystemLineBreaks(const s: string): string;
|
||||||
@ -1579,15 +1579,24 @@ end;
|
|||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
function SpecialCharsToSpaces(const s: string): string;
|
function SpecialCharsToSpaces(const s: string): string;
|
||||||
|
|
||||||
|
Converts illegal characters to spaces.
|
||||||
|
Trim leading and trailing spaces.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
function SpecialCharsToSpaces(const s: string): string;
|
function SpecialCharsToSpaces(const s: string; FixUTF8: boolean): string;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=s;
|
Result:=s;
|
||||||
for i:=1 to length(Result) do
|
for i:=1 to length(Result) do
|
||||||
if Result[i]<' ' then Result[i]:=' ';
|
if Result[i] in [#0..#31,#127] then Result[i]:=' ';
|
||||||
if Result='' then exit;
|
if Result='' then exit;
|
||||||
|
if FixUTF8 then begin
|
||||||
|
Result:=copy(Result,1,strlen(PChar(Result)));
|
||||||
|
if Result='' then exit;
|
||||||
|
UniqueString(Result);
|
||||||
|
UTF8FixBroken(PChar(Result));
|
||||||
|
end;
|
||||||
if (Result[1]=' ') or (Result[length(Result)]=' ') then
|
if (Result[1]=' ') or (Result[length(Result)]=' ') then
|
||||||
Result:=Trim(Result);
|
Result:=Trim(Result);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user