MG: fixed save lrs to test dir

git-svn-id: trunk@1621 -
This commit is contained in:
lazarus 2002-04-21 06:53:55 +00:00
parent 6c8804716a
commit 25b2c52fe6
4 changed files with 84 additions and 63 deletions

View File

@ -452,17 +452,10 @@ begin
// find MainCode (= the start source, e.g. a unit/program/package source)
Result:=Code;
if Result=nil then exit;
while (not FilenameHasSourceExt(Result.Filename)) do begin
// source is no begin of unit/program/package
// perhaps it is included by another source
if Result.LastIncludedByFile<>'' then begin
// source is included
// if this is an include file, find the top level source
while (Result.LastIncludedByFile<>'') do begin
Result:=SourceCache.LoadFile(Result.LastIncludedByFile);
if Result=nil then exit;
end else begin
// source was never parsed
exit;
end;
end;
if FilenameHasSourceExt(Result.Filename) and (Result.Scanner=nil) then begin
// create a scanner for the unit/program

View File

@ -2601,7 +2601,7 @@ var
Driver: TAbstractObjectWriter;
Writer:TWriter;
ACaption, AText: string;
CompResourceCode, LFMFilename, TestFilename: string;
CompResourceCode, LFMFilename, TestFilename, ResTestFilename: string;
begin
// save lrs - lazarus resource file and lfm - lazarus form text file
// Note: When there is a bug in the source, no resource code can be found,
@ -2635,11 +2635,18 @@ begin
[mbAbort, mbRetry, mbIgnore], 0);
if Result=mrAbort then exit;
if Result=mrIgnore then Result:=mrOk;
FormSavingOk:=false;
end;
until Result<>mrRetry;
// create lazarus form resource code
if FormSavingOk then begin
if ResourceCode<>nil then begin
if (sfSaveToTestDir in Flags) then begin
ResTestFilename:=ChangeFileExt(GetTestUnitFilename(AnUnitInfo),
ResourceFileExt);
ResourceCode:=CodeToolBoss.CreateFile(ResTestFilename);
FormSavingOk:=(ResourceCode<>nil);
end;
if FormSavingOk then begin
// there is no bug in the source, so the resource code should be
// changed too
MemStream:=TMemoryStream.Create;
@ -2653,10 +2660,13 @@ begin
finally
MemStream.Free;
end;
end;
if FormSavingOk then begin
{$IFDEF IDE_DEBUG}
writeln('TMainIDE.SaveFileResources E ',CompResourceCode);
{$ENDIF}
// replace lazarus form resource code
if not (sfSaveToTestDir in Flags) then begin
if (not CodeToolBoss.AddLazarusResource(ResourceCode,
'T'+AnUnitInfo.FormName,CompResourceCode)) then
begin
@ -2668,6 +2678,9 @@ writeln('TMainIDE.SaveFileResources E ',CompResourceCode);
Result:=MessageDlg(ACaption, AText, mtError, [mbIgnore, mbAbort],0);
if Result=mrAbort then exit;
end;
end else begin
ResourceCode.Source:=CompResourceCode;
end;
end;
if (not (sfSaveToTestDir in Flags)) then begin
// save lfm file
@ -6222,6 +6235,9 @@ end.
{ =============================================================================
$Log$
Revision 1.280 2002/04/21 06:53:52 lazarus
MG: fixed save lrs to test dir
Revision 1.279 2002/04/16 08:55:04 lazarus
MG: added path editor for compiler options

View File

@ -1,5 +1,17 @@
// included by stdctrls.pp
{------------------------------------------------------------------------------}
{ function TCustomGroupBox.AdjustClientRect }
{------------------------------------------------------------------------------}
procedure TCustomGroupBox.AdjustClientRect(var Rect: TRect);
begin
inherited;
// ToDo: ask the interface for the logical clientrect
end;
{------------------------------------------------------------------------------}
{ function TCustomGroupBox.Create }
{------------------------------------------------------------------------------}
@ -14,18 +26,13 @@ end;
{
$Log$
Revision 1.3 2002/04/21 06:53:55 lazarus
MG: fixed save lrs to test dir
Revision 1.2 2002/04/18 08:09:03 lazarus
MG: added include comments
Revision 1.1 2000/07/13 10:28:25 michael
+ Initial import
Revision 1.1 2000/04/02 20:49:56 lazarus
MWE:
Moved lazarus/lcl/*.inc files to lazarus/lcl/include
Revision 1.3 2000/01/02 00:25:12 lazarus
Stoppok:
- enhanced TCustomradiogroup & TCustomgroupbox
}

View File

@ -114,6 +114,8 @@ type
TCustomGroupBox = class (TWinControl) {class(TCustomControl) }
protected
procedure AdjustClientRect(var Rect: TRect); override;
public
constructor Create(AOwner : TComponent); Override;
end;
@ -581,6 +583,9 @@ end.
{ =============================================================================
$Log$
Revision 1.25 2002/04/21 06:53:54 lazarus
MG: fixed save lrs to test dir
Revision 1.24 2002/04/18 08:09:03 lazarus
MG: added include comments