-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options.pas
134 lines (117 loc) · 3.59 KB
/
Options.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//******************************************************************************
// LBA Font Editor - editing lfn (font) files from Little Big Adventure 1 & 2
//
// Options unit.
// Contains routines used for saving and reading program options.
//
// Copyright (C) Zink
// e-mail: zink@poczta.onet.pl
// See the GNU General Public License (License.txt) for details.
//******************************************************************************
unit Options;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, IniFiles, Registry;
type
TOptForm = class(TForm)
AO: TCheckBox;
Bevel1: TBevel;
Bevel2: TBevel;
EM: TCheckBox;
StaticText1: TStaticText;
SN: TCheckBox;
SE: TCheckBox;
cbAssociate: TCheckBox;
procedure AOClick(Sender: TObject);
procedure EMClick(Sender: TObject);
procedure SEClick(Sender: TObject);
procedure cbAssociateClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
OptForm: TOptForm;
procedure SetAssociation;
Procedure SaveOptions;
Procedure LoadOptions;
implementation
uses LBAFont1, Preview;
{$R *.dfm}
procedure TOptForm.AOClick(Sender: TObject);
begin
PaintChars;
Form1.CharPB.Repaint;
end;
procedure TOptForm.EMClick(Sender: TObject);
begin
SE.Enabled:=EM.Checked;
Form1.CharPB.Repaint;
end;
procedure TOptForm.SEClick(Sender: TObject);
begin
Form1.CharPB.Repaint;
end;
procedure SetAssociation;
var Rejestr: TRegIniFile;
begin
Rejestr:=TRegIniFile.Create('');
Rejestr.RootKey:=HKEY_CLASSES_ROOT;
If OptForm.cbAssociate.Checked then begin
Rejestr.WriteString('.lfn','','LBA_font');
Rejestr.WriteString('LBA_font','','LBA Font file');
Rejestr.WriteString('LBA_font','Created by','LBA Font Editor');
Rejestr.WriteString('LBA_font\DefaultIcon','',Application.ExeName+',1');
Rejestr.WriteString('LBA_font\shell','','open');
Rejestr.WriteString('LBA_font\shell\open\command','','"'+Application.ExeName+'" "%1"');
end
else begin
If Rejestr.ReadString('LBA_font','Created by','')='LBA Font Editor'
then begin
Rejestr.EraseSection('.lfn');
Rejestr.EraseSection('LBA_font');
end;
end;
Rejestr.Destroy;
end;
Procedure SaveOptions;
var f: TIniFile;
begin
f:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'LbaFont.ini');
With f do begin
WriteBool('General','ShowNumbers',OptForm.SN.Checked);
WriteBool('General','Associate',OptForm.cbAssociate.Checked);
WriteBool('Preview','RememberSet',PrevForm.cbRemSet.Checked);
WriteBool('Preview','LbaStyle',PrevForm.cbLbaStyle.Checked);
WriteInteger('Preview','FontColour',PrevForm.cFont.ItemIndex);
WriteInteger('Preview','BackColour',PrevForm.cBack.ItemIndex);
WriteBool('Preview','StayOnTop',PrevForm.cbOnTop.Checked);
end;
f.Destroy;
end;
Procedure LoadOptions;
var f: TIniFile;
begin
f:=TIniFile.Create(ExtractFilePath(Application.ExeName)+'LbaFont.ini');
With f do begin
OptForm.SN.Checked:=ReadBool('General','ShowNumbers',True);
OptForm.cbAssociate.Checked:=ReadBool('General','Associate',False);
PrevForm.cbRemSet.Checked:=ReadBool('Preview','RememberSet',False);
If PrevForm.cbRemSet.Checked then begin
PrevForm.cbLbaStyle.Checked:=ReadBool('Preview','LbaStyle',False);
PrevForm.cFont.ItemIndex:=ReadInteger('Preview','FontColour',0);
PrevForm.cBack.ItemIndex:=ReadInteger('Preview','BackColour',15);
PrevForm.cbOnTop.Checked:=ReadBool('Preview','StayOnTop',False);
PrevForm.cbOnTopClick(Form1);
end;
end;
f.Destroy;
SetAssociation;
end;
procedure TOptForm.cbAssociateClick(Sender: TObject);
begin
SetAssociation;
end;
end.