MG: improved handling of ambigious source files

git-svn-id: trunk@3290 -
This commit is contained in:
lazarus 2002-09-05 19:03:36 +00:00
parent 477b2808f2
commit fa42cd6ebc
3 changed files with 280 additions and 110 deletions

View File

@ -64,25 +64,48 @@ type
TDebuggerType = (dtNone, dtGnuDebugger);
TPascalExtType = (petNone, petPAS, petPP);
TLazarusLanguage = (llAutomatic, llEnglish, llGerman);
const
DebuggerName : array[TDebuggerType] of string = (
'(None)','GNU debugger (gdb)'
);
type
TPascalExtType = (petNone, petPAS, petPP);
const
PascalExtension: array[TPascalExtType] of string = ('', '.pas', '.pp');
type
TLazarusLanguage = (llAutomatic, llEnglish, llGerman);
const
LazarusLanguageNames: array[TLazarusLanguage] of string = (
'Automatic (default is english)', 'English', 'Deutsch'
);
LazarusLanguageIDs: array[TLazarusLanguage] of string = (
'', 'en', 'de'
);
PascalExtension: array[TPascalExtType] of string = ('', '.pas', '.pp');
type
TAmbigiousFileAction = (
afaAsk,
afaAutoDelete,
afaAutoRename,
afaWarnOnCompile,
afaIgnore
);
TAmbigiousFileActions = set of TAmbigiousFileAction;
const
AmbigiousFileActionNames: array[TAmbigiousFileAction] of string = (
'Ask',
'AutoDelete',
'AutoRename',
'WarnOnCompile',
'Ignore'
);
type
{ class for storing environment options }
TEnvironmentOptions = class
@ -150,7 +173,7 @@ type
// naming conventions
fPascalFileExtension: TPascalExtType;
fPascalFileLowerCase: boolean;
fAutoDeleteAmbigiousSources: boolean;
fAmbigiousFileAction: TAmbigiousFileAction;
// language
fLanguage: TLazarusLanguage;
@ -266,8 +289,8 @@ type
read fPascalFileExtension write fPascalFileExtension;
property PascalFileLowerCase: boolean
read fPascalFileLowerCase write fPascalFileLowerCase;
property AutoDeleteAmbigiousSources: boolean
read fAutoDeleteAmbigiousSources write fAutoDeleteAmbigiousSources;
property AmbigiousFileAction: TAmbigiousFileAction
read fAmbigiousFileAction write fAmbigiousFileAction;
// language
property Language: TLazarusLanguage read fLanguage write fLanguage;
@ -376,7 +399,7 @@ type
// naming conventions
PascalFileExtRadiogroup: TRadioGroup;
PascalFileLowercaseCheckBox: TCheckBox;
AutoDeleteAmbigiousSourcesCheckBox: TCheckBox;
AmbigiousFileActionRadioGroup: TRadioGroup;
// buttons at bottom
OkButton: TButton;
@ -432,7 +455,7 @@ function PascalExtToType(const Ext: string): TPascalExtType;
function FilenameIsPascalUnit(const Filename: string): boolean;
function FilenameIsPascalSource(const Filename: string): boolean;
function FilenameIsFormText(const Filename: string): boolean;
function AmbigiousFileActionNameToType(const Action: string): TAmbigiousFileAction;
implementation
@ -476,6 +499,16 @@ begin
Result:=petNone;
end;
function AmbigiousFileActionNameToType(
const Action: string): TAmbigiousFileAction;
begin
for Result:=Low(TAmbigiousFileAction) to High(TAmbigiousFileAction) do begin
if AnsiCompareText(AmbigiousFileActionNames[Result],Action)=0 then
exit;
end;
Result:=afaAsk;
end;
{ TEnvironmentOptions }
const
@ -792,8 +825,9 @@ begin
LoadPascalFileExt('EnvironmentOptions/');
fPascalFileLowerCase:=XMLConfig.GetValue(
'EnvironmentOptions/PascalFileLowerCase/Value',true);
fAutoDeleteAmbigiousSources:=XMLConfig.GetValue(
'EnvironmentOptions/AutoDeleteAmbigiousSources/Value',true);
fAmbigiousFileAction:=AmbigiousFileActionNameToType(XMLConfig.GetValue(
'EnvironmentOptions/AmbigiousFileAction/Value',
AmbigiousFileActionNames[fAmbigiousFileAction]));
XMLConfig.Free;
@ -951,7 +985,7 @@ begin
XMLConfig.SetValue('EnvironmentOptions/PascalFileLowerCase/Value',
fPascalFileLowerCase);
XMLConfig.SetValue('EnvironmentOptions/AutoDeleteAmbigiousSources/Value',
fAutoDeleteAmbigiousSources);
AmbigiousFileActionNames[fAmbigiousFileAction]);
XMLConfig.Flush;
XMLConfig.Free;
@ -2159,14 +2193,24 @@ begin
Visible:=true;
end;
AutoDeleteAmbigiousSourcesCheckBox:=TCheckBox.Create(Self);
with AutoDeleteAmbigiousSourcesCheckBox do begin
Name:='AutoDeleteAmbigiousSourcesCheckBox';
AmbigiousFileActionRadioGroup:=TRadioGroup.Create(Self);
with AmbigiousFileActionRadioGroup do begin
Name:='AmbigiousFileActionRadioGroup';
Parent:=NoteBook.Page[Page];
Left:=PascalFileLowercaseCheckBox.Left;
Top:=PascalFileLowercaseCheckBox.Top+PascalFileLowercaseCheckBox.Height+10;
Width:=300;
Caption:='Auto delete ambigious sources';
Top:=PascalFileLowercaseCheckBox.Top+PascalFileLowercaseCheckBox.Height+15;
Width:=200;
Height:=130;
Caption:='Ambigious file action:';
with Items do begin
BeginUpdate;
Add('Ask');
Add('Auto delete file');
Add('Auto rename file');
Add('Warn on compile');
Add('Ignore');
EndUpdate;
end;
Visible:=true;
end;
end;
@ -2672,10 +2716,11 @@ begin
Width:=300;
end;
with AutoDeleteAmbigiousSourcesCheckBox do begin
with AmbigiousFileActionRadioGroup do begin
Left:=PascalFileLowercaseCheckBox.Left;
Top:=PascalFileLowercaseCheckBox.Top+PascalFileLowercaseCheckBox.Height+10;
Width:=300;
Top:=PascalFileLowercaseCheckBox.Top+PascalFileLowercaseCheckBox.Height+15;
Width:=200;
Height:=130;
end;
end;
@ -2925,7 +2970,7 @@ begin
if PascalFileExtRadiogroup.Items[i]=PascalExtension[PascalFileExtension]
then PascalFileExtRadiogroup.ItemIndex:=i;
PascalFileLowercaseCheckBox.Checked:=PascalFileLowerCase;
AutoDeleteAmbigiousSourcesCheckBox.Checked:=AutoDeleteAmbigiousSources;
AmbigiousFileActionRadioGroup.ItemIndex:=ord(AmbigiousFileAction);
end;
end;
@ -3038,7 +3083,8 @@ begin
else
PascalFileExtension:=petPAS;
PascalFileLowerCase:=PascalFileLowercaseCheckBox.Checked;
AutoDeleteAmbigiousSources:=AutoDeleteAmbigiousSourcesCheckBox.Checked;
AmbigiousFileAction:=
TAmbigiousFileAction(AmbigiousFileActionRadioGroup.ItemIndex);
end;
end;

