Move 2 functions from DialogProcs to SourceFileManager.

This commit is contained in:
Juha 2024-04-15 13:53:13 +03:00
parent f3d1f63432
commit 9297d3f760
2 changed files with 35 additions and 37 deletions

View File

@ -43,10 +43,8 @@ uses
FileUtil, LazFileUtils, LazFileCache, Laz2_XMLCfg, LazLoggerBase,
// CodeTools
CodeToolsConfig, CodeCache, CodeToolManager,
// IdeIntf
LazIDEIntf, IDEDialogs,
// IDE
IdeUtilsPkgStrConsts;
// IdeUtils
IDEDialogs, IdeUtilsPkgStrConsts;
type
// load buffer flags
@ -116,9 +114,6 @@ function SaveLazStringToFile(const Filename, Content: string;
): TModalResult;
function ConvertLFMToLRSFileInteractive(const LFMFilename,
LRSFilename: string; ShowAbort: boolean): TModalResult;
function IfNotOkJumpToCodetoolErrorAndAskToAbort(Ok: boolean;
Ask: boolean; out NewResult: TModalResult): boolean;
function JumpToCodetoolErrorAndAskToAbort(Ask: boolean): TModalResult;
procedure NotImplementedDialog(const Feature: string);
function SimpleDirectoryCheck(const OldDir, NewDir,
@ -692,36 +687,6 @@ begin
end;
end;
function IfNotOkJumpToCodetoolErrorAndAskToAbort(Ok: boolean;
Ask: boolean; out NewResult: TModalResult): boolean;
begin
if Ok then begin
NewResult:=mrOk;
Result:=true;
end else begin
NewResult:=JumpToCodetoolErrorAndAskToAbort(Ask);
Result:=NewResult<>mrAbort;
end;
end;
function JumpToCodetoolErrorAndAskToAbort(Ask: boolean): TModalResult;
// returns mrCancel or mrAbort
var
ErrMsg: String;
begin
ErrMsg:=CodeToolBoss.ErrorMessage;
LazarusIDE.DoJumpToCodeToolBossError;
if Ask then begin
Result:=IDEQuestionDialog(lisCCOErrorCaption,
Format(lisTheCodetoolsFoundAnError, [LineEnding, ErrMsg]),
mtWarning, [mrIgnore, lisIgnoreAndContinue,
mrAbort]);
if Result=mrIgnore then Result:=mrCancel;
end else begin
Result:=mrCancel;
end;
end;
procedure NotImplementedDialog(const Feature: string);
begin
IDEMessageDialog(lisNotImplemented,

View File

@ -220,6 +220,9 @@ function SaveEditorFile(const Filename: string; Flags: TSaveFlags): TModalResult
function CloseEditorFile(AEditor: TSourceEditorInterface; Flags: TCloseFlags):TModalResult;
function CloseEditorFile(const Filename: string; Flags: TCloseFlags): TModalResult;
// interactive unit selection
//function IfNotOkJumpToCodetoolErrorAndAskToAbort(Ok: boolean;
// Ask: boolean; out NewResult: TModalResult): boolean;
function JumpToCodetoolErrorAndAskToAbort(Ask: boolean): TModalResult;
function SelectProjectItems(ItemList: TViewUnitEntries; ItemType: TIDEProjectItem): TModalResult;
function SelectUnitComponents(DlgCaption: string; ItemType: TIDEProjectItem;
Files: TStringList): TModalResult;
@ -3410,6 +3413,36 @@ begin
Files.Free;
end;
end;
{
function IfNotOkJumpToCodetoolErrorAndAskToAbort(Ok: boolean;
Ask: boolean; out NewResult: TModalResult): boolean;
begin
if Ok then begin
NewResult:=mrOk;
Result:=true;
end else begin
NewResult:=JumpToCodetoolErrorAndAskToAbort(Ask);
Result:=NewResult<>mrAbort;
end;
end;
}
function JumpToCodetoolErrorAndAskToAbort(Ask: boolean): TModalResult;
// returns mrCancel or mrAbort
var
ErrMsg: String;
begin
ErrMsg:=CodeToolBoss.ErrorMessage;
LazarusIDE.DoJumpToCodeToolBossError;
if Ask then begin
Result:=IDEQuestionDialog(lisCCOErrorCaption,
Format(lisTheCodetoolsFoundAnError, [LineEnding, ErrMsg]),
mtWarning, [mrIgnore, lisIgnoreAndContinue,
mrAbort]);
if Result=mrIgnore then Result:=mrCancel;
end else begin
Result:=mrCancel;
end;
end;
function SelectProjectItems(ItemList: TViewUnitEntries; ItemType: TIDEProjectItem): TModalResult;
var