diff --git a/ide/main.pp b/ide/main.pp index 9fe6bbdf23..514be0ebac 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -2298,6 +2298,7 @@ begin SetDefaultsForForm(NewForm); NewUnitInfo.FormName:=NewForm.Name; + NewUnitInfo.FormResourceName:=NewUnitInfo.FormName; if NewUnitInfo.IsPartOfProject then Project1.AddCreateFormToProjectFile(NewForm.ClassName,NewForm.Name); @@ -2650,6 +2651,11 @@ begin {$ENDIF} // replace lazarus form resource code if not (sfSaveToTestDir in Flags) then begin + if (AnUnitInfo.FormName<>AnUnitInfo.FormResourceName) + and (AnUnitInfo.FormResourceName<>'') then begin + CodeToolBoss.RemoveLazarusResource(ResourceCode, + 'T'+AnUnitInfo.FormResourceName); + end; if (not CodeToolBoss.AddLazarusResource(ResourceCode, 'T'+AnUnitInfo.FormName,CompResourceCode)) then begin @@ -2662,6 +2668,7 @@ begin if Result=mrAbort then exit; end else begin AnUnitInfo.ResourceFileName:=ResourceCode.Filename; + AnUnitInfo.FormResourceName:=AnUnitInfo.FormName; end; end else begin ResourceCode.Source:=CompResourceCode; @@ -2935,6 +2942,7 @@ begin AnUnitInfo.Form:=TempForm; SetDefaultsForForm(TempForm); AnUnitInfo.FormName:=TempForm.Name; + AnUnitInfo.FormResourceName:=AnUnitInfo.FormName; // show form TDesigner(TempForm.Designer).SourceEditor:= SourceNoteBook.GetActiveSE; @@ -3305,7 +3313,8 @@ begin // create source code if NewUnitType in [nuForm] then begin NewUnitInfo.FormName:=Project1.NewUniqueFormName(NewUnitType); - CodeToolBoss.CreateFile(ChangeFileExt(NewFilename,'.lrs')); + NewUnitInfo.FormResourceName:=''; + CodeToolBoss.CreateFile(ChangeFileExt(NewFilename,ResourceFileExt)); end; NewUnitInfo.CreateStartCode(NewUnitType,NewUnitName); @@ -6594,6 +6603,9 @@ end. { ============================================================================= $Log$ + Revision 1.345 2002/08/21 07:16:57 lazarus + MG: reduced mem leak of clipping stuff, still not fixed + Revision 1.344 2002/08/19 18:24:25 lazarus MG: fixed mouse coords while component dragging diff --git a/ide/project.pp b/ide/project.pp index b0a8c8779c..8d529a142f 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -76,8 +76,9 @@ type fEditorIndex: integer; fFileName: string; fForm: TComponent; - fFormName: string; // classname is always T - // this attribute contains the formname even if the unit is not loaded + fFormName: string; { classname is always T + this attribute contains the formname even if the unit is not loaded } + fFormResourceName: string; fHasResources: boolean; // source has resource file FIgnoreFileDateOnDiskValid: boolean; FIgnoreFileDateOnDisk: longint; @@ -150,6 +151,8 @@ type property Filename: String read GetFilename; property Form: TComponent read fForm write SetForm; property FormName: string read fFormName write fFormName; + property FormResourceName: string + read fFormResourceName write fFormResourceName; property HasResources: boolean read GetHasResources write fHasResources; property IsPartOfProject: boolean read fIsPartOfProject write fIsPartOfProject; @@ -508,6 +511,7 @@ begin fFilename := ''; fForm := nil; fFormName := ''; + fFormResourceName := ''; fHasResources := false; FIgnoreFileDateOnDiskValid:=false; fIsPartOfProject := false; @@ -1876,6 +1880,9 @@ end. { $Log$ + Revision 1.72 2002/08/21 07:16:59 lazarus + MG: reduced mem leak of clipping stuff, still not fixed + Revision 1.71 2002/08/07 09:55:28 lazarus MG: codecompletion now checks for filebreaks, savefile now checks for filedate