View File

@ -43,8 +43,8 @@ uses
Classes, LazarusIDEStrConsts, LCLType, LclLinux, Compiler, StdCtrls, Forms,
Buttons, Menus, ComCtrls, Spin, Project, SysUtils, FileCtrl, Controls,
Graphics, ExtCtrls, Dialogs, LazConf, CompReg, CodeToolManager,
ObjectInspector, PropEdits, SynEditKeyCmds,
MsgView, EditorOptions, IDEComp, FormEditor,
ObjectInspector, PropEdits, SynEditKeyCmds, OutputFilter,
MsgView, EnvironmentOpts, EditorOptions, IDEComp, FormEditor,
KeyMapping, IDEProcs, UnitEditor, Debugger, IDEOptionDefs, CodeToolsDefines;
const
@ -224,6 +224,9 @@ type
HintTimer1 : TTimer;
HintWindow1 : THintWindow;
protected
TheCompiler: TCompiler;
TheOutputFilter: TOutputFilter;
function CreateMenuSeparator : TMenuItem;
procedure SetupFileMenu; virtual;
procedure SetupEditMenu; virtual;
@ -252,6 +255,8 @@ type
function DoInitProjectRun: TModalResult; virtual; abstract;
function DoCheckFilesOnDisk: TModalResult; virtual; abstract;
function DoCheckAmbigiousSources(const AFilename: string;
Compiling: boolean): TModalResult;
end;
var
@ -907,5 +912,106 @@ begin
end;
end;
{-------------------------------------------------------------------------------
function TMainIDEBar.DoCheckAmbigiousSources(const AFilename: string
): TModalResult;
Checks if file exists with same name and similar extension. The compiler
prefers for example .pp to .pas files. So, if we save a .pas file delete .pp
file, so that compiling does what is expected.
-------------------------------------------------------------------------------}
function TMainIDEBar.DoCheckAmbigiousSources(const AFilename: string;
Compiling: boolean): TModalResult;
function DeleteAmbigiousFile(const AmbigiousFilename: string): TModalResult;
begin
if not DeleteFile(AmbigiousFilename) then begin
Result:=MessageDlg('Error deleting file',
'Unable to delete ambigious file "'+AmbigiousFilename+'"',
mtError,[mbOk,mbAbort],0);
end else
Result:=mrOk;
end;
function RenameAmbigiousFile(const AmbigiousFilename: string): TModalResult;
var
NewFilename: string;
begin
NewFilename:=AmbigiousFilename+'.ambigious';
if not RenameFile(AmbigiousFilename,NewFilename) then
begin
Result:=MessageDlg('Error renaming file',
'Unable to rename ambigious file "'+AmbigiousFilename+'"'#13
+'to "'+NewFilename+'"',
mtError,[mbOk,mbAbort],0);
end else
Result:=mrOk;
end;
function AddCompileWarning(const AmbigiousFilename: string): TModalResult;
begin
Result:=mrOk;
if Compiling then begin
TheOutputFilter.ReadLine('Warning: ambigious file found: "'+AmbigiousFilename+'"'
+'. Source file is: "'+AFilename+'"',true);
end;
end;
function CheckFile(const AmbigiousFilename: string): TModalResult;
begin
if not FileExists(AmbigiousFilename) then exit;
if Compiling then begin
Result:=AddCompileWarning(AmbigiousFilename);
exit;
end;
case EnvironmentOptions.AmbigiousFileAction of
afaAsk:
begin
Result:=MessageDlg('Ambigious file found',
'There is a file with the same name and a similar extension ond disk'#13
+'File: '+AFilename+#13
+'Ambigious File: '+AmbigiousFilename+#13
+#13
+'Delete ambigious file?',
mtWarning,[mbYes,mbIgnore,mbAbort],0);
case Result of
mrYes: Result:=DeleteAmbigiousFile(AmbigiousFilename);
mrIgnore: Result:=mrOk;
end;
end;
afaAutoDelete:
Result:=DeleteAmbigiousFile(AmbigiousFilename);
afaAutoRename:
Result:=RenameAmbigiousFile(AmbigiousFilename);
afaWarnOnCompile:
Result:=AddCompileWarning(AmbigiousFilename);
else
Result:=mrOk;
end;
end;
var
Ext, LowExt: string;
begin
Result:=mrOk;
if EnvironmentOptions.AmbigiousFileAction=afaIgnore then exit;
if (EnvironmentOptions.AmbigiousFileAction=afaWarnOnCompile)
and not Compiling then exit;
if FilenameIsPascalUnit(AFilename) then begin
Ext:=ExtractFileExt(AFilename);
LowExt:=lowercase(Ext);
if LowExt='.pp' then
Result:=CheckFile(ChangeFileExt(AFilename,'.pas'))
else if LowExt='.pas' then
Result:=CheckFile(ChangeFileExt(AFilename,'.pp'));
end;
end;
end.

