mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 12:20:37 +01:00
IDE: Make renaming project files to lowercase silent. No questions asked. Issue #10370.
This commit is contained in:
parent
3aaa732045
commit
0b023f20d7
@ -181,7 +181,7 @@ type
|
|||||||
uifLoaded, // loaded in the source editor, needed to restore open files
|
uifLoaded, // loaded in the source editor, needed to restore open files
|
||||||
uifLoadedDesigner, // has a visible designer, needed to restore open designers
|
uifLoadedDesigner, // has a visible designer, needed to restore open designers
|
||||||
uifLoadingComponent,
|
uifLoadingComponent,
|
||||||
uifMarked,
|
uifMarked, // Can be used as a temporary flag for anything.
|
||||||
uifModified,
|
uifModified,
|
||||||
uifRunFileIfActive,
|
uifRunFileIfActive,
|
||||||
uifSessionModified,
|
uifSessionModified,
|
||||||
@ -324,6 +324,7 @@ type
|
|||||||
function GetLoaded: Boolean;
|
function GetLoaded: Boolean;
|
||||||
function GetLoadedDesigner: Boolean;
|
function GetLoadedDesigner: Boolean;
|
||||||
function GetLoadingComponent: boolean;
|
function GetLoadingComponent: boolean;
|
||||||
|
function GetMarked: boolean;
|
||||||
function GetModified: boolean;
|
function GetModified: boolean;
|
||||||
function GetNextAutoRevertLockedUnit: TUnitInfo;
|
function GetNextAutoRevertLockedUnit: TUnitInfo;
|
||||||
function GetNextLoadedUnit: TUnitInfo;
|
function GetNextLoadedUnit: TUnitInfo;
|
||||||
@ -353,6 +354,7 @@ type
|
|||||||
procedure SetLoaded(const AValue: Boolean);
|
procedure SetLoaded(const AValue: Boolean);
|
||||||
procedure SetLoadedDesigner(const AValue: Boolean);
|
procedure SetLoadedDesigner(const AValue: Boolean);
|
||||||
procedure SetLoadingComponent(AValue: boolean);
|
procedure SetLoadingComponent(AValue: boolean);
|
||||||
|
procedure SetMarked(AValue: boolean);
|
||||||
procedure SetModified(const AValue: boolean);
|
procedure SetModified(const AValue: boolean);
|
||||||
procedure SetProject(const AValue: TProject);
|
procedure SetProject(const AValue: TProject);
|
||||||
procedure SetRunFileIfActive(const AValue: boolean);
|
procedure SetRunFileIfActive(const AValue: boolean);
|
||||||
@ -492,6 +494,7 @@ type
|
|||||||
property Loaded: Boolean read GetLoaded write SetLoaded;
|
property Loaded: Boolean read GetLoaded write SetLoaded;
|
||||||
property LoadedDesigner: Boolean read GetLoadedDesigner write SetLoadedDesigner;
|
property LoadedDesigner: Boolean read GetLoadedDesigner write SetLoadedDesigner;
|
||||||
property LoadingComponent: boolean read GetLoadingComponent write SetLoadingComponent;
|
property LoadingComponent: boolean read GetLoadingComponent write SetLoadingComponent;
|
||||||
|
property Marked: boolean read GetMarked write SetMarked;
|
||||||
property Modified: boolean read GetModified write SetModified;// not Session data
|
property Modified: boolean read GetModified write SetModified;// not Session data
|
||||||
property SessionModified: boolean read GetSessionModified write SetSessionModified;
|
property SessionModified: boolean read GetSessionModified write SetSessionModified;
|
||||||
property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup;
|
property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup;
|
||||||
@ -2548,6 +2551,11 @@ begin
|
|||||||
Result:=uifHasErrorInLFM in FFlags;
|
Result:=uifHasErrorInLFM in FFlags;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TUnitInfo.GetMarked: boolean;
|
||||||
|
begin
|
||||||
|
Result:=uifMarked in FFlags;
|
||||||
|
end;
|
||||||
|
|
||||||
function TUnitInfo.GetModified: boolean;
|
function TUnitInfo.GetModified: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(uifModified in FFlags)
|
Result:=(uifModified in FFlags)
|
||||||
@ -2805,6 +2813,14 @@ begin
|
|||||||
Exclude(FFlags, uifLoadingComponent);
|
Exclude(FFlags, uifLoadingComponent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TUnitInfo.SetMarked(AValue: boolean);
|
||||||
|
begin
|
||||||
|
if AValue then
|
||||||
|
Include(FFlags, uifMarked)
|
||||||
|
else
|
||||||
|
Exclude(FFlags, uifMarked);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TUnitInfo.SetModified(const AValue: boolean);
|
procedure TUnitInfo.SetModified(const AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if Modified=AValue then exit;
|
if Modified=AValue then exit;
|
||||||
|
|||||||
@ -1807,15 +1807,14 @@ begin
|
|||||||
exit(mrOK);
|
exit(mrOK);
|
||||||
end;
|
end;
|
||||||
// commit changes from source editor to codetools
|
// commit changes from source editor to codetools
|
||||||
SaveEditorChangesToCodeCache(nil);
|
//SaveEditorChangesToCodeCache(nil);
|
||||||
Project1.BeginUpdate(true);
|
//Project1.BeginUpdate(true);
|
||||||
try
|
try
|
||||||
Result:=ActionForFiles;
|
Result:=ActionForFiles;
|
||||||
finally
|
finally
|
||||||
// all changes were handled automatically by events, just clear the logs
|
// all changes were handled automatically by events, just clear the logs
|
||||||
Assert(Assigned(fUnitInfos) and (fUnitInfos.Count>0), 'TProjectUnitFileSelector.Run: No units');
|
//CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
||||||
CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
//Project1.EndUpdate;
|
||||||
Project1.EndUpdate;
|
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -1932,17 +1931,18 @@ var
|
|||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
Assert(fUnitInfos.Count > 0, 'TRemoveFilesSelector.ActionForFiles: No files');
|
Assert(fUnitInfos.Count > 0, 'TRemoveFilesSelector.ActionForFiles: No files');
|
||||||
Result:=mrOK;
|
Result:=SaveProject([sfDoNotSaveVirtualFiles,sfCanAbort]);
|
||||||
for i:=0 to fUnitInfos.Count-1 do
|
for i:=0 to fUnitInfos.Count-1 do
|
||||||
begin
|
begin
|
||||||
AnUnitInfo:=TUnitInfo(fUnitInfos[i]);
|
AnUnitInfo:=TUnitInfo(fUnitInfos[i]);
|
||||||
Assert(AnUnitInfo.IsPartOfProject, 'TRenameFilesSelector.ActionForFiles: '
|
Assert(AnUnitInfo.IsPartOfProject, 'TRenameFilesSelector.ActionForFiles: '
|
||||||
+ AnUnitInfo.Unit_Name + ' is not part of project');
|
+ AnUnitInfo.Unit_Name + ' is not part of project');
|
||||||
|
// Marked here means to remove old files silently.
|
||||||
|
AnUnitInfo.Marked:=True;
|
||||||
Result:=RenameUnitLowerCase(AnUnitInfo, false);
|
Result:=RenameUnitLowerCase(AnUnitInfo, false);
|
||||||
|
AnUnitInfo.Marked:=False;
|
||||||
if Result<>mrOK then exit;
|
if Result<>mrOK then exit;
|
||||||
end;
|
end;
|
||||||
if Result=mrOK then
|
|
||||||
Result:=SaveProject([sfDoNotSaveVirtualFiles,sfCanAbort]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
@ -5769,7 +5769,7 @@ var
|
|||||||
AmbiguousFiles: TStringList;
|
AmbiguousFiles: TStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
DirRelation: TSPFileMaskRelation;
|
DirRelation: TSPFileMaskRelation;
|
||||||
OldFileRemoved: Boolean;
|
OldFileRemoved, Silence: Boolean;
|
||||||
ConvTool: TConvDelphiCodeTool;
|
ConvTool: TConvDelphiCodeTool;
|
||||||
AEditor: TSourceEditor;
|
AEditor: TSourceEditor;
|
||||||
begin
|
begin
|
||||||
@ -5938,6 +5938,7 @@ begin
|
|||||||
|
|
||||||
// delete ambiguous files
|
// delete ambiguous files
|
||||||
OldFileRemoved:=false;
|
OldFileRemoved:=false;
|
||||||
|
Silence:=false;
|
||||||
AmbiguousFiles:=FindFilesCaseInsensitive(NewFilePath,ExtractFilename(NewFilename),true);
|
AmbiguousFiles:=FindFilesCaseInsensitive(NewFilePath,ExtractFilename(NewFilename),true);
|
||||||
if AmbiguousFiles<>nil then begin
|
if AmbiguousFiles<>nil then begin
|
||||||
try
|
try
|
||||||
@ -5947,11 +5948,17 @@ begin
|
|||||||
then begin
|
then begin
|
||||||
S:=Format(lisDeleteOldFile, [ExtractFilename(OldFilename)]);
|
S:=Format(lisDeleteOldFile, [ExtractFilename(OldFilename)]);
|
||||||
OldFileRemoved:=true;
|
OldFileRemoved:=true;
|
||||||
|
// Marked here means to remove an old file silently.
|
||||||
|
if AnUnitInfo.Marked then
|
||||||
|
Silence:=true;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
S:=Format(lisThereAreOtherFilesInTheDirectoryWithTheSameName,
|
S:=Format(lisThereAreOtherFilesInTheDirectoryWithTheSameName,
|
||||||
[LineEnding, LineEnding, AmbiguousFiles.Text, LineEnding]);
|
[LineEnding, LineEnding, AmbiguousFiles.Text, LineEnding]);
|
||||||
Result:=IDEMessageDialog(lisAmbiguousFileFound,S,mtWarning,[mbYes,mbNo,mbAbort]);
|
if Silence then
|
||||||
|
Result:=mrYes
|
||||||
|
else
|
||||||
|
Result:=IDEMessageDialog(lisAmbiguousFileFound,S,mtWarning,[mbYes,mbNo,mbAbort]);
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
if Result=mrYes then begin
|
if Result=mrYes then begin
|
||||||
NewFilePath:=AppendPathDelim(ExtractFilePath(NewFilename));
|
NewFilePath:=AppendPathDelim(ExtractFilePath(NewFilename));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user