3 {$INCLUDE ../shared/a_modes.inc}
8 LCLIntf
, LCLType
, LMessages
, Messages
, SysUtils
, Variants
, Classes
,
9 Graphics
, Controls
, Forms
, Dialogs
, StdCtrls
,
10 ExtCtrls
, ComCtrls
, Registry
;
13 TOptionsForm
= class (TForm
)
16 ColorDialog
: TColorDialog
;
19 cbShowDots
: TCheckBox
;
20 cbShowTexture
: TCheckBox
;
21 cbShowSize
: TCheckBox
;
38 sPreviewColor
: TShape
;
43 // Количество недавно открытых:
47 LabelLanguage
: TLabel
;
48 rbRussian
: TRadioButton
;
49 rbEnglish
: TRadioButton
;
50 LabelGridSize
: TLabel
;
53 procedure bGridClick(Sender
: TObject
);
54 procedure FormActivate(Sender
: TObject
);
55 procedure bOKClick(Sender
: TObject
);
56 procedure bCancelClick(Sender
: TObject
);
57 procedure bBackClick(Sender
: TObject
);
58 procedure bPreviewClick(Sender
: TObject
);
61 { Private declarations }
63 { Public declarations }
67 OptionsForm
: TOptionsForm
;
69 procedure RegisterFileType(ext
: String; FileName
: String);
74 f_main
, StdConvs
, CONFIG
, g_language
;
78 procedure RegisterFileType(ext
: String; FileName
: String);
83 reg
:= TRegistry
.Create();
87 RootKey
:= HKEY_CLASSES_ROOT
;
88 OpenKey('.'+ext
,True);
89 WriteString('',ext
+'file');
91 CreateKey(ext
+'file');
92 OpenKey(ext
+'file\DefaultIcon',True);
93 WriteString('',FileName
+',0');
95 OpenKey(ext
+'file\shell\open\command',True);
96 WriteString('',FileName
+' "%1"');
102 procedure TOptionsForm
.bGridClick(Sender
: TObject
);
104 if ColorDialog
.Execute
then
105 sDotColor
.Brush
.Color
:= ColorDialog
.Color
;
108 procedure TOptionsForm
.FormActivate(Sender
: TObject
);
110 sDotColor
.Brush
.Color
:= DotColor
;
111 cbShowDots
.Checked
:= DotEnable
;
112 cbShowTexture
.Checked
:= DrawTexturePanel
;
113 cbShowSize
.Checked
:= DrawPanelSize
;
114 eDotStepOne
.Text := IntToStr(DotStepOne
);
115 eDotStepTwo
.Text := IntToStr(DotStepTwo
);
116 sBackColor
.Brush
.Color
:= BackColor
;
117 sPreviewColor
.Brush
.Color
:= PreviewColor
;
119 cbScale
.ItemIndex
:= 1
121 cbScale
.ItemIndex
:= 0;
123 cbDotSize
.ItemIndex
:= 1
125 cbDotSize
.ItemIndex
:= 0;
126 eRecent
.Text := IntToStr(RecentCount
);
129 if gLanguage
= LANGUAGE_RUSSIAN
then
131 rbRussian
.Checked
:= True;
132 rbEnglish
.Checked
:= False;
136 rbRussian
.Checked
:= False;
137 rbEnglish
.Checked
:= True;
141 procedure TOptionsForm
.bOKClick(Sender
: TObject
);
149 re
:= StrToIntDef(eRecent
.Text, 5);
155 if rbRussian
.Checked
then
156 str
:= LANGUAGE_RUSSIAN
158 str
:= LANGUAGE_ENGLISH
;
160 // Нужно сменить язык:
161 if gLanguage
<> str
then
164 //e_WriteLog('Read language file', MSG_NOTIFY);
165 //g_Language_Load(EditorDir+'\data\'+gLanguage+LANGUAGE_FILE_NAME);
166 g_Language_Set(gLanguage
);
169 DotColor
:= sDotColor
.Brush
.Color
;
170 DotEnable
:= cbShowDots
.Checked
;
172 if DotStep
= DotStepOne
then
176 DotStepOne
:= StrToIntDef(eDotStepOne
.Text, 16);
177 DotStepTwo
:= StrToIntDef(eDotStepTwo
.Text, 8);
179 DotStep
:= DotStepOne
181 DotStep
:= DotStepTwo
;
183 DrawTexturePanel
:= cbShowTexture
.Checked
;
184 DrawPanelSize
:= cbShowSize
.Checked
;
185 BackColor
:= sBackColor
.Brush
.Color
;
186 PreviewColor
:= sPreviewColor
.Brush
.Color
;
188 if cbScale
.ItemIndex
= 1 then
193 if cbDotSize
.ItemIndex
= 1 then
198 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
200 config
.WriteInt('Editor', 'DotColor', DotColor
);
201 config
.WriteBool('Editor', 'DotEnable', DotEnable
);
202 config
.WriteInt('Editor', 'DotStepOne', DotStepOne
);
203 config
.WriteInt('Editor', 'DotStepTwo', DotStepTwo
);
204 config
.WriteInt('Editor', 'DotStep', DotStep
);
205 config
.WriteInt('Editor', 'DotSize', cbDotSize
.ItemIndex
);
206 config
.WriteBool('Editor', 'DrawTexturePanel', DrawTexturePanel
);
207 config
.WriteBool('Editor', 'DrawPanelSize', DrawPanelSize
);
208 config
.WriteInt('Editor', 'BackColor', BackColor
);
209 config
.WriteInt('Editor', 'PreviewColor', PreviewColor
);
210 config
.WriteInt('Editor', 'Scale', cbScale
.ItemIndex
);
211 config
.WriteInt('Editor', 'RecentCount', re
);
212 config
.WriteStr('Editor', 'Language', gLanguage
);
214 if RecentCount
<> re
then
217 MainForm
.RefreshRecentMenu();
220 config
.SaveFile(EditorDir
+'Editor.cfg');
225 procedure TOptionsForm
.bCancelClick(Sender
: TObject
);
230 procedure TOptionsForm
.bBackClick(Sender
: TObject
);
232 if ColorDialog
.Execute
then
233 sBackColor
.Brush
.Color
:= ColorDialog
.Color
;
236 procedure TOptionsForm
.bPreviewClick(Sender
: TObject
);
238 if ColorDialog
.Execute
then
239 sPreviewColor
.Brush
.Color
:= ColorDialog
.Color
;