-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEditorSettings.pas
55 lines (44 loc) · 1.47 KB
/
EditorSettings.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
unit EditorSettings;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, inifiles, Main;
type
TEditorSettingsForm = class(TForm)
SaveBtn: TBitBtn;
BaggrundFarve: TColorBox;
Label1: TLabel;
SkriftFarve: TColorBox;
Label2: TLabel;
procedure SaveBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
EditorSettingsForm: TEditorSettingsForm;
ConfigFile: TINIFile;
PathToINIFile: String;
implementation
{$R *.dfm}
procedure TEditorSettingsForm.SaveBtnClick(Sender: TObject);
Begin
PathToINIFile:=IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+'settings.ini';
ConfigFile:=TINIFile.Create(PathToINIFile);
ConfigFile.WriteString('Editor', 'BaggrundsFarve', ColorToString(BaggrundFarve.Selected));
ConfigFile.WriteString('Editor', 'SkriftFarve', ColorToString(SkriftFarve.Selected));
ConfigFile.Free;
Close;
end;
procedure TEditorSettingsForm.FormShow(Sender: TObject);
begin
PathToINIFile:=IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+Main.ConfFil;
ConfigFile := TINIFile.Create(PathToINIFile);
AlphaBlendValue:=main.Trans;
BaggrundFarve.Selected:=StringToColor(ConfigFile.ReadString('Editor', 'BaggrundsFarve', 'clWhite'));
SkriftFarve.Selected:=StringToColor(ConfigFile.ReadString('Editor', 'SkriftFarve', 'clBlack'));
ConfigFile.Free;
end;
end.