mirror of https://gitlab.com/basile.b/dexed.git
replace okCancel dialogs by YesNo dialogs
This commit is contained in:
parent
87bffb06fc
commit
dfc479617c
|
@ -11,22 +11,27 @@ uses
|
|||
(**
|
||||
* Ok/Cancel modal dialog
|
||||
*)
|
||||
function dlgOkCancel(const aMsg: string): TModalResult;
|
||||
function dlgOkCancel(const message: string): TModalResult;
|
||||
|
||||
(**
|
||||
* Yes/No modal dialog
|
||||
*)
|
||||
function dlgYesNo(const message: string): TModalResult;
|
||||
|
||||
(**
|
||||
* Info message
|
||||
*)
|
||||
function dlgOkInfo(const aMsg: string): TModalResult;
|
||||
function dlgOkInfo(const message: string): TModalResult;
|
||||
|
||||
(**
|
||||
* Error message
|
||||
*)
|
||||
function dlgOkError(const aMsg: string): TModalResult;
|
||||
function dlgOkError(const message: string): TModalResult;
|
||||
|
||||
(**
|
||||
* close aFilename Ok/Cancel.
|
||||
*)
|
||||
function dlgFileChangeClose(const aFilename: string): TModalResult;
|
||||
function dlgFileChangeClose(const fname: string): TModalResult;
|
||||
|
||||
const
|
||||
DdiagFilter = 'D source|*.d|D interface|*.di|All files|*.*';
|
||||
|
@ -34,32 +39,39 @@ const
|
|||
implementation
|
||||
|
||||
|
||||
function dlgOkCancel(const aMsg: string): TModalResult;
|
||||
function dlgOkCancel(const message: string): TModalResult;
|
||||
const
|
||||
Btns = [mbOK,mbCancel];
|
||||
begin
|
||||
exit( MessageDlg('Coedit', aMsg, mtConfirmation, Btns, ''));
|
||||
exit( MessageDlg('Coedit', message, mtConfirmation, Btns, ''));
|
||||
end;
|
||||
|
||||
function dlgOkInfo(const aMsg: string): TModalResult;
|
||||
function dlgYesNo(const message: string): TModalResult;
|
||||
const
|
||||
Btns = [mbYes,mbNo];
|
||||
begin
|
||||
exit( MessageDlg('Coedit', message, mtConfirmation, Btns, ''));
|
||||
end;
|
||||
|
||||
function dlgOkInfo(const message: string): TModalResult;
|
||||
const
|
||||
Btns = [mbOK];
|
||||
begin
|
||||
exit( MessageDlg('Coedit', aMsg, mtInformation, Btns, ''));
|
||||
exit( MessageDlg('Coedit', message, mtInformation, Btns, ''));
|
||||
end;
|
||||
|
||||
function dlgOkError(const aMsg: string): TModalResult;
|
||||
function dlgOkError(const message: string): TModalResult;
|
||||
const
|
||||
Btns = [mbOK];
|
||||
begin
|
||||
exit( MessageDlg('Coedit', aMsg, mtError, Btns, ''));
|
||||
exit( MessageDlg('Coedit', message, mtError, Btns, ''));
|
||||
end;
|
||||
|
||||
function dlgFileChangeClose(const aFilename: string): TModalResult;
|
||||
function dlgFileChangeClose(const fname: string): TModalResult;
|
||||
const
|
||||
fmt = '"%s" latest modifications are not saved.'#13#10#13#10'Close it without saving ?';
|
||||
begin
|
||||
exit(dlgOkCancel(format(fmt, [aFilename])));
|
||||
exit(dlgOkCancel(format(fmt, [fname])));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -1471,7 +1471,7 @@ begin
|
|||
if fRunProjAfterCompile and assigned(fProjectInterface) then
|
||||
begin
|
||||
if not success then
|
||||
runprev := dlgOkCancel('last build failed, continue and run ?') = mrOK;
|
||||
runprev := dlgYesNo('last build failed, continue and run ?') = mrYes;
|
||||
if runprev then
|
||||
begin
|
||||
if fRunProjAfterCompArg and
|
||||
|
@ -2192,7 +2192,7 @@ var
|
|||
exist: boolean = false;
|
||||
const
|
||||
messg: string = 'Either the runnable does not exist or it is older than its source.' +
|
||||
LineEnding + ' Do you wish to recompile it ?';
|
||||
LineEnding + 'Do you wish to recompile it ?';
|
||||
begin
|
||||
if fDoc.isNil then
|
||||
exit;
|
||||
|
@ -2205,7 +2205,7 @@ begin
|
|||
end;
|
||||
if (not exist) or (older) then
|
||||
begin
|
||||
if dlgOkCancel(messg) = mrOK then
|
||||
if dlgYesNo(messg) = mrYes then
|
||||
compileRunnable
|
||||
else if not exist then
|
||||
exit;
|
||||
|
@ -2247,7 +2247,7 @@ begin
|
|||
exit;
|
||||
end;
|
||||
if (not fProjectInterface.targetUpToDate) then if
|
||||
dlgOkCancel('The project output is not up-to-date, rebuild ?') = mrOK then
|
||||
dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then
|
||||
fProjectInterface.compile;
|
||||
if fProjectInterface.outputFilename.fileExists
|
||||
or (fProjectInterface.getFormat = pfDub) then
|
||||
|
|
|
@ -497,9 +497,9 @@ var
|
|||
if sourceAbsolute(i).fileExists then
|
||||
allMissing := false;
|
||||
if not allMissing then exit;
|
||||
if dlgOkCancel( 'The project source(s) are all missing. ' + LineEnding +
|
||||
if dlgYesNo( 'The project source(s) are all missing. ' + LineEnding +
|
||||
'This can be encountered if the project file has been moved from its original location.' + LineEnding + LineEnding +
|
||||
'Do you wish to select the new root folder ?') <> mrOk then exit;
|
||||
'Do you wish to select the new root folder ?') <> mrYes then exit;
|
||||
// TODO-cimprovement: use commonFolder() when it'll be compat. with the rel. paths.
|
||||
// hint for the common dir
|
||||
dirHint := fSrcs[i];
|
||||
|
@ -529,10 +529,10 @@ var
|
|||
begin
|
||||
oldsrc := sourceAbsolute(i);
|
||||
if oldsrc.fileExists then continue;
|
||||
if dlgOkCancel(format('a particular project source file ("%s") is missing. '
|
||||
if dlgYesNo(format('a particular project source file ("%s") is missing. '
|
||||
+ LineEnding + 'This happends if a source file has been moved, renamed ' +
|
||||
'or deleted.' + LineEnding + LineEnding +
|
||||
'Do you wish to select its new location?', [fSrcs[i]])) <> mrOk then exit;
|
||||
'Do you wish to select its new location?', [fSrcs[i]])) <> mrYes then exit;
|
||||
//
|
||||
opendlg := TOpenDialog.Create(nil);
|
||||
try
|
||||
|
@ -541,14 +541,14 @@ var
|
|||
if opendlg.execute then
|
||||
begin
|
||||
if oldsrc.extractFileName <> opendlg.filename.extractFileName then
|
||||
if dlgOkCancel('the filenames are different, replace the old file ?') <> mrOk then
|
||||
if dlgYesNo('the filenames are different, replace the old file ?') <> mrYes then
|
||||
continue;
|
||||
fSrcs[i] := ExtractRelativepath(fBasePath, opendlg.Filename);
|
||||
hasPatched := true;
|
||||
end else
|
||||
begin
|
||||
if dlgOkCancel('You have choosen not to update the file, ' +
|
||||
'do you wish to remove it from the project ?') <> mrOk then
|
||||
if dlgYesNo('You have choosen not to update the file, ' +
|
||||
'do you wish to remove it from the project ?') <> mrYes then
|
||||
continue;
|
||||
fSrcs.Delete(i);
|
||||
hasPatched := true;
|
||||
|
|
|
@ -147,7 +147,7 @@ begin
|
|||
begin
|
||||
if fCatChanged then
|
||||
begin
|
||||
result := dlgOkCancel(msg_mod) = mrOk;
|
||||
result := dlgYesNo(msg_mod) = mrYes;
|
||||
fCatChanged := not result;
|
||||
if result then btnCancelClick(nil);
|
||||
end;
|
||||
|
@ -159,7 +159,7 @@ begin
|
|||
if dt^.observer = nil then exit;
|
||||
if dt^.observer.optionedOptionsModified() then
|
||||
begin
|
||||
result := dlgOkCancel(msg_mod) = mrOk;
|
||||
result := dlgYesNo(msg_mod) = mrYes;
|
||||
if result then btnCancelClick(nil);
|
||||
end;
|
||||
end;
|
||||
|
|
|
@ -1385,8 +1385,8 @@ begin
|
|||
begin
|
||||
// note: this could cause a bug during the DST switch.
|
||||
// e.g: save at 2h59, 3h00 reset to 2h00, set the focus on the doc: new version message.
|
||||
if dlgOkCancel(format('"%s" has been modified by another program, load the new version ?',
|
||||
[shortenPath(fFilename, 25)])) = mrOk then
|
||||
if dlgYesNo(format('"%s" has been modified by another program, load the new version ?',
|
||||
[shortenPath(fFilename, 25)])) = mrYes then
|
||||
begin
|
||||
str := TStringList.Create;
|
||||
try
|
||||
|
|
Loading…
Reference in New Issue