1 {(*}
2 (*------------------------------------------------------------------------------
3  Delphi Code formatter source code
4 
5 The Original Code is ConvertTypes.pas, released April 2000.
6 The Initial Developer of the Original Code is Anthony Steele.
7 Portions created by Anthony Steele are Copyright (C) 1999-2008 Anthony Steele.
8 All Rights Reserved.
9 Contributor(s): Anthony Steele.
10 
11 The contents of this file are subject to the Mozilla Public License Version 1.1
12 (the "License"). you may not use this file except in compliance with the License.
13 You may obtain a copy of the License at http://www.mozilla.org/NPL/
14 
15 Software distributed under the License is distributed on an "AS IS" basis,
16 WITHOUT WARRANTY OF ANY KIND, either express or implied.
17 See the License for the specific language governing rights and limitations
18 under the License.
19 
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 or later (the "GPL")
22 See http://www.gnu.org/licenses/gpl.html
23 ------------------------------------------------------------------------------*)
24 {*)}
25 
26 unit ConvertTypes;
27 
28 {$I JcfGlobal.inc}
29 
30 interface
31 
32 { settings on how to convert
33   this unit is simple type defs with no dependencies
34 }
35 type
36   TBackupMode = (cmInPlace, cmInPlaceWithBackup, cmSeparateOutput);
37   TSourceMode = (fmSingleFile, fmDirectory, fmDirectoryRecursive);
38 
39   TStatusMessageType =
40     (
41     mtException, // an exception was thrown - internal error
42     mtInputError, // program input params are not understood, file is readonly, etc
43     mtParseError, // could not parse the file
44     mtCodeWarning, // wanring issued on the code
45     mtFinalSummary, // summary of work down
46     mtProgress // summery of work in progress
47     );
48 
49 type
50   { type for a proc to receive a message
51   from the depths of the fornatter to the ui
52   many of them have a line x,y specified }
53   TStatusMessageProc = procedure(const psUnit, psMessage: string;
54     const peMessageType: TStatusMessageType;
55     const piY, piX: integer) of object;
56 
57 type
58   TShowParseTreeOption = (eShowAlways, eShowOnError, eShowNever);
59 
60 const
61   OLD_REG_ROOT_KEY = '\Software\Jedi\JediCodeFormat';
62  {$IFDEF FPC} REG_ROOT_KEY = OLD_REG_ROOT_KEY; {$ENDIF}
63  {$IFDEF DELPHI1} REG_ROOT_KEY = '\Software\Borland\Delphi\1.0\Jedi\JCF'; {$ENDIF}
64  {$IFDEF DELPHI2} REG_ROOT_KEY = '\Software\Borland\Delphi\2.0\Jedi\JCF'; {$ENDIF}
65  {$IFDEF DELPHI3} REG_ROOT_KEY = '\Software\Borland\Delphi\3.0\Jedi\JCF'; {$ENDIF}
66  {$IFDEF DELPHI4} REG_ROOT_KEY = '\Software\Borland\Delphi\4.0\Jedi\JCF'; {$ENDIF}
67  {$IFDEF DELPHI5} REG_ROOT_KEY = '\Software\Borland\Delphi\5.0\Jedi\JCF'; {$ENDIF}
68  {$IFDEF DELPHI6} REG_ROOT_KEY = '\Software\Borland\Delphi\6.0\Jedi\JCF'; {$ENDIF}
69  {$IFDEF DELPHI7} REG_ROOT_KEY = '\Software\Borland\Delphi\7.0\Jedi\JCF'; {$ENDIF}
70  {$IFDEF DELPHI8} REG_ROOT_KEY = '\Software\Borland\BDS\2.0\Jedi\JCF'; {$ENDIF}
71  {$IFDEF DELPHI9} REG_ROOT_KEY = '\Software\Borland\BDS\3.0\Jedi\JCF'; {$ENDIF}
72  {$IFDEF DELPHI10} REG_ROOT_KEY = '\Software\Borland\BDS\4.0\Jedi\JCF'; {$ENDIF}
73  {$IFDEF DELPHI11} REG_ROOT_KEY = '\Software\Borland\BDS\5.0\Jedi\JCF'; {$ENDIF}
74  {$IFDEF DELPHI12} REG_ROOT_KEY = '\Software\CodeGear\BDS\6.0\Jedi\JCF'; {$ENDIF}
75  {$IFDEF DELPHI14} REG_ROOT_KEY = '\Software\CodeGear\BDS\7.0\Jedi\JCF'; {$ENDIF}
76 
77 const
78   SOURCE_FILE_FILTERS =
79     'All source|*.pas; *.dpr; *.dpk; *.pp; *.lpr; *.lpk; *.txt|' +
80     'Delphi source (*.pas, *.dpr, *.dpk)|*.pas; *.dpr; *.dpk|' +
81     'Lazarus source (*.pas, *.pp, *.lpr, *.lpk)|*.pas; *.pp; *.lpr; *.lpk|' +
82     'Pascal Source (*.pas, *.pp)|*.pas; *.pp|' +
83     'Text files (*.txt)|*.txt|' +
84     'All files (*.*)|*.*';
85 
86   CONFIG_FILE_FILTERS =
87     'Config files (*.cfg)|*.cfg|' +
88     'Text files (*.txt)|*.txt|' +
89     'XML files (*.xml)|*.xml|' +
90     'All files (*.*)|*.*';
91 
DescribeFileCountnull92 function DescribeFileCount(const piCount: integer): string;
93 
94 implementation
95 
96 uses SysUtils;
97 
DescribeFileCountnull98 function DescribeFileCount(const piCount: integer): string;
99 begin
100   if piCount = 1 then
101     Result := '1 file'
102   else
103     Result := IntToStr(piCount) + ' files';
104 end;
105 
106 end.
107 
108 
109