mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 01:28:19 +02:00
implemented autofixing MainUnit IDE directive PathDelim by Vincent
git-svn-id: trunk@5989 -
This commit is contained in:
parent
e87765f977
commit
06702cefa4
@ -2245,7 +2245,7 @@ begin
|
||||
EndPos:=StartPos;
|
||||
while (EndPos<=MaxPos) and (ASource[EndPos]<>'}') do inc(EndPos);
|
||||
if (EndPos=StartPos) or (EndPos>MaxPos) then exit;
|
||||
Filename:=copy(ASource,StartPos,EndPos-StartPos);
|
||||
Filename:=SetDirSeparators(copy(ASource,StartPos,EndPos-StartPos));
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
10
ide/main.pp
10
ide/main.pp
@ -4871,6 +4871,7 @@ begin
|
||||
if FilenameIsPascalUnit(AFilename) then begin
|
||||
// this could be a unit with a form
|
||||
if (not Project1.AutoOpenDesignerFormsDisabled)
|
||||
and (not (ofDoNotLoadResource in Flags))
|
||||
and (EnvironmentOptions.AutoCreateFormsOnOpen
|
||||
or (NewUnitInfo.Component<>nil))
|
||||
then begin
|
||||
@ -6701,6 +6702,7 @@ var
|
||||
UnitCode, LFMCode: TCodeBuffer;
|
||||
HasDFMFile: boolean;
|
||||
LFMFilename: String;
|
||||
OldOpenEditorsOnCodeToolChange: Boolean;
|
||||
begin
|
||||
// check file and directory
|
||||
writeln('TMainIDE.DoConvertDelphiUnit A ',DelphiFilename);
|
||||
@ -6752,6 +6754,7 @@ begin
|
||||
// add {$i unit.lrs} directive
|
||||
// comment all missing units in uses sections
|
||||
writeln('TMainIDE.DoConvertDelphiUnit Convert delphi source');
|
||||
OldOpenEditorsOnCodeToolChange:=FOpenEditorsOnCodeToolChange;
|
||||
FOpenEditorsOnCodeToolChange:=true;
|
||||
try
|
||||
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then begin
|
||||
@ -6796,7 +6799,7 @@ begin
|
||||
Result:=ConvertLFMtoLRSfile(LFMCode.Filename);
|
||||
if Result<>mrOk then exit;
|
||||
finally
|
||||
FOpenEditorsOnCodeToolChange:=false;
|
||||
FOpenEditorsOnCodeToolChange:=OldOpenEditorsOnCodeToolChange;
|
||||
end;
|
||||
|
||||
Result:=mrOk;
|
||||
@ -8861,7 +8864,7 @@ begin
|
||||
// open all sources in editor
|
||||
for i:=0 to Manager.SourceChangeCache.BuffersToModifyCount-1 do begin
|
||||
if DoOpenEditorFile(Manager.SourceChangeCache.BuffersToModify[i].Filename,
|
||||
-1,[ofOnlyIfExists])<>mrOk then
|
||||
-1,[ofOnlyIfExists,ofDoNotLoadResource])<>mrOk then
|
||||
begin
|
||||
Abort:=true;
|
||||
exit;
|
||||
@ -10697,6 +10700,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.769 2004/09/12 22:57:29 mattias
|
||||
implemented autofixing MainUnit IDE directive PathDelim by Vincent
|
||||
|
||||
Revision 1.768 2004/09/11 01:23:10 mattias
|
||||
implemented commenting missing units for Delphi unit conversion
|
||||
|
||||
|
@ -177,30 +177,6 @@ var
|
||||
SourceNotebook : TSourceNotebook;
|
||||
Project1: TProject;
|
||||
|
||||
const
|
||||
OpenFlagNames: array[TOpenFlag] of string = (
|
||||
'ofProjectLoading',
|
||||
'ofOnlyIfExists',
|
||||
'ofRevert',
|
||||
'ofQuiet',
|
||||
'ofAddToRecent',
|
||||
'ofRegularFile',
|
||||
'ofVirtualFile',
|
||||
'ofConvertMacros',
|
||||
'ofUseCache',
|
||||
'ofMultiOpen'
|
||||
);
|
||||
|
||||
SaveFlagNames: array[TSaveFlag] of string = (
|
||||
'sfSaveAs',
|
||||
'sfSaveToTestDir',
|
||||
'sfProjectSaving',
|
||||
'sfCheckAmbigiousFiles'
|
||||
);
|
||||
|
||||
function OpenFlagsToString(Flags: TOpenFlags): string;
|
||||
function SaveFlagsToString(Flags: TSaveFlags): string;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
@ -222,36 +198,6 @@ begin
|
||||
Result:=CompareStringPointerI(UnitName,PChar(UnitFile^.UnitName));
|
||||
end;
|
||||
|
||||
function OpenFlagsToString(Flags: TOpenFlags): string;
|
||||
var
|
||||
Flag: TOpenFlag;
|
||||
begin
|
||||
Result:='';
|
||||
for Flag:=Low(TOpenFlag) to High(TOpenFlag) do begin
|
||||
if Flag in Flags then begin
|
||||
if Result<>'' then
|
||||
Result:=Result+',';
|
||||
Result:=Result+OpenFlagNames[Flag];
|
||||
end;
|
||||
end;
|
||||
Result:='['+Result+']';
|
||||
end;
|
||||
|
||||
function SaveFlagsToString(Flags: TSaveFlags): string;
|
||||
var
|
||||
Flag: TSaveFlag;
|
||||
begin
|
||||
Result:='';
|
||||
for Flag:=Low(TSaveFlag) to High(TSaveFlag) do begin
|
||||
if Flag in Flags then begin
|
||||
if Result<>'' then
|
||||
Result:=Result+',';
|
||||
Result:=Result+SaveFlagNames[Flag];
|
||||
end;
|
||||
end;
|
||||
Result:='['+Result+']';
|
||||
end;
|
||||
|
||||
{ TMainIDEBase }
|
||||
|
||||
procedure TMainIDEBase.mnuWindowsItemClick(Sender: TObject);
|
||||
|
@ -131,7 +131,8 @@ type
|
||||
ofVirtualFile, // open the virtual file
|
||||
ofConvertMacros, // replace macros in filename
|
||||
ofUseCache, // do not update file from disk
|
||||
ofMultiOpen // set during loading multiple files
|
||||
ofMultiOpen, // set during loading multiple files
|
||||
ofDoNotLoadResource// do not open form, datamodule, ...
|
||||
);
|
||||
TOpenFlags = set of TOpenFlag;
|
||||
|
||||
@ -279,7 +280,8 @@ const
|
||||
'ofVirtualFile',
|
||||
'ofConvertMacros',
|
||||
'ofUseCache',
|
||||
'ofMultiOpen'
|
||||
'ofMultiOpen',
|
||||
'ofDoNotLoadResource'
|
||||
);
|
||||
|
||||
SaveFlagNames: array[TSaveFlag] of string = (
|
||||
|
Loading…
Reference in New Issue
Block a user