mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 04:49:40 +02: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
|
||||
uifLoadedDesigner, // has a visible designer, needed to restore open designers
|
||||
uifLoadingComponent,
|
||||
uifMarked,
|
||||
uifMarked, // Can be used as a temporary flag for anything.
|
||||
uifModified,
|
||||
uifRunFileIfActive,
|
||||
uifSessionModified,
|
||||
@ -324,6 +324,7 @@ type
|
||||
function GetLoaded: Boolean;
|
||||
function GetLoadedDesigner: Boolean;
|
||||
function GetLoadingComponent: boolean;
|
||||
function GetMarked: boolean;
|
||||
function GetModified: boolean;
|
||||
function GetNextAutoRevertLockedUnit: TUnitInfo;
|
||||
function GetNextLoadedUnit: TUnitInfo;
|
||||
@ -353,6 +354,7 @@ type
|
||||
procedure SetLoaded(const AValue: Boolean);
|
||||
procedure SetLoadedDesigner(const AValue: Boolean);
|
||||
procedure SetLoadingComponent(AValue: boolean);
|
||||
procedure SetMarked(AValue: boolean);
|
||||
procedure SetModified(const AValue: boolean);
|
||||
procedure SetProject(const AValue: TProject);
|
||||
procedure SetRunFileIfActive(const AValue: boolean);
|
||||
@ -492,6 +494,7 @@ type
|
||||
property Loaded: Boolean read GetLoaded write SetLoaded;
|
||||
property LoadedDesigner: Boolean read GetLoadedDesigner write SetLoadedDesigner;
|
||||
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 SessionModified: boolean read GetSessionModified write SetSessionModified;
|
||||
property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup;
|
||||
@ -2548,6 +2551,11 @@ begin
|
||||
Result:=uifHasErrorInLFM in FFlags;
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetMarked: boolean;
|
||||
begin
|
||||
Result:=uifMarked in FFlags;
|
||||
end;
|
||||
|
||||
function TUnitInfo.GetModified: boolean;
|
||||
begin
|
||||
Result:=(uifModified in FFlags)
|
||||
@ -2805,6 +2813,14 @@ begin
|
||||
Exclude(FFlags, uifLoadingComponent);
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.SetMarked(AValue: boolean);
|
||||
begin
|
||||
if AValue then
|
||||
Include(FFlags, uifMarked)
|
||||
else
|
||||
Exclude(FFlags, uifMarked);
|
||||
end;
|
||||
|
||||
procedure TUnitInfo.SetModified(const AValue: boolean);
|
||||
begin
|
||||
if Modified=AValue then exit;
|
||||
|
@ -1807,15 +1807,14 @@ begin
|
||||
exit(mrOK);
|
||||
end;
|
||||
// commit changes from source editor to codetools
|
||||
SaveEditorChangesToCodeCache(nil);
|
||||
Project1.BeginUpdate(true);
|
||||
//SaveEditorChangesToCodeCache(nil);
|
||||
//Project1.BeginUpdate(true);
|
||||
try
|
||||
Result:=ActionForFiles;
|
||||
finally
|
||||
// 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;
|
||||
Project1.EndUpdate;
|
||||
//CodeToolBoss.SourceCache.ClearAllSourceLogEntries;
|
||||
//Project1.EndUpdate;
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -1932,17 +1931,18 @@ var
|
||||
AnUnitInfo: TUnitInfo;
|
||||
begin
|
||||
Assert(fUnitInfos.Count > 0, 'TRemoveFilesSelector.ActionForFiles: No files');
|
||||
Result:=mrOK;
|
||||
Result:=SaveProject([sfDoNotSaveVirtualFiles,sfCanAbort]);
|
||||
for i:=0 to fUnitInfos.Count-1 do
|
||||
begin
|
||||
AnUnitInfo:=TUnitInfo(fUnitInfos[i]);
|
||||
Assert(AnUnitInfo.IsPartOfProject, 'TRenameFilesSelector.ActionForFiles: '
|
||||
+ AnUnitInfo.Unit_Name + ' is not part of project');
|
||||
// Marked here means to remove old files silently.
|
||||
AnUnitInfo.Marked:=True;
|
||||
Result:=RenameUnitLowerCase(AnUnitInfo, false);
|
||||
AnUnitInfo.Marked:=False;
|
||||
if Result<>mrOK then exit;
|
||||
end;
|
||||
if Result=mrOK then
|
||||
Result:=SaveProject([sfDoNotSaveVirtualFiles,sfCanAbort]);
|
||||
end;
|
||||
|
||||
// ---
|
||||
@ -5769,7 +5769,7 @@ var
|
||||
AmbiguousFiles: TStringList;
|
||||
i: Integer;
|
||||
DirRelation: TSPFileMaskRelation;
|
||||
OldFileRemoved: Boolean;
|
||||
OldFileRemoved, Silence: Boolean;
|
||||
ConvTool: TConvDelphiCodeTool;
|
||||
AEditor: TSourceEditor;
|
||||
begin
|
||||
@ -5938,6 +5938,7 @@ begin
|
||||
|
||||
// delete ambiguous files
|
||||
OldFileRemoved:=false;
|
||||
Silence:=false;
|
||||
AmbiguousFiles:=FindFilesCaseInsensitive(NewFilePath,ExtractFilename(NewFilename),true);
|
||||
if AmbiguousFiles<>nil then begin
|
||||
try
|
||||
@ -5947,11 +5948,17 @@ begin
|
||||
then begin
|
||||
S:=Format(lisDeleteOldFile, [ExtractFilename(OldFilename)]);
|
||||
OldFileRemoved:=true;
|
||||
// Marked here means to remove an old file silently.
|
||||
if AnUnitInfo.Marked then
|
||||
Silence:=true;
|
||||
end
|
||||
else
|
||||
S:=Format(lisThereAreOtherFilesInTheDirectoryWithTheSameName,
|
||||
[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=mrYes then begin
|
||||
NewFilePath:=AppendPathDelim(ExtractFilePath(NewFilename));
|
||||
|
Loading…
Reference in New Issue
Block a user