IDE: Change {*.dfm} to {*.lfm} when renaming a unit (Save As). Finally fixes #21492.

git-svn-id: trunk@36381 -
This commit is contained in:
juha 2012-03-27 11:54:40 +00:00
parent 140edf602c
commit b54ecafd13
2 changed files with 13 additions and 12 deletions

View File

@ -171,6 +171,12 @@ begin
fLowerCaseRes:=True;
fIsConsoleApp:=False;
fCTLinkCreated:=True;
try
fCTLink.CodeTool.BuildTree(lsrInitializationStart);
except
on e: Exception do
CodeToolBoss.HandleException(e);
end;
end;
constructor TConvDelphiCodeTool.Create(ACTLink: TCodeToolLink);
@ -184,8 +190,10 @@ end;
destructor TConvDelphiCodeTool.Destroy;
begin
if fCTLinkCreated then
if fCTLinkCreated then begin
fCTLink.SrcCache.Apply;
fCTLink.Free;
end;
inherited Destroy;
end;

View File

@ -736,7 +736,7 @@ type
function DoOpenFileInSourceEditor(AnEditorInfo: TUnitEditorInfo;
PageIndex, WindowIndex: integer; Flags: TOpenFlags): TModalResult;
function DoLoadResourceFile(AnUnitInfo: TUnitInfo;
var LFMCode, LRSCode: TCodeBuffer; out LFMSuffix: string;
var LFMCode, LRSCode: TCodeBuffer;
IgnoreSourceErrors, AutoCreateResourceCode, ShowAbort: boolean): TModalResult;
function DoLoadLFM(AnUnitInfo: TUnitInfo; OpenFlags: TOpenFlags;
CloseFlags: TCloseFlags): TModalResult;
@ -5417,7 +5417,7 @@ begin
end;
function TMainIDE.DoLoadResourceFile(AnUnitInfo: TUnitInfo;
var LFMCode, LRSCode: TCodeBuffer; out LFMSuffix: string;
var LFMCode, LRSCode: TCodeBuffer;
IgnoreSourceErrors, AutoCreateResourceCode, ShowAbort: boolean): TModalResult;
const
LfmSuffices: array[0..1] of string = ('.lfm', '.dfm');
@ -5429,24 +5429,18 @@ var
begin
LFMCode:=nil;
LRSCode:=nil;
LFMSuffix:='';
//DebugLn(['TMainIDE.DoLoadResourceFile ',AnUnitInfo.Filename,' HasResources=',AnUnitInfo.HasResources,' IgnoreSourceErrors=',IgnoreSourceErrors,' AutoCreateResourceCode=',AutoCreateResourceCode]);
// Load the lfm file (without parsing)
if not AnUnitInfo.IsVirtual then begin // and (AnUnitInfo.Component<>nil)
Result:=mrNone;
for i := Low(LfmSuffices) to High(LfmSuffices) do begin
LFMSuffix:=LfmSuffices[i];
LFMFilename:=ChangeFileExt(AnUnitInfo.Filename,LFMSuffix);
LFMFilename:=ChangeFileExt(AnUnitInfo.Filename,LfmSuffices[i]);
if (FileExistsUTF8(LFMFilename)) then begin
Result:=LoadCodeBuffer(LFMCode,LFMFilename,[lbfCheckIfText],ShowAbort);
if not (Result in [mrOk,mrIgnore]) then
exit;
//??? Result:=DoLoadLFM(AnUnitInfo,LFMCode, [ofOnlyIfExists], [cfSaveDependencies]);
Break;
end;
end;
if Result=mrNone then
LFMSuffix:=''; // Not found.
end;
if AnUnitInfo.HasResources then begin
//writeln('TMainIDE.DoLoadResourceFile A "',AnUnitInfo.Filename,'" "',AnUnitInfo.ResourceFileName,'"');
@ -9178,10 +9172,9 @@ begin
// load old resource file
LFMCode:=nil;
LRSCode:=nil;
LFMSuffix:='';
if WasPascalSource then
begin
Result:=DoLoadResourceFile(AnUnitInfo,LFMCode,LRSCode,LFMSuffix,
Result:=DoLoadResourceFile(AnUnitInfo,LFMCode,LRSCode,
not (sfSaveAs in Flags),true,CanAbort);
if not (Result in [mrIgnore,mrOk]) then
exit;