IDE: build modes: error message when duplicate name

git-svn-id: trunk@41496 -
This commit is contained in:
mattias 2013-06-02 17:20:18 +00:00
parent c79b6e04a3
commit 688a2e73fe
2 changed files with 17 additions and 4 deletions

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Grids, Buttons, Menus, ButtonPanel, LCLProc,
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf,
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf, IDEDialogs,
PackageDefs, TransferMacros, PathEditorDlg, Project, LazarusIDEStrConsts,
CompilerOptions, IDEProcs, BuildModeDiffDlg;
@ -355,8 +355,8 @@ begin
if b and (i=0) then
begin
NewValue:=OldValue;
MessageDlg(lisCCOErrorCaption,lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn,
mtError,[mbCancel],0);
IDEMessageDialog(lisCCOErrorCaption,lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn,
mtError,[mbCancel]);
exit;
end;
CurMode.InSession:=b;
@ -368,8 +368,18 @@ begin
for i:=1 to length(s) do
if s[i]<' ' then
s[i]:=' ';
CurMode.Identifier:=s;
NewValue:=s;
if CurMode.Identifier<>s then begin
for i:=0 to fBuildModes.Count-1 do begin
if (fBuildModes[i]<>CurMode)
and (Comparetext(fBuildModes[i].Identifier,NewValue)=0) then begin
IDEMessageDialog(lisDuplicateEntry,
lisThereIsAlreadyABuildModeWithThisName, mtError, [mbCancel]);
NewValue:=CurMode.Identifier;
end;
end;
CurMode.Identifier:=s;
end;
end;
UpdateDialogCaption;
end;

View File

@ -5365,6 +5365,9 @@ resourcestring
lisThereMustBeAtLeastOneBuildMode = 'There must be at least one build mode.';
lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn = 'The first build '
+'mode is the default mode and must be stored in the project, not in the session.';
lisDuplicateEntry = 'Duplicate entry';
lisThereIsAlreadyABuildModeWithThisName = 'There is already a build mode '
+'with this name.';
lisAddNewBuildModeCopyingSettingsFrom = 'Add new build mode, copying '
+'settings from "%s"';
lisDeleteMode = 'Delete mode "%s"';