View File

@ -106,14 +106,14 @@ type
procedure SetSource(ABuffer: TCodeBuffer);
procedure SetUnitName(const NewUnitName:string);
protected
NextUnitWithEditorIndex: TUnitInfo;
PrevUnitWithEditorIndex: TUnitInfo;
NextUnitWithForm: TUnitInfo;
PrevUnitWithForm: TUnitInfo;
NextLoadedUnit: TUnitInfo;
PrevLoadedUnit: TUnitInfo;
NextAutoRevertLockedUnit: TUnitInfo;
PrevAutoRevertLockedUnit: TUnitInfo;
fNextUnitWithEditorIndex: TUnitInfo;
fPrevUnitWithEditorIndex: TUnitInfo;
fNextUnitWithForm: TUnitInfo;
fPrevUnitWithForm: TUnitInfo;
fNextLoadedUnit: TUnitInfo;
fPrevLoadedUnit: TUnitInfo;
fNextAutoRevertLockedUnit: TUnitInfo;
fPrevAutoRevertLockedUnit: TUnitInfo;
procedure UpdateEditorIndexList;
procedure UpdateFormList;
procedure UpdateLoadedList;
@ -142,6 +142,16 @@ type
function NeedsSaveToDisk: boolean;
{ Properties }
public
property NextUnitWithEditorIndex: TUnitInfo read fNextUnitWithEditorIndex;
property PrevUnitWithEditorIndex: TUnitInfo read fPrevUnitWithEditorIndex;
property NextUnitWithForm: TUnitInfo read fNextUnitWithForm;
property PrevUnitWithForm: TUnitInfo read fPrevUnitWithForm;
property NextLoadedUnit: TUnitInfo read fNextLoadedUnit;
property PrevLoadedUnit: TUnitInfo read fPrevLoadedUnit;
property NextAutoRevertLockedUnit: TUnitInfo read fNextAutoRevertLockedUnit;
property PrevAutoRevertLockedUnit: TUnitInfo read fPrevAutoRevertLockedUnit;
public
property Breakpoints: TProjectBreakPointList
read fBreakpoints write fBreakpoints;
property CursorPos: TPoint read fCursorPos write fCursorPos;
@ -289,6 +299,11 @@ type
property Bookmarks: TProjectBookmarkList read fBookmarks write fBookmarks;
property CompilerOptions: TCompilerOptions
read fCompilerOptions write fCompilerOptions;
property FirstAutoRevertLockedUnit: TUnitInfo read fFirstAutoRevertLockedUnit;
property FirstLoadedUnit: TUnitInfo read fFirstLoadedUnit;
property FirstUnitWithEditorIndex: TUnitInfo read fFirstUnitWithEditorIndex;
property FirstUnitWithForm: TUnitInfo read fFirstUnitWithForm;
property Flags: TProjectFlags read FFlags write SetFlags;
property IconPath: String read fIconPath write fIconPath;
property JumpHistory: TProjectJumpHistory
@ -609,8 +624,8 @@ begin
if Project<>nil then begin
Project.AddToOrRemoveFromEditorWithIndexList(Self);
end else begin
NextUnitWithEditorIndex:=nil;
PrevUnitWithEditorIndex:=nil;
fNextUnitWithEditorIndex:=nil;
fPrevUnitWithEditorIndex:=nil;
end;
end;
@ -619,8 +634,8 @@ begin
if Project<>nil then begin
Project.AddToOrRemoveFromFormList(Self);
end else begin
NextUnitWithForm:=nil;
PrevUnitWithForm:=nil;
fNextUnitWithForm:=nil;
fPrevUnitWithForm:=nil;
end;
end;
@ -629,8 +644,8 @@ begin
if Project<>nil then begin
Project.AddToOrRemoveFromLoadedList(Self);
end else begin
NextLoadedUnit:=nil;
PrevLoadedUnit:=nil;
fNextLoadedUnit:=nil;
fPrevLoadedUnit:=nil;
end;
end;
@ -639,8 +654,8 @@ begin
if Project<>nil then begin
Project.AddToOrRemoveFromAutoRevertLockedList(Self);
end else begin
NextAutoRevertLockedUnit:=nil;
PrevAutoRevertLockedUnit:=nil;
fNextAutoRevertLockedUnit:=nil;
fPrevAutoRevertLockedUnit:=nil;
end;
end;
@ -1439,7 +1454,7 @@ function TProject.UnitWithEditorIndex(Index:integer):TUnitInfo;
begin
Result:=fFirstUnitWithEditorIndex;
while (Result<>nil) and (Result.EditorIndex<>Index) do begin
Result:=Result.NextUnitWithEditorIndex;
Result:=Result.fNextUnitWithEditorIndex;
end;
end;
@ -1521,7 +1536,7 @@ var i:integer;
begin
AnUnitInfo:=fFirstUnitWithEditorIndex;
while AnUnitInfo<>nil do begin
NextUnitInfo:=AnUnitInfo.NextUnitWithEditorIndex;
NextUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
if AnUnitInfo.EditorIndex=EditorIndex then
AnUnitInfo.EditorIndex:=-1
else if AnUnitInfo.EditorIndex>EditorIndex then
@ -1547,7 +1562,7 @@ begin
while AnUnitInfo<>nil do begin
if AnUnitInfo.EditorIndex>=EditorIndex then
AnUnitInfo.EditorIndex:=AnUnitInfo.EditorIndex+1;
AnUnitInfo:=AnUnitInfo.NextUnitWithEditorIndex;
AnUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
end;
i:=Bookmarks.Count-1;
while (i>=0) do begin
@ -1711,7 +1726,7 @@ begin
AnUnitList:=TList.Create;
AnUnitList.Add(AnUnitInfo);
end;
AnUnitInfo:=AnUnitInfo.NextAutoRevertLockedUnit;
AnUnitInfo:=AnUnitInfo.fNextAutoRevertLockedUnit;
end;
end;
@ -1760,7 +1775,7 @@ Function TProject.UnitWithForm(AForm : TComponent) : TUnitInfo;
begin
Result:=fFirstUnitWithForm;
while (Result<>nil) and (Result.Form<>AForm) do
Result:=Result.NextUnitWithForm;
Result:=Result.fNextUnitWithForm;
end;
function TProject.IndexOfFilename(const AFilename: string): integer;
@ -1782,13 +1797,13 @@ procedure TProject.AddToEditorWithIndexList(AnUnitInfo: TUnitInfo);
begin
// add to list if AnUnitInfo is not in list
if (fFirstUnitWithEditorIndex<>AnUnitInfo)
and (AnUnitInfo.NextUnitWithEditorIndex=nil)
and (AnUnitInfo.PrevUnitWithEditorIndex=nil) then begin
AnUnitInfo.NextUnitWithEditorIndex:=fFirstUnitWithEditorIndex;
AnUnitInfo.PrevUnitWithEditorIndex:=nil;
and (AnUnitInfo.fNextUnitWithEditorIndex=nil)
and (AnUnitInfo.fPrevUnitWithEditorIndex=nil) then begin
AnUnitInfo.fNextUnitWithEditorIndex:=fFirstUnitWithEditorIndex;
AnUnitInfo.fPrevUnitWithEditorIndex:=nil;
fFirstUnitWithEditorIndex:=AnUnitInfo;
if AnUnitInfo.NextUnitWithEditorIndex<>nil then
AnUnitInfo.NextUnitWithEditorIndex.PrevUnitWithEditorIndex:=AnUnitInfo;
if AnUnitInfo.fNextUnitWithEditorIndex<>nil then
AnUnitInfo.fNextUnitWithEditorIndex.fPrevUnitWithEditorIndex:=AnUnitInfo;
end;
end;
@ -1796,28 +1811,28 @@ procedure TProject.RemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo);
begin
// remove from list if AnUnitInfo is in list
if fFirstUnitWithEditorIndex=AnUnitInfo then
fFirstUnitWithEditorIndex:=AnUnitInfo.NextUnitWithEditorIndex;
if AnUnitInfo.NextUnitWithEditorIndex<>nil then
AnUnitInfo.NextUnitWithEditorIndex.PrevUnitWithEditorIndex:=
AnUnitInfo.PrevUnitWithEditorIndex;
if AnUnitInfo.PrevUnitWithEditorIndex<>nil then
AnUnitInfo.PrevUnitWithEditorIndex.NextUnitWithEditorIndex:=
AnUnitInfo.NextUnitWithEditorIndex;
AnUnitInfo.NextUnitWithEditorIndex:=nil;
AnUnitInfo.PrevUnitWithEditorIndex:=nil;
fFirstUnitWithEditorIndex:=AnUnitInfo.fNextUnitWithEditorIndex;
if AnUnitInfo.fNextUnitWithEditorIndex<>nil then
AnUnitInfo.fNextUnitWithEditorIndex.fPrevUnitWithEditorIndex:=
AnUnitInfo.fPrevUnitWithEditorIndex;
if AnUnitInfo.fPrevUnitWithEditorIndex<>nil then
AnUnitInfo.fPrevUnitWithEditorIndex.fNextUnitWithEditorIndex:=
AnUnitInfo.fNextUnitWithEditorIndex;
AnUnitInfo.fNextUnitWithEditorIndex:=nil;
AnUnitInfo.fPrevUnitWithEditorIndex:=nil;
end;
procedure TProject.AddToFormList(AnUnitInfo: TUnitInfo);
begin
// add to list if AnUnitInfo is not in list
if (fFirstUnitWithForm<>AnUnitInfo)
and (AnUnitInfo.NextUnitWithForm=nil)
and (AnUnitInfo.PrevUnitWithForm=nil) then begin
AnUnitInfo.NextUnitWithForm:=fFirstUnitWithForm;
AnUnitInfo.PrevUnitWithForm:=nil;
and (AnUnitInfo.fNextUnitWithForm=nil)
and (AnUnitInfo.fPrevUnitWithForm=nil) then begin
AnUnitInfo.fNextUnitWithForm:=fFirstUnitWithForm;
AnUnitInfo.fPrevUnitWithForm:=nil;
fFirstUnitWithForm:=AnUnitInfo;
if AnUnitInfo.NextUnitWithForm<>nil then
AnUnitInfo.NextUnitWithForm.PrevUnitWithForm:=AnUnitInfo;
if AnUnitInfo.fNextUnitWithForm<>nil then
AnUnitInfo.fNextUnitWithForm.fPrevUnitWithForm:=AnUnitInfo;
end;
end;
@ -1825,28 +1840,28 @@ procedure TProject.RemoveFromFormList(AnUnitInfo: TUnitInfo);
begin
// remove from list if AnUnitInfo is in list
if fFirstUnitWithForm=AnUnitInfo then
fFirstUnitWithForm:=AnUnitInfo.NextUnitWithForm;
if AnUnitInfo.NextUnitWithForm<>nil then
AnUnitInfo.NextUnitWithForm.PrevUnitWithForm:=
AnUnitInfo.PrevUnitWithForm;
if AnUnitInfo.PrevUnitWithForm<>nil then
AnUnitInfo.PrevUnitWithForm.NextUnitWithForm:=
AnUnitInfo.NextUnitWithForm;
AnUnitInfo.NextUnitWithForm:=nil;
AnUnitInfo.PrevUnitWithForm:=nil;
fFirstUnitWithForm:=AnUnitInfo.fNextUnitWithForm;
if AnUnitInfo.fNextUnitWithForm<>nil then
AnUnitInfo.fNextUnitWithForm.fPrevUnitWithForm:=
AnUnitInfo.fPrevUnitWithForm;
if AnUnitInfo.fPrevUnitWithForm<>nil then
AnUnitInfo.fPrevUnitWithForm.fNextUnitWithForm:=
AnUnitInfo.fNextUnitWithForm;
AnUnitInfo.fNextUnitWithForm:=nil;
AnUnitInfo.fPrevUnitWithForm:=nil;
end;
procedure TProject.AddToLoadedList(AnUnitInfo: TUnitInfo);
begin
// add to list if AnUnitInfo is not in list
if (fFirstLoadedUnit<>AnUnitInfo)
and (AnUnitInfo.NextLoadedUnit=nil)
and (AnUnitInfo.PrevLoadedUnit=nil) then begin
AnUnitInfo.NextLoadedUnit:=fFirstLoadedUnit;
AnUnitInfo.PrevLoadedUnit:=nil;
and (AnUnitInfo.fNextLoadedUnit=nil)
and (AnUnitInfo.fPrevLoadedUnit=nil) then begin
AnUnitInfo.fNextLoadedUnit:=fFirstLoadedUnit;
AnUnitInfo.fPrevLoadedUnit:=nil;
fFirstLoadedUnit:=AnUnitInfo;
if AnUnitInfo.NextLoadedUnit<>nil then
AnUnitInfo.NextLoadedUnit.PrevLoadedUnit:=AnUnitInfo;
if AnUnitInfo.fNextLoadedUnit<>nil then
AnUnitInfo.fNextLoadedUnit.fPrevLoadedUnit:=AnUnitInfo;
end;
end;
@ -1854,28 +1869,28 @@ procedure TProject.RemoveFromLoadedList(AnUnitInfo: TUnitInfo);
begin
// remove from list if AnUnitInfo is in list
if fFirstLoadedUnit=AnUnitInfo then
fFirstLoadedUnit:=AnUnitInfo.NextUnitWithForm;
if AnUnitInfo.NextLoadedUnit<>nil then
AnUnitInfo.NextLoadedUnit.PrevLoadedUnit:=
AnUnitInfo.PrevLoadedUnit;
if AnUnitInfo.PrevLoadedUnit<>nil then
AnUnitInfo.PrevLoadedUnit.NextLoadedUnit:=
AnUnitInfo.NextLoadedUnit;
AnUnitInfo.NextLoadedUnit:=nil;
AnUnitInfo.PrevLoadedUnit:=nil;
fFirstLoadedUnit:=AnUnitInfo.fNextUnitWithForm;
if AnUnitInfo.fNextLoadedUnit<>nil then
AnUnitInfo.fNextLoadedUnit.fPrevLoadedUnit:=
AnUnitInfo.fPrevLoadedUnit;
if AnUnitInfo.fPrevLoadedUnit<>nil then
AnUnitInfo.fPrevLoadedUnit.fNextLoadedUnit:=
AnUnitInfo.fNextLoadedUnit;
AnUnitInfo.fNextLoadedUnit:=nil;
AnUnitInfo.fPrevLoadedUnit:=nil;
end;
procedure TProject.AddToAutoRevertLockedList(AnUnitInfo: TUnitInfo);
begin
// add to list if AnUnitInfo is not in list
if (fFirstAutoRevertLockedUnit<>AnUnitInfo)
and (AnUnitInfo.NextAutoRevertLockedUnit=nil)
and (AnUnitInfo.PrevAutoRevertLockedUnit=nil) then begin
AnUnitInfo.NextAutoRevertLockedUnit:=fFirstAutoRevertLockedUnit;
AnUnitInfo.PrevAutoRevertLockedUnit:=nil;
and (AnUnitInfo.fNextAutoRevertLockedUnit=nil)
and (AnUnitInfo.fPrevAutoRevertLockedUnit=nil) then begin
AnUnitInfo.fNextAutoRevertLockedUnit:=fFirstAutoRevertLockedUnit;
AnUnitInfo.fPrevAutoRevertLockedUnit:=nil;
fFirstAutoRevertLockedUnit:=AnUnitInfo;
if AnUnitInfo.NextAutoRevertLockedUnit<>nil then
AnUnitInfo.NextAutoRevertLockedUnit.PrevAutoRevertLockedUnit:=AnUnitInfo;
if AnUnitInfo.fNextAutoRevertLockedUnit<>nil then
AnUnitInfo.fNextAutoRevertLockedUnit.fPrevAutoRevertLockedUnit:=AnUnitInfo;
end;
end;
@ -1883,15 +1898,15 @@ procedure TProject.RemoveFromAutoRevertLockedList(AnUnitInfo: TUnitInfo);
begin
// remove from list if AnUnitInfo is in list
if fFirstAutoRevertLockedUnit=AnUnitInfo then
fFirstAutoRevertLockedUnit:=AnUnitInfo.NextAutoRevertLockedUnit;
if AnUnitInfo.NextAutoRevertLockedUnit<>nil then
AnUnitInfo.NextAutoRevertLockedUnit.PrevAutoRevertLockedUnit:=
AnUnitInfo.PrevAutoRevertLockedUnit;
if AnUnitInfo.PrevAutoRevertLockedUnit<>nil then
AnUnitInfo.PrevAutoRevertLockedUnit.NextAutoRevertLockedUnit:=
AnUnitInfo.NextAutoRevertLockedUnit;
AnUnitInfo.NextAutoRevertLockedUnit:=nil;
AnUnitInfo.PrevAutoRevertLockedUnit:=nil;
fFirstAutoRevertLockedUnit:=AnUnitInfo.fNextAutoRevertLockedUnit;
if AnUnitInfo.fNextAutoRevertLockedUnit<>nil then
AnUnitInfo.fNextAutoRevertLockedUnit.fPrevAutoRevertLockedUnit:=
AnUnitInfo.fPrevAutoRevertLockedUnit;
if AnUnitInfo.fPrevAutoRevertLockedUnit<>nil then
AnUnitInfo.fPrevAutoRevertLockedUnit.fNextAutoRevertLockedUnit:=
AnUnitInfo.fNextAutoRevertLockedUnit;
AnUnitInfo.fNextAutoRevertLockedUnit:=nil;
AnUnitInfo.fPrevAutoRevertLockedUnit:=nil;
end;
@ -1901,6 +1916,9 @@ end.
{
$Log$
Revision 1.74 2002/09/05 19:03:36 lazarus
MG: improved handling of ambigious source files
Revision 1.73 2002/08/23 07:05:15 lazarus
MG: started form renaming