3 {$INCLUDE ../shared/a_modes.inc}
8 LCLIntf
, LCLType
, SysUtils
, Variants
, Classes
,
9 Graphics
, Controls
, Forms
, Dialogs
, StdCtrls
,
10 ExtCtrls
, ComCtrls
, Registry
;
13 TOptionsForm
= class (TForm
)
16 cbCheckerboard
: TCheckBox
;
17 ColorDialog
: TColorDialog
;
20 cbShowDots
: TCheckBox
;
21 cbShowTexture
: TCheckBox
;
22 cbShowSize
: TCheckBox
;
39 sPreviewColor
: TShape
;
44 // Количество недавно открытых:
48 LabelLanguage
: TLabel
;
49 rbRussian
: TRadioButton
;
50 rbEnglish
: TRadioButton
;
51 LabelGridSize
: TLabel
;
54 procedure bGridClick(Sender
: TObject
);
55 procedure FormActivate(Sender
: TObject
);
56 procedure bOKClick(Sender
: TObject
);
57 procedure bCancelClick(Sender
: TObject
);
58 procedure bBackClick(Sender
: TObject
);
59 procedure bPreviewClick(Sender
: TObject
);
62 { Private declarations }
64 { Public declarations }
68 OptionsForm
: TOptionsForm
;
70 procedure RegisterFileType(ext
: String; FileName
: String);
75 f_main
, StdConvs
, CONFIG
, g_language
;
79 procedure RegisterFileType(ext
: String; FileName
: String);
84 reg
:= TRegistry
.Create();
88 RootKey
:= HKEY_CLASSES_ROOT
;
89 OpenKey('.'+ext
,True);
90 WriteString('',ext
+'file');
92 CreateKey(ext
+'file');
93 OpenKey(ext
+'file\DefaultIcon',True);
94 WriteString('',FileName
+',0');
96 OpenKey(ext
+'file\shell\open\command',True);
97 WriteString('',FileName
+' "%1"');
103 procedure TOptionsForm
.bGridClick(Sender
: TObject
);
105 if ColorDialog
.Execute
then
106 sDotColor
.Brush
.Color
:= ColorDialog
.Color
;
109 procedure TOptionsForm
.FormActivate(Sender
: TObject
);
111 sDotColor
.Brush
.Color
:= DotColor
;
112 cbShowDots
.Checked
:= DotEnable
;
113 cbShowTexture
.Checked
:= DrawTexturePanel
;
114 cbShowSize
.Checked
:= DrawPanelSize
;
115 eDotStepOne
.Text := IntToStr(DotStepOne
);
116 eDotStepTwo
.Text := IntToStr(DotStepTwo
);
117 sBackColor
.Brush
.Color
:= BackColor
;
118 sPreviewColor
.Brush
.Color
:= PreviewColor
;
119 cbCheckerboard
.Checked
:= UseCheckerboard
;
121 cbScale
.ItemIndex
:= 1
123 cbScale
.ItemIndex
:= 0;
125 cbDotSize
.ItemIndex
:= 1
127 cbDotSize
.ItemIndex
:= 0;
128 eRecent
.Text := IntToStr(RecentCount
);
131 if gLanguage
= LANGUAGE_RUSSIAN
then
133 rbRussian
.Checked
:= True;
134 rbEnglish
.Checked
:= False;
138 rbRussian
.Checked
:= False;
139 rbEnglish
.Checked
:= True;
143 procedure TOptionsForm
.bOKClick(Sender
: TObject
);
151 re
:= StrToIntDef(eRecent
.Text, 5);
157 if rbRussian
.Checked
then
158 str
:= LANGUAGE_RUSSIAN
160 str
:= LANGUAGE_ENGLISH
;
162 // Нужно сменить язык:
163 if gLanguage
<> str
then
166 //e_WriteLog('Read language file', MSG_NOTIFY);
167 //g_Language_Load(EditorDir+'\data\'+gLanguage+LANGUAGE_FILE_NAME);
168 g_Language_Set(gLanguage
);
171 DotColor
:= sDotColor
.Brush
.Color
;
172 DotEnable
:= cbShowDots
.Checked
;
174 if DotStep
= DotStepOne
then
178 DotStepOne
:= StrToIntDef(eDotStepOne
.Text, 16);
179 DotStepTwo
:= StrToIntDef(eDotStepTwo
.Text, 8);
181 DotStep
:= DotStepOne
183 DotStep
:= DotStepTwo
;
185 DrawTexturePanel
:= cbShowTexture
.Checked
;
186 DrawPanelSize
:= cbShowSize
.Checked
;
187 BackColor
:= sBackColor
.Brush
.Color
;
188 PreviewColor
:= sPreviewColor
.Brush
.Color
;
189 UseCheckerboard
:= cbCheckerboard
.Checked
;
191 if cbScale
.ItemIndex
= 1 then
196 if cbDotSize
.ItemIndex
= 1 then
201 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
203 config
.WriteInt('Editor', 'DotColor', DotColor
);
204 config
.WriteBool('Editor', 'DotEnable', DotEnable
);
205 config
.WriteInt('Editor', 'DotStepOne', DotStepOne
);
206 config
.WriteInt('Editor', 'DotStepTwo', DotStepTwo
);
207 config
.WriteInt('Editor', 'DotStep', DotStep
);
208 config
.WriteInt('Editor', 'DotSize', cbDotSize
.ItemIndex
);
209 config
.WriteBool('Editor', 'DrawTexturePanel', DrawTexturePanel
);
210 config
.WriteBool('Editor', 'DrawPanelSize', DrawPanelSize
);
211 config
.WriteInt('Editor', 'BackColor', BackColor
);
212 config
.WriteInt('Editor', 'PreviewColor', PreviewColor
);
213 config
.WriteBool('Editor', 'UseCheckerboard', UseCheckerboard
);
214 config
.WriteInt('Editor', 'Scale', cbScale
.ItemIndex
);
215 config
.WriteInt('Editor', 'RecentCount', re
);
216 config
.WriteStr('Editor', 'Language', gLanguage
);
218 if RecentCount
<> re
then
221 MainForm
.RefreshRecentMenu();
224 config
.SaveFile(EditorDir
+'Editor.cfg');
229 procedure TOptionsForm
.bCancelClick(Sender
: TObject
);
234 procedure TOptionsForm
.bBackClick(Sender
: TObject
);
236 if ColorDialog
.Execute
then
237 sBackColor
.Brush
.Color
:= ColorDialog
.Color
;
240 procedure TOptionsForm
.bPreviewClick(Sender
: TObject
);
242 if ColorDialog
.Execute
then
243 sPreviewColor
.Brush
.Color
:= ColorDialog
.Color
;