implemented allowing parent as AnchorSide.Control

git-svn-id: trunk@6701 -
This commit is contained in:
mattias 2005-01-27 00:55:04 +00:00
parent 817395b4a9
commit 2753b3ab94
4 changed files with 78 additions and 2 deletions

View File

@ -492,6 +492,7 @@ begin
if TObject(SelectedControls[i]) is TControl then begin if TObject(SelectedControls[i]) is TControl then begin
CurControl:=TControl(SelectedControls[i]); CurControl:=TControl(SelectedControls[i]);
if CurControl.Parent<>nil then begin if CurControl.Parent<>nil then begin
sl.Add(ControlToStr(CurControl.Parent));
for j:=0 to CurControl.Parent.ControlCount-1 do begin for j:=0 to CurControl.Parent.ControlCount-1 do begin
Sibling:=CurControl.Parent.Controls[j]; Sibling:=CurControl.Parent.Controls[j];
if Sibling<>CurControl then if Sibling<>CurControl then
@ -510,7 +511,7 @@ end;
function TAnchorDesigner.AnchorDesignerNoSiblingText: string; function TAnchorDesigner.AnchorDesignerNoSiblingText: string;
begin begin
Result:='(parent borders)'; Result:='(nil)';
end; end;
procedure TAnchorDesigner.Refresh(Force: boolean); procedure TAnchorDesigner.Refresh(Force: boolean);

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, LazarusIDEStrConsts, FileUtil, IDEProcs, EnvironmentOpts, Buttons, LazarusIDEStrConsts, FileUtil, IDEProcs, EnvironmentOpts,
CompilerOptions, ExtToolEditDlg, TransferMacros; CompilerOptions, ExtToolEditDlg, TransferMacros, LazConf;
type type
TCompilerOptionsTest = ( TCompilerOptionsTest = (
@ -92,11 +92,13 @@ var
CompilerFilename: String; CompilerFilename: String;
CompileTool: TExternalToolOptions; CompileTool: TExternalToolOptions;
CmdLineParams: String; CmdLineParams: String;
CompilerFiles: TStrings;
begin begin
Result:=mrCancel; Result:=mrCancel;
if Test<>cotNone then exit; if Test<>cotNone then exit;
CompileTool:=nil; CompileTool:=nil;
TestMemo.Lines.Clear; TestMemo.Lines.Clear;
CompilerFiles:=nil;
try try
// check compiler filename // check compiler filename
FTest:=cotCheckCompilerExe; FTest:=cotCheckCompilerExe;
@ -113,6 +115,20 @@ begin
end; end;
end; end;
// check if there are several compilers in path
CompilerFiles:=SearchAllFilesInPath(GetDefaultCompilerFilename,'',
SysUtils.GetEnvironmentVariable('PATH'),':',[sffDontSearchInBasePath]);
if (CompilerFiles<>nil) and (CompilerFiles.Count>1) then begin
Result:=MessageDlg('Ambigious Compiler',
'There are several FreePascal Compilers in your path.'#13#13
+CompilerFiles.Text+#13
+'Maybe you forgot to delete an old compiler?',
mtWarning,[mbCancel,mbIgnore],0);
if Result<>mrIgnore then exit;
end;
// compile bogus file // compile bogus file
FTest:=cotCompileBogusFiles; FTest:=cotCompileBogusFiles;
TestGroupbox.Caption:='Test: Compiling an empty file ...'; TestGroupbox.Caption:='Test: Compiling an empty file ...';
@ -156,6 +172,7 @@ begin
end; end;
finally finally
CompilerFiles.Free;
CompileTool.Free; CompileTool.Free;
FTest:=cotNone; FTest:=cotNone;
TestGroupbox.Caption:='Test'; TestGroupbox.Caption:='Test';

View File

@ -79,6 +79,8 @@ type
function SearchFileInPath(const Filename, BasePath, SearchPath, function SearchFileInPath(const Filename, BasePath, SearchPath,
Delimiter: string; Flags: TSearchFileInPathFlags): string; Delimiter: string; Flags: TSearchFileInPathFlags): string;
function SearchAllFilesInPath(const Filename, BasePath, SearchPath,
Delimiter: string; Flags: TSearchFileInPathFlags): TStrings;
function GetAllFilesMask: string; function GetAllFilesMask: string;
// file actions // file actions
@ -118,6 +120,9 @@ end.
{ {
$Log$ $Log$
Revision 1.6 2005/01/27 00:55:04 mattias
implemented allowing parent as AnchorSide.Control
Revision 1.5 2005/01/12 23:58:31 mattias Revision 1.5 2005/01/12 23:58:31 mattias
improved project: recognizing if filename was fixed before pathdelim changed improved project: recognizing if filename was fixed before pathdelim changed

View File

@ -1071,6 +1071,56 @@ begin
Result:=''; Result:='';
end; end;
function SearchAllFilesInPath(const Filename, BasePath, SearchPath,
Delimiter: string; Flags: TSearchFileInPathFlags): TStrings;
procedure Add(NewFilename: string);
var
i: Integer;
begin
NewFilename:=TrimFilename(NewFilename);
if not FileExists(NewFilename) then exit;
if Result=nil then begin
Result:=TStringList.Create;
end else begin
for i:=0 to Result.Count-1 do
if CompareFilenames(Result[i],NewFilename)=0 then exit;
end;
Result.Add(NewFilename);
end;
var
p, StartPos, l: integer;
CurPath, Base: string;
begin
Result:=nil;
if (Filename='') then exit;
// check if filename absolute
if FilenameIsAbsolute(Filename) then begin
Add(CleanAndExpandFilename(Filename));
exit;
end;
Base:=CleanAndExpandDirectory(BasePath);
// search in current directory
if (not (sffDontSearchInBasePath in Flags)) then begin
Add(CleanAndExpandFilename(Base+Filename));
end;
// search in search path
StartPos:=1;
l:=length(SearchPath);
while StartPos<=l do begin
p:=StartPos;
while (p<=l) and (pos(SearchPath[p],Delimiter)<1) do inc(p);
CurPath:=TrimFilename(copy(SearchPath,StartPos,p-StartPos));
if CurPath<>'' then begin
if not FilenameIsAbsolute(CurPath) then
CurPath:=Base+CurPath;
Add(CleanAndExpandFilename(AppendPathDelim(CurPath)+Filename));
end;
StartPos:=p+1;
end;
end;
function GetAllFilesMask: string; function GetAllFilesMask: string;
begin begin
{$IFDEF win32} {$IFDEF win32}
@ -1105,6 +1155,9 @@ end;
{ {
$Log$ $Log$
Revision 1.10 2005/01/27 00:55:04 mattias
implemented allowing parent as AnchorSide.Control
Revision 1.9 2005/01/12 23:58:31 mattias Revision 1.9 2005/01/12 23:58:31 mattias
improved project: recognizing if filename was fixed before pathdelim changed improved project: recognizing if filename was fixed before pathdelim changed