Rev 57 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 57 | Rev 62 | ||
---|---|---|---|
1 | unit FastPHPConfig; |
1 | unit FastPHPConfig; |
2 | 2 | ||
3 | interface |
3 | interface |
4 | 4 | ||
5 | type |
5 | type |
6 | TFastPHPConfig = class(TObject) |
6 | TFastPHPConfig = class(TObject) |
7 | private |
7 | private |
8 | class function GetFontSize: integer; static; |
8 | class function GetFontSize: integer; static; |
9 | class procedure SetFontSize(Value: integer); static; |
9 | class procedure SetFontSize(Value: integer); static; |
10 | class function GetScrapFile: string; static; |
10 | class function GetScrapFile: string; static; |
11 | class procedure SetScrapFile(Value: string); static; |
11 | class procedure SetScrapFile(Value: string); static; |
12 | class function GetHelpIndex: string; static; |
12 | class function GetHelpIndex: string; static; |
13 | class procedure SetHelpIndex(const Value: string); static; |
13 | class procedure SetHelpIndex(const Value: string); static; |
14 | class function GetPhpInterpreter: string; static; |
14 | class function GetPhpInterpreter: string; static; |
15 | class procedure SetPhpInterpreter(const Value: string); static; |
15 | class procedure SetPhpInterpreter(const Value: string); static; |
16 | class function GetSpecialChars: boolean; static; |
16 | class function GetSpecialChars: boolean; static; |
17 | class procedure SetSpecialChars(const Value: boolean); static; |
17 | class procedure SetSpecialChars(const Value: boolean); static; |
- | 18 | class function GetDarkTheme: boolean; static; |
|
- | 19 | class procedure SetDarkTheme(const Value: boolean); static; |
|
18 | public |
20 | public |
19 | class property FontSize: integer read GetFontSize write SetFontSize; |
21 | class property FontSize: integer read GetFontSize write SetFontSize; |
20 | class property ScrapFile: string read GetScrapFile write SetScrapFile; |
22 | class property ScrapFile: string read GetScrapFile write SetScrapFile; |
21 | class property HelpIndex: string read GetHelpIndex write SetHelpIndex; |
23 | class property HelpIndex: string read GetHelpIndex write SetHelpIndex; |
22 | class property PhpInterpreter: string read GetPhpInterpreter write SetPhpInterpreter; |
24 | class property PhpInterpreter: string read GetPhpInterpreter write SetPhpInterpreter; |
23 | class property SpecialChars: boolean read GetSpecialChars write SetSpecialChars; |
25 | class property SpecialChars: boolean read GetSpecialChars write SetSpecialChars; |
- | 26 | class property DarkTheme: boolean read GetDarkTheme write SetDarkTheme; |
|
24 | end; |
27 | end; |
25 | 28 | ||
26 | implementation |
29 | implementation |
27 | 30 | ||
28 | uses |
31 | uses |
29 | Windows, Registry; |
32 | Windows, Registry; |
30 | 33 | ||
31 | class function TFastPHPConfig.GetHelpIndex: string; |
34 | class function TFastPHPConfig.GetHelpIndex: string; |
32 | var |
35 | var |
33 | reg: TRegistry; |
36 | reg: TRegistry; |
34 | begin |
37 | begin |
35 | result := ''; |
38 | result := ''; |
36 | reg := TRegistry.Create; |
39 | reg := TRegistry.Create; |
37 | try |
40 | try |
38 | reg.RootKey := HKEY_CURRENT_USER; |
41 | reg.RootKey := HKEY_CURRENT_USER; |
39 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
42 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
40 | begin |
43 | begin |
41 | if reg.ValueExists('HelpIndex') then |
44 | if reg.ValueExists('HelpIndex') then |
42 | result := reg.ReadString('HelpIndex'); |
45 | result := reg.ReadString('HelpIndex'); |
43 | reg.CloseKey; |
46 | reg.CloseKey; |
44 | end; |
47 | end; |
45 | finally |
48 | finally |
46 | reg.Free; |
49 | reg.Free; |
47 | end; |
50 | end; |
48 | end; |
51 | end; |
49 | 52 | ||
50 | class function TFastPHPConfig.GetPhpInterpreter: string; |
53 | class function TFastPHPConfig.GetPhpInterpreter: string; |
51 | var |
54 | var |
52 | reg: TRegistry; |
55 | reg: TRegistry; |
53 | begin |
56 | begin |
54 | result := ''; |
57 | result := ''; |
55 | reg := TRegistry.Create; |
58 | reg := TRegistry.Create; |
56 | try |
59 | try |
57 | reg.RootKey := HKEY_CURRENT_USER; |
60 | reg.RootKey := HKEY_CURRENT_USER; |
58 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', false) then |
61 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', false) then |
59 | begin |
62 | begin |
60 | if reg.ValueExists('PhpInterpreter') then |
63 | if reg.ValueExists('PhpInterpreter') then |
61 | result := reg.ReadString('PhpInterpreter'); |
64 | result := reg.ReadString('PhpInterpreter'); |
62 | reg.CloseKey; |
65 | reg.CloseKey; |
63 | end; |
66 | end; |
64 | finally |
67 | finally |
65 | reg.Free; |
68 | reg.Free; |
66 | end; |
69 | end; |
67 | end; |
70 | end; |
68 | 71 | ||
69 | class function TFastPHPConfig.GetScrapFile: string; |
72 | class function TFastPHPConfig.GetScrapFile: string; |
70 | var |
73 | var |
71 | reg: TRegistry; |
74 | reg: TRegistry; |
72 | begin |
75 | begin |
73 | result := ''; |
76 | result := ''; |
74 | reg := TRegistry.Create; |
77 | reg := TRegistry.Create; |
75 | try |
78 | try |
76 | reg.RootKey := HKEY_CURRENT_USER; |
79 | reg.RootKey := HKEY_CURRENT_USER; |
77 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
80 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
78 | begin |
81 | begin |
79 | if reg.ValueExists('ScrapFile') then |
82 | if reg.ValueExists('ScrapFile') then |
80 | result := reg.ReadString('ScrapFile'); |
83 | result := reg.ReadString('ScrapFile'); |
81 | reg.CloseKey; |
84 | reg.CloseKey; |
82 | end; |
85 | end; |
83 | finally |
86 | finally |
84 | reg.Free; |
87 | reg.Free; |
85 | end; |
88 | end; |
86 | end; |
89 | end; |
87 | 90 | ||
88 | class function TFastPHPConfig.GetSpecialChars: boolean; |
91 | class function TFastPHPConfig.GetSpecialChars: boolean; |
89 | var |
92 | var |
90 | reg: TRegistry; |
93 | reg: TRegistry; |
91 | begin |
94 | begin |
92 | result := false; |
95 | result := false; |
93 | reg := TRegistry.Create; |
96 | reg := TRegistry.Create; |
94 | try |
97 | try |
95 | reg.RootKey := HKEY_CURRENT_USER; |
98 | reg.RootKey := HKEY_CURRENT_USER; |
96 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
99 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
97 | begin |
100 | begin |
98 | if reg.ValueExists('SpecialChars') then |
101 | if reg.ValueExists('SpecialChars') then |
99 | result := reg.ReadBool('SpecialChars'); |
102 | result := reg.ReadBool('SpecialChars'); |
100 | reg.CloseKey; |
103 | reg.CloseKey; |
101 | end; |
104 | end; |
102 | finally |
105 | finally |
103 | reg.Free; |
106 | reg.Free; |
104 | end; |
107 | end; |
105 | end; |
108 | end; |
106 | 109 | ||
- | 110 | class function TFastPHPConfig.GetDarkTheme: boolean; |
|
- | 111 | var |
|
- | 112 | reg: TRegistry; |
|
- | 113 | begin |
|
- | 114 | result := false; |
|
- | 115 | reg := TRegistry.Create; |
|
- | 116 | try |
|
- | 117 | reg.RootKey := HKEY_CURRENT_USER; |
|
- | 118 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
|
- | 119 | begin |
|
- | 120 | if reg.ValueExists('DarkTheme') then |
|
- | 121 | result := reg.ReadBool('DarkTheme'); |
|
- | 122 | reg.CloseKey; |
|
- | 123 | end; |
|
- | 124 | finally |
|
- | 125 | reg.Free; |
|
- | 126 | end; |
|
- | 127 | end; |
|
- | 128 | ||
107 | class function TFastPHPConfig.GetFontSize: integer; |
129 | class function TFastPHPConfig.GetFontSize: integer; |
108 | var |
130 | var |
109 | reg: TRegistry; |
131 | reg: TRegistry; |
110 | begin |
132 | begin |
111 | result := -1; |
133 | result := -1; |
112 | reg := TRegistry.Create; |
134 | reg := TRegistry.Create; |
113 | try |
135 | try |
114 | reg.RootKey := HKEY_CURRENT_USER; |
136 | reg.RootKey := HKEY_CURRENT_USER; |
115 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
137 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then |
116 | begin |
138 | begin |
117 | if reg.ValueExists('FontSize') then |
139 | if reg.ValueExists('FontSize') then |
118 | result := reg.ReadInteger('FontSize'); |
140 | result := reg.ReadInteger('FontSize'); |
119 | reg.CloseKey; |
141 | reg.CloseKey; |
- | 142 | end; |
|
- | 143 | finally |
|
- | 144 | reg.Free; |
|
- | 145 | end; |
|
- | 146 | end; |
|
- | 147 | ||
- | 148 | class procedure TFastPHPConfig.SetDarkTheme(const Value: boolean); |
|
- | 149 | var |
|
- | 150 | reg: TRegistry; |
|
- | 151 | begin |
|
- | 152 | reg := TRegistry.Create; |
|
- | 153 | try |
|
- | 154 | reg.RootKey := HKEY_CURRENT_USER; |
|
- | 155 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
|
- | 156 | begin |
|
- | 157 | reg.WriteBool('DarkTheme', Value); |
|
- | 158 | reg.CloseKey; |
|
120 | end; |
159 | end; |
121 | finally |
160 | finally |
122 | reg.Free; |
161 | reg.Free; |
123 | end; |
162 | end; |
124 | end; |
163 | end; |
125 | 164 | ||
126 | class procedure TFastPHPConfig.SetFontSize(Value: integer); |
165 | class procedure TFastPHPConfig.SetFontSize(Value: integer); |
127 | var |
166 | var |
128 | reg: TRegistry; |
167 | reg: TRegistry; |
129 | begin |
168 | begin |
130 | reg := TRegistry.Create; |
169 | reg := TRegistry.Create; |
131 | try |
170 | try |
132 | reg.RootKey := HKEY_CURRENT_USER; |
171 | reg.RootKey := HKEY_CURRENT_USER; |
133 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
172 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
134 | begin |
173 | begin |
135 | reg.WriteInteger('FontSize', Value); |
174 | reg.WriteInteger('FontSize', Value); |
136 | reg.CloseKey; |
175 | reg.CloseKey; |
137 | end; |
176 | end; |
138 | finally |
177 | finally |
139 | reg.Free; |
178 | reg.Free; |
140 | end; |
179 | end; |
141 | end; |
180 | end; |
142 | class procedure TFastPHPConfig.SetHelpIndex(const Value: string); |
181 | class procedure TFastPHPConfig.SetHelpIndex(const Value: string); |
143 | var |
182 | var |
144 | reg: TRegistry; |
183 | reg: TRegistry; |
145 | begin |
184 | begin |
146 | reg := TRegistry.Create; |
185 | reg := TRegistry.Create; |
147 | try |
186 | try |
148 | reg.RootKey := HKEY_CURRENT_USER; |
187 | reg.RootKey := HKEY_CURRENT_USER; |
149 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
188 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
150 | begin |
189 | begin |
151 | reg.WriteString('HelpIndex', Value); |
190 | reg.WriteString('HelpIndex', Value); |
152 | reg.CloseKey; |
191 | reg.CloseKey; |
153 | end; |
192 | end; |
154 | finally |
193 | finally |
155 | reg.Free; |
194 | reg.Free; |
156 | end; |
195 | end; |
157 | end; |
196 | end; |
158 | 197 | ||
159 | class procedure TFastPHPConfig.SetPhpInterpreter(const Value: string); |
198 | class procedure TFastPHPConfig.SetPhpInterpreter(const Value: string); |
160 | var |
199 | var |
161 | reg: TRegistry; |
200 | reg: TRegistry; |
162 | begin |
201 | begin |
163 | reg := TRegistry.Create; |
202 | reg := TRegistry.Create; |
164 | try |
203 | try |
165 | reg.RootKey := HKEY_CURRENT_USER; |
204 | reg.RootKey := HKEY_CURRENT_USER; |
166 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', true) then |
205 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', true) then |
167 | begin |
206 | begin |
168 | reg.WriteString('PhpInterpreter', Value); |
207 | reg.WriteString('PhpInterpreter', Value); |
169 | reg.CloseKey; |
208 | reg.CloseKey; |
170 | end; |
209 | end; |
171 | finally |
210 | finally |
172 | reg.Free; |
211 | reg.Free; |
173 | end; |
212 | end; |
174 | end; |
213 | end; |
175 | 214 | ||
176 | class procedure TFastPHPConfig.SetScrapFile(Value: string); |
215 | class procedure TFastPHPConfig.SetScrapFile(Value: string); |
177 | var |
216 | var |
178 | reg: TRegistry; |
217 | reg: TRegistry; |
179 | begin |
218 | begin |
180 | reg := TRegistry.Create; |
219 | reg := TRegistry.Create; |
181 | try |
220 | try |
182 | reg.RootKey := HKEY_CURRENT_USER; |
221 | reg.RootKey := HKEY_CURRENT_USER; |
183 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
222 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
184 | begin |
223 | begin |
185 | reg.WriteString('ScrapFile', Value); |
224 | reg.WriteString('ScrapFile', Value); |
186 | reg.CloseKey; |
225 | reg.CloseKey; |
187 | end; |
226 | end; |
188 | finally |
227 | finally |
189 | reg.Free; |
228 | reg.Free; |
190 | end; |
229 | end; |
191 | end; |
230 | end; |
192 | 231 | ||
193 | class procedure TFastPHPConfig.SetSpecialChars(const Value: boolean); |
232 | class procedure TFastPHPConfig.SetSpecialChars(const Value: boolean); |
194 | var |
233 | var |
195 | reg: TRegistry; |
234 | reg: TRegistry; |
196 | begin |
235 | begin |
197 | reg := TRegistry.Create; |
236 | reg := TRegistry.Create; |
198 | try |
237 | try |
199 | reg.RootKey := HKEY_CURRENT_USER; |
238 | reg.RootKey := HKEY_CURRENT_USER; |
200 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
239 | if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then |
201 | begin |
240 | begin |
202 | reg.WriteBool('SpecialChars', Value); |
241 | reg.WriteBool('SpecialChars', Value); |
203 | reg.CloseKey; |
242 | reg.CloseKey; |
204 | end; |
243 | end; |
205 | finally |
244 | finally |
206 | reg.Free; |
245 | reg.Free; |
207 | end; |
246 | end; |
208 | end; |
247 | end; |
209 | 248 | ||
210 | end. |
249 | end. |
211 | 250 | ||
212 | 251 |