1 {
2  ***************************************************************************
3  *                                                                         *
4  *   This source is free software; you can redistribute it and/or modify   *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This code is distributed in the hope that it will be useful, but      *
10  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
12  *   General Public License for more details.                              *
13  *                                                                         *
14  *   A copy of the GNU General Public License is available on the World    *
15  *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
16  *   obtain it by writing to the Free Software Foundation,                 *
17  *   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.   *
18  *                                                                         *
19  ***************************************************************************
20 
21   Author: Mattias Gaertner
22 
23   Abstract:
24     Dialog to edit System-Variables-User-Overrides.
25     Used by the run parameter dialog
26 }
27 unit SysVarUserOverrideDlg;
28 
29 {$mode objfpc}{$H+}
30 
31 {$I ide.inc}
32 
33 interface
34 
35 uses
36   {$IFDEF IDE_MEM_CHECK}
37   MemCheck,
38   {$ENDIF}
39   Classes, SysUtils,
40   // LCL
41   Controls, Forms, Dialogs,
42   // IdeIntf
43   IDEDialogs,
44   // IDE
45   LazarusIDEStrConsts;
46 
ShowSysVarUserOverrideDialognull47 function ShowSysVarUserOverrideDialog(var AName, AValue: string): TModalResult;
48 
49 implementation
50 
ShowSysVarUserOverrideDialognull51 function ShowSysVarUserOverrideDialog(var AName, AValue: string): TModalResult;
52 var
53   ok: boolean;
54   Vals: array of string;
55 begin
56   SetLength(Vals, 2);
57   Vals[0]:= AName;
58   Vals[1]:= AValue;
59 
60   repeat
61     ok:= InputQuery(lisSVUOOverrideSystemVariable,
62       [lisVariable, lisValue], Vals);
63     if not ok then exit(mrCancel);
64 
65     AName:= Trim(Vals[0]);
66     AValue:= Vals[1];
67     if IsValidIdent(AName) then
68       exit(mrOk)
69     else
70       if IDEMessageDialog(lisSVUOInvalidVariableName,
71         Format(lisSVUOisNotAValidIdentifier, [AName]),
72         mtWarning, [mbCancel, mbIgnore])=mrIgnore then exit(mrOk);
73   until false;
74 end;
75 
76 end.
77 
78