Subversion Repositories fastphp

Rev

Rev 49 | Go to most recent revision | 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;
49 daniel-mar 18
  public
19
    class property FontSize: integer read GetFontSize write SetFontSize;
20
    class property ScrapFile: string read GetScrapFile write SetScrapFile;
21
    class property HelpIndex: string read GetHelpIndex write SetHelpIndex;
22
    class property PhpInterpreter: string read GetPhpInterpreter write SetPhpInterpreter;
57 daniel-mar 23
    class property SpecialChars: boolean read GetSpecialChars write SetSpecialChars;
49 daniel-mar 24
  end;
25
 
26
implementation
27
 
28
uses
29
  Windows, Registry;
30
 
31
class function TFastPHPConfig.GetHelpIndex: string;
32
var
33
  reg: TRegistry;
34
begin
35
  result := '';
36
  reg := TRegistry.Create;
37
  try
38
    reg.RootKey := HKEY_CURRENT_USER;
39
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then
40
    begin
41
      if reg.ValueExists('HelpIndex') then
42
        result := reg.ReadString('HelpIndex');
43
      reg.CloseKey;
44
    end;
45
  finally
46
    reg.Free;
47
  end;
48
end;
49
 
50
class function TFastPHPConfig.GetPhpInterpreter: string;
51
var
52
  reg: TRegistry;
53
begin
54
  result := '';
55
  reg := TRegistry.Create;
56
  try
57
    reg.RootKey := HKEY_CURRENT_USER;
58
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', false) then
59
    begin
60
      if reg.ValueExists('PhpInterpreter') then
61
        result := reg.ReadString('PhpInterpreter');
62
      reg.CloseKey;
63
    end;
64
  finally
65
    reg.Free;
66
  end;
67
end;
68
 
69
class function TFastPHPConfig.GetScrapFile: string;
70
var
71
  reg: TRegistry;
72
begin
73
  result := '';
74
  reg := TRegistry.Create;
75
  try
76
    reg.RootKey := HKEY_CURRENT_USER;
77
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then
78
    begin
79
      if reg.ValueExists('ScrapFile') then
80
        result := reg.ReadString('ScrapFile');
81
      reg.CloseKey;
82
    end;
83
  finally
84
    reg.Free;
85
  end;
86
end;
87
 
57 daniel-mar 88
class function TFastPHPConfig.GetSpecialChars: boolean;
89
var
90
  reg: TRegistry;
91
begin
92
  result := false;
93
  reg := TRegistry.Create;
94
  try
95
    reg.RootKey := HKEY_CURRENT_USER;
96
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then
97
    begin
98
      if reg.ValueExists('SpecialChars') then
99
        result := reg.ReadBool('SpecialChars');
100
      reg.CloseKey;
101
    end;
102
  finally
103
    reg.Free;
104
  end;
105
end;
106
 
49 daniel-mar 107
class function TFastPHPConfig.GetFontSize: integer;
108
var
109
  reg: TRegistry;
110
begin
111
  result := -1;
112
  reg := TRegistry.Create;
113
  try
114
    reg.RootKey := HKEY_CURRENT_USER;
115
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', false) then
116
    begin
117
      if reg.ValueExists('FontSize') then
118
        result := reg.ReadInteger('FontSize');
119
      reg.CloseKey;
120
    end;
121
  finally
122
    reg.Free;
123
  end;
124
end;
125
 
126
class procedure TFastPHPConfig.SetFontSize(Value: integer);
127
var
128
  reg: TRegistry;
129
begin
130
  reg := TRegistry.Create;
131
  try
132
    reg.RootKey := HKEY_CURRENT_USER;
133
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then
134
    begin
135
      reg.WriteInteger('FontSize', Value);
136
      reg.CloseKey;
137
    end;
138
  finally
139
    reg.Free;
140
  end;
141
end;
142
class procedure TFastPHPConfig.SetHelpIndex(const Value: string);
143
var
144
  reg: TRegistry;
145
begin
146
  reg := TRegistry.Create;
147
  try
148
    reg.RootKey := HKEY_CURRENT_USER;
149
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then
150
    begin
151
      reg.WriteString('HelpIndex', Value);
152
      reg.CloseKey;
153
    end;
154
  finally
155
    reg.Free;
156
  end;
157
end;
158
 
159
class procedure TFastPHPConfig.SetPhpInterpreter(const Value: string);
160
var
161
  reg: TRegistry;
162
begin
163
  reg := TRegistry.Create;
164
  try
165
    reg.RootKey := HKEY_CURRENT_USER;
166
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Common', true) then
167
    begin
168
      reg.WriteString('PhpInterpreter', Value);
169
      reg.CloseKey;
170
    end;
171
  finally
172
    reg.Free;
173
  end;
174
end;
175
 
176
class procedure TFastPHPConfig.SetScrapFile(Value: string);
177
var
178
  reg: TRegistry;
179
begin
180
  reg := TRegistry.Create;
181
  try
182
    reg.RootKey := HKEY_CURRENT_USER;
183
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then
184
    begin
185
      reg.WriteString('ScrapFile', Value);
186
      reg.CloseKey;
187
    end;
188
  finally
189
    reg.Free;
190
  end;
191
end;
192
 
57 daniel-mar 193
class procedure TFastPHPConfig.SetSpecialChars(const Value: boolean);
194
var
195
  reg: TRegistry;
196
begin
197
  reg := TRegistry.Create;
198
  try
199
    reg.RootKey := HKEY_CURRENT_USER;
200
    if reg.OpenKey('Software\ViaThinkSoft\FastPHP\Editor', true) then
201
    begin
202
      reg.WriteBool('SpecialChars', Value);
203
      reg.CloseKey;
204
    end;
205
  finally
206
    reg.Free;
207
  end;
208
end;
209
 
49 daniel-mar 210
end.
211