Subversion Repositories fastphp

Rev

Rev 57 | Details | Compare with Previous | Last modification | View Log | RSS feed

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