Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6286 - (show annotations) (download) (as text)
Mon Feb 1 15:14:14 2016 UTC (8 years, 2 months ago) by yutakapon
File MIME type: text/x-csrc
File size: 128436 byte(s)
チケット #35744 VS2015の警告除去

下記ブランチからマージした。
svn+ssh://yutakapon@svn.sourceforge.jp/svnroot/ttssh2/branches/vs2015_warn
リビジョン6194 - 6260

1 /* Tera Term
2 Copyright(C) 1994-1998 T. Teranishi
3 All rights reserved. */
4 /* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */
5
6 /* TTSET.DLL, setup file routines*/
7 #ifndef NO_INET6
8 #include <winsock2.h>
9 #include <ws2tcpip.h>
10 #endif /* NO_INET6 */
11 #include "teraterm.h"
12 #include "tttypes.h"
13 #include <stdio.h>
14 #include <string.h>
15 #include <direct.h>
16 #include <ctype.h>
17 #include <errno.h>
18 #include "ttlib.h"
19 #include "tt_res.h"
20
21 #include "compat_w95.h"
22
23 #ifndef CLEARTYPE_QUALITY
24 #define CLEARTYPE_QUALITY 5
25 #endif
26
27 #define Section "Tera Term"
28
29 #define MaxStrLen (LONG)512
30
31 static PCHAR far TermList[] =
32 { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
33 "VT320", "VT382", "VT420", "VT520", "VT525", NULL };
34
35 static PCHAR far RussList[] =
36 { "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };
37 static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };
38
39 WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)
40 {
41 WORD i;
42 i = 0;
43 while ((List[i] != NULL) && (_stricmp(List[i], str) != 0))
44 i++;
45 if (List[i] == NULL)
46 i = DefId;
47 else
48 i++;
49
50 return i;
51 }
52
53 void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)
54 {
55 int i;
56
57 if (Id == 0)
58 i = DefId - 1;
59 else {
60 i = 0;
61 while ((List[i] != NULL) && (i < Id - 1))
62 i++;
63 if (List[i] == NULL)
64 i = DefId - 1;
65 }
66 strncpy_s(str, destlen, List[i], _TRUNCATE);
67 }
68
69 int IconName2IconId(const char *name) {
70 int id;
71
72 if (_stricmp(name, "tterm") == 0) {
73 id = IDI_TTERM;
74 }
75 else if (_stricmp(name, "vt") == 0) {
76 id = IDI_VT;
77 }
78 else if (_stricmp(name, "tek") == 0) {
79 id = IDI_TEK;
80 }
81 else if (_stricmp(name, "tterm_classic") == 0) {
82 id = IDI_TTERM_CLASSIC;
83 }
84 else if (_stricmp(name, "vt_classic") == 0) {
85 id = IDI_VT_CLASSIC;
86 }
87 else if (_stricmp(name, "cygterm") == 0) {
88 id = IDI_CYGTERM;
89 }
90 else {
91 id = IdIconDefault;
92 }
93 return id;
94 }
95
96 void IconId2IconName(char *name, int len, int id) {
97 char *icon;
98 switch (id) {
99 case IDI_TTERM:
100 icon = "tterm";
101 break;
102 case IDI_VT:
103 icon = "vt";
104 break;
105 case IDI_TEK:
106 icon = "tek";
107 break;
108 case IDI_TTERM_CLASSIC:
109 icon = "tterm_classic";
110 break;
111 case IDI_VT_CLASSIC:
112 icon = "vt_classic";
113 break;
114 case IDI_CYGTERM:
115 icon = "cygterm";
116 break;
117 default:
118 icon = "Default";
119 }
120 strncpy_s(name, len, icon, _TRUNCATE);
121 }
122
123 WORD GetOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, BOOL Default)
124 {
125 char Temp[4];
126 GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
127 if (Default) {
128 if (_stricmp(Temp, "off") == 0)
129 return 0;
130 else
131 return 1;
132 }
133 else {
134 if (_stricmp(Temp, "on") == 0)
135 return 1;
136 else
137 return 0;
138 }
139 }
140
141 void WriteOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, WORD Flag)
142 {
143 char Temp[4];
144
145 if (Flag != 0)
146 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
147 else
148 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
149 WritePrivateProfileString(Sect, Key, Temp, FName);
150 }
151
152 void WriteInt(PCHAR Sect, PCHAR Key, PCHAR FName, int i)
153 {
154 char Temp[15];
155 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
156 WritePrivateProfileString(Sect, Key, Temp, FName);
157 }
158
159 void WriteUint(PCHAR Sect, PCHAR Key, PCHAR FName, UINT i)
160 {
161 char Temp[15];
162 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i);
163 WritePrivateProfileString(Sect, Key, Temp, FName);
164 }
165
166 void WriteInt2(PCHAR Sect, PCHAR Key, PCHAR FName, int i1, int i2)
167 {
168 char Temp[32];
169 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
170 WritePrivateProfileString(Sect, Key, Temp, FName);
171 }
172
173 void WriteInt4(PCHAR Sect, PCHAR Key, PCHAR FName,
174 int i1, int i2, int i3, int i4)
175 {
176 char Temp[64];
177 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d",
178 i1, i2, i3, i4);
179 WritePrivateProfileString(Sect, Key, Temp, FName);
180 }
181
182 void WriteInt6(PCHAR Sect, PCHAR Key, PCHAR FName,
183 int i1, int i2, int i3, int i4, int i5, int i6)
184 {
185 char Temp[96];
186 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d",
187 i1, i2,i3, i4, i5, i6);
188 WritePrivateProfileString(Sect, Key, Temp, FName);
189 }
190
191 void WriteFont(PCHAR Sect, PCHAR Key, PCHAR FName,
192 PCHAR Name, int x, int y, int charset)
193 {
194 char Temp[80];
195 if (Name[0] != 0)
196 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d",
197 Name, x, y, charset);
198 else
199 Temp[0] = 0;
200 WritePrivateProfileString(Sect, Key, Temp, FName);
201 }
202
203
204
205 #define CYGTERM_FILE "cygterm.cfg" // CygTerm configuration file
206 #define CYGTERM_FILE_MAXLINE 100
207
208 static void ReadCygtermConfFile(PTTSet ts)
209 {
210 char *cfgfile = CYGTERM_FILE; // CygTerm configuration file
211 char cfg[MAX_PATH];
212 FILE *fp;
213 char buf[256], *head, *body;
214 cygterm_t settings;
215
216 // try to read CygTerm config file
217 memset(&settings, 0, sizeof(settings));
218 _snprintf_s(settings.term, sizeof(settings.term), _TRUNCATE, "ttermpro.exe %%s %%d /E /KR=SJIS /KT=SJIS /VTICON=CygTerm /nossh");
219 _snprintf_s(settings.term_type, sizeof(settings.term_type), _TRUNCATE, "vt100");
220 _snprintf_s(settings.port_start, sizeof(settings.port_start), _TRUNCATE, "20000");
221 _snprintf_s(settings.port_range, sizeof(settings.port_range), _TRUNCATE, "40");
222 _snprintf_s(settings.shell, sizeof(settings.shell), _TRUNCATE, "auto");
223 _snprintf_s(settings.env1, sizeof(settings.env1), _TRUNCATE, "MAKE_MODE=unix");
224 _snprintf_s(settings.env2, sizeof(settings.env2), _TRUNCATE, "");
225 settings.login_shell = FALSE;
226 settings.home_chdir = FALSE;
227 settings.agent_proxy = FALSE;
228
229 strncpy_s(cfg, sizeof(cfg), ts->HomeDir, _TRUNCATE);
230 AppendSlash(cfg, sizeof(cfg));
231 strncat_s(cfg, sizeof(cfg), cfgfile, _TRUNCATE);
232
233 fp = fopen(cfg, "r");
234 if (fp != NULL) {
235 while (fgets(buf, sizeof(buf), fp) != NULL) {
236 int len = strlen(buf);
237
238 if (buf[len - 1] == '\n')
239 buf[len - 1] = '\0';
240
241 split_buffer(buf, '=', &head, &body);
242 if (head == NULL || body == NULL)
243 continue;
244
245 if (_stricmp(head, "TERM") == 0) {
246 _snprintf_s(settings.term, sizeof(settings.term), _TRUNCATE, "%s", body);
247
248 }
249 else if (_stricmp(head, "TERM_TYPE") == 0) {
250 _snprintf_s(settings.term_type, sizeof(settings.term_type), _TRUNCATE, "%s", body);
251
252 }
253 else if (_stricmp(head, "PORT_START") == 0) {
254 _snprintf_s(settings.port_start, sizeof(settings.port_start), _TRUNCATE, "%s", body);
255
256 }
257 else if (_stricmp(head, "PORT_RANGE") == 0) {
258 _snprintf_s(settings.port_range, sizeof(settings.port_range), _TRUNCATE, "%s", body);
259
260 }
261 else if (_stricmp(head, "SHELL") == 0) {
262 _snprintf_s(settings.shell, sizeof(settings.shell), _TRUNCATE, "%s", body);
263
264 }
265 else if (_stricmp(head, "ENV_1") == 0) {
266 _snprintf_s(settings.env1, sizeof(settings.env1), _TRUNCATE, "%s", body);
267
268 }
269 else if (_stricmp(head, "ENV_2") == 0) {
270 _snprintf_s(settings.env2, sizeof(settings.env2), _TRUNCATE, "%s", body);
271
272 }
273 else if (_stricmp(head, "LOGIN_SHELL") == 0) {
274 if (strchr("YyTt", *body)) {
275 settings.login_shell = TRUE;
276 }
277
278 }
279 else if (_stricmp(head, "HOME_CHDIR") == 0) {
280 if (strchr("YyTt", *body)) {
281 settings.home_chdir = TRUE;
282 }
283
284 }
285 else if (_stricmp(head, "SSH_AGENT_PROXY") == 0) {
286 if (strchr("YyTt", *body)) {
287 settings.agent_proxy = TRUE;
288 }
289
290 }
291 else {
292 // TODO: error check
293
294 }
295 }
296 fclose(fp);
297 }
298
299 memcpy(&ts->CygtermSettings, &settings, sizeof(cygterm_t));
300 }
301
302 static void WriteCygtermConfFile(PTTSet ts)
303 {
304 char *cfgfile = CYGTERM_FILE; // CygTerm configuration file
305 char *tmpfile = "cygterm.tmp";
306 char cfg[MAX_PATH];
307 char tmp[MAX_PATH];
308 FILE *fp;
309 FILE *tmp_fp;
310 char buf[256], *head, *body;
311 char uimsg[MAX_UIMSG];
312 cygterm_t settings;
313 char *line[CYGTERM_FILE_MAXLINE];
314 int i, linenum, len;
315
316 // Cygwin���������X�������������������A�t�@�C�����������������B
317 if (ts->CygtermSettings.update_flag == FALSE)
318 return;
319 // �t���O���������ASave setup�����x�����x�������������������������B
320 ts->CygtermSettings.update_flag = FALSE;
321
322 memcpy(&settings, &ts->CygtermSettings, sizeof(cygterm_t));
323
324 strncpy_s(cfg, sizeof(cfg), ts->HomeDir, _TRUNCATE);
325 AppendSlash(cfg, sizeof(cfg));
326 strncat_s(cfg, sizeof(cfg), cfgfile, _TRUNCATE);
327
328 strncpy_s(tmp, sizeof(tmp), ts->HomeDir, _TRUNCATE);
329 AppendSlash(tmp, sizeof(tmp));
330 strncat_s(tmp, sizeof(tmp), tmpfile, _TRUNCATE);
331
332 // cygterm.cfg �������������A�������������������������������B
333 memset(line, 0, sizeof(line));
334 linenum = 0;
335 fp = fopen(cfg, "r");
336 if (fp) {
337 i = 0;
338 while (fgets(buf, sizeof(buf), fp) != NULL) {
339 len = strlen(buf);
340 if (buf[len - 1] == '\n')
341 buf[len - 1] = '\0';
342 if (i < CYGTERM_FILE_MAXLINE)
343 line[i++] = _strdup(buf);
344 else
345 break;
346 }
347 linenum = i;
348 fclose(fp);
349 }
350
351 tmp_fp = fopen(cfg, "w");
352 if (tmp_fp == NULL) {
353 get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
354 get_lang_msg("MSG_CYGTERM_CONF_WRITEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
355 "Can't write CygTerm configuration file (%d).", ts->UILanguageFile);
356 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
357 MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
358 }
359 else {
360 if (linenum > 0) {
361 for (i = 0; i < linenum; i++) {
362 split_buffer(line[i], '=', &head, &body);
363 if (head == NULL || body == NULL) {
364 fprintf(tmp_fp, "%s\n", line[i]);
365 }
366 else if (_stricmp(head, "TERM") == 0) {
367 fprintf(tmp_fp, "TERM = %s\n", settings.term);
368 settings.term[0] = '\0';
369 }
370 else if (_stricmp(head, "TERM_TYPE") == 0) {
371 fprintf(tmp_fp, "TERM_TYPE = %s\n", settings.term_type);
372 settings.term_type[0] = '\0';
373 }
374 else if (_stricmp(head, "PORT_START") == 0) {
375 fprintf(tmp_fp, "PORT_START = %s\n", settings.port_start);
376 settings.port_start[0] = '\0';
377 }
378 else if (_stricmp(head, "PORT_RANGE") == 0) {
379 fprintf(tmp_fp, "PORT_RANGE = %s\n", settings.port_range);
380 settings.port_range[0] = '\0';
381 }
382 else if (_stricmp(head, "SHELL") == 0) {
383 fprintf(tmp_fp, "SHELL = %s\n", settings.shell);
384 settings.shell[0] = '\0';
385 }
386 else if (_stricmp(head, "ENV_1") == 0) {
387 fprintf(tmp_fp, "ENV_1 = %s\n", settings.env1);
388 settings.env1[0] = '\0';
389 }
390 else if (_stricmp(head, "ENV_2") == 0) {
391 fprintf(tmp_fp, "ENV_2 = %s\n", settings.env2);
392 settings.env2[0] = '\0';
393 }
394 else if (_stricmp(head, "LOGIN_SHELL") == 0) {
395 fprintf(tmp_fp, "LOGIN_SHELL = %s\n", (settings.login_shell == TRUE) ? "yes" : "no");
396 settings.login_shell = FALSE;
397 }
398 else if (_stricmp(head, "HOME_CHDIR") == 0) {
399 fprintf(tmp_fp, "HOME_CHDIR = %s\n", (settings.home_chdir == TRUE) ? "yes" : "no");
400 settings.home_chdir = FALSE;
401 }
402 else if (_stricmp(head, "SSH_AGENT_PROXY") == 0) {
403 fprintf(tmp_fp, "SSH_AGENT_PROXY = %s\n", (settings.agent_proxy == TRUE) ? "yes" : "no");
404 settings.agent_proxy = FALSE;
405 }
406 else {
407 fprintf(tmp_fp, "%s = %s\n", head, body);
408 }
409 }
410 }
411 else {
412 fputs("# CygTerm setting\n", tmp_fp);
413 fputs("\n", tmp_fp);
414 }
415 if (settings.term[0] != '\0') {
416 fprintf(tmp_fp, "TERM = %s\n", settings.term);
417 }
418 if (settings.term_type[0] != '\0') {
419 fprintf(tmp_fp, "TERM_TYPE = %s\n", settings.term_type);
420 }
421 if (settings.port_start[0] != '\0') {
422 fprintf(tmp_fp, "PORT_START = %s\n", settings.port_start);
423 }
424 if (settings.port_range[0] != '\0') {
425 fprintf(tmp_fp, "PORT_RANGE = %s\n", settings.port_range);
426 }
427 if (settings.shell[0] != '\0') {
428 fprintf(tmp_fp, "SHELL = %s\n", settings.shell);
429 }
430 if (settings.env1[0] != '\0') {
431 fprintf(tmp_fp, "ENV_1 = %s\n", settings.env1);
432 }
433 if (settings.env2[0] != '\0') {
434 fprintf(tmp_fp, "ENV_2 = %s\n", settings.env2);
435 }
436 if (settings.login_shell) {
437 fprintf(tmp_fp, "LOGIN_SHELL = yes\n");
438 }
439 if (settings.home_chdir) {
440 fprintf(tmp_fp, "HOME_CHDIR = yes\n");
441 }
442 if (settings.agent_proxy) {
443 fprintf(tmp_fp, "SSH_AGENT_PROXY = yes\n");
444 }
445 fclose(tmp_fp);
446
447 // �_�C���N�g���t�@�C���������������������������A���L�������s�v�B
448 #if 0
449 if (remove(cfg) != 0 && errno != ENOENT) {
450 get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
451 get_lang_msg("MSG_CYGTERM_CONF_REMOVEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
452 "Can't remove old CygTerm configuration file (%d).", ts->UILanguageFile);
453 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
454 MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
455 }
456 else if (rename(tmp, cfg) != 0) {
457 get_lang_msg("MSG_ERROR", uimsg, sizeof(uimsg), "ERROR", ts->UILanguageFile);
458 get_lang_msg("MSG_CYGTERM_CONF_RENAMEFILE_ERROR", ts->UIMsg, sizeof(ts->UIMsg),
459 "Can't rename CygTerm configuration file (%d).", ts->UILanguageFile);
460 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, GetLastError());
461 MessageBox(NULL, buf, uimsg, MB_ICONEXCLAMATION);
462 }
463 else {
464 // cygterm.cfg �t�@�C�����������������������A���b�Z�[�W�_�C�A���O���\�������B
465 // �������ASave setup�����s�����K�v�������������������N�����B
466 // (2012.5.1 yutaka)
467 // Save setup ���s�����ACygTerm�������������������������������������A
468 // �_�C�A���O�\�����s�v�����������A���������B
469 // (2015.11.12 yutaka)
470 get_lang_msg("MSG_TT_NOTICE", uimsg, sizeof(uimsg), "MSG_TT_NOTICE", ts->UILanguageFile);
471 get_lang_msg("MSG_CYGTERM_CONF_SAVED_NOTICE", ts->UIMsg, sizeof(ts->UIMsg),
472 "%s has been saved. Do not do save setup.", ts->UILanguageFile);
473 _snprintf_s(buf, sizeof(buf), _TRUNCATE, ts->UIMsg, CYGTERM_FILE);
474 MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONINFORMATION);
475 }
476 #endif
477 }
478
479 // �Y�������������t���[���������B
480 for (i = 0; i < linenum; i++) {
481 free(line[i]);
482 }
483
484 }
485
486 void FAR PASCAL ReadIniFile(PCHAR FName, PTTSet ts)
487 {
488 int i;
489 HDC TmpDC;
490 char Temp[MAX_PATH], Temp2[MAX_PATH];
491
492 ts->Minimize = 0;
493 ts->HideWindow = 0;
494 ts->LogFlag = 0; // Log flags
495 ts->FTFlag = 0; // File transfer flags
496 ts->MenuFlag = 0; // Menu flags
497 ts->TermFlag = 0; // Terminal flag
498 ts->ColorFlag = 0; // ANSI/Attribute color flags
499 ts->FontFlag = 0; // Font flag
500 ts->PortFlag = 0; // Port flags
501 ts->WindowFlag = 0; // Window flags
502 ts->CtrlFlag = 0; // Control sequence flags
503 ts->TelPort = 23;
504
505 ts->DisableTCPEchoCR = FALSE;
506
507 /* Version number */
508 /* GetPrivateProfileString(Section,"Version","",
509 Temp,sizeof(Temp),FName); */
510
511 /* Language */
512 GetPrivateProfileString(Section, "Language", "",
513 Temp, sizeof(Temp), FName);
514 if (_stricmp(Temp, "Japanese") == 0)
515 ts->Language = IdJapanese;
516 else if (_stricmp(Temp, "Russian") == 0)
517 ts->Language = IdRussian;
518 else if (_stricmp(Temp, "English") == 0)
519 ts->Language = IdEnglish;
520 else if (_stricmp(Temp,"Korean") == 0) // HKS
521 ts->Language = IdKorean;
522 else if (_stricmp(Temp,"UTF-8") == 0)
523 ts->Language = IdUtf8;
524 else {
525 switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
526 case LANG_JAPANESE:
527 ts->Language = IdJapanese;
528 break;
529 case LANG_RUSSIAN:
530 ts->Language = IdRussian;
531 break;
532 case LANG_KOREAN: // HKS
533 ts->Language = IdKorean;
534 break;
535 default:
536 ts->Language = IdEnglish;
537 }
538 }
539
540 /* Port type */
541 GetPrivateProfileString(Section, "Port", "",
542 Temp, sizeof(Temp), FName);
543 if (_stricmp(Temp, "tcpip") == 0)
544 ts->PortType = IdTCPIP;
545 else if (_stricmp(Temp, "serial") == 0)
546 ts->PortType = IdSerial;
547 else if (_stricmp(Temp, "namedpipe") == 0)
548 ts->PortType = IdNamedPipe;
549 else {
550 ts->PortType = IdTCPIP;
551 }
552
553 /* VT win position */
554 GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
555 GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
556 GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
557
558 /* TEK win position */
559 GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
560 GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
561 GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
562
563 /* Save VT Window position */
564 ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
565
566 /* VT terminal size */
567 GetPrivateProfileString(Section, "TerminalSize", "80,24",
568 Temp, sizeof(Temp), FName);
569 GetNthNum(Temp, 1, &ts->TerminalWidth);
570 GetNthNum(Temp, 2, &ts->TerminalHeight);
571 if (ts->TerminalWidth < 0)
572 ts->TerminalWidth = 1;
573 if (ts->TerminalHeight < 0)
574 ts->TerminalHeight = 1;
575
576 /* Terminal size = Window size */
577 ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
578
579 /* Auto window resize flag */
580 ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
581
582 /* CR Receive */
583 GetPrivateProfileString(Section, "CRReceive", "",
584 Temp, sizeof(Temp), FName);
585 if (_stricmp(Temp, "CRLF") == 0) {
586 ts->CRReceive = IdCRLF;
587 }
588 else if (_stricmp(Temp, "LF") == 0) {
589 ts->CRReceive = IdLF;
590 }
591 else if (_stricmp(Temp, "AUTO") == 0) {
592 ts->CRReceive = IdAUTO;
593 }
594 else {
595 ts->CRReceive = IdCR;
596 }
597 /* CR Send */
598 GetPrivateProfileString(Section, "CRSend", "",
599 Temp, sizeof(Temp), FName);
600 if (_stricmp(Temp, "CRLF") == 0)
601 ts->CRSend = IdCRLF;
602 else
603 ts->CRSend = IdCR;
604 ts->CRSend_ini = ts->CRSend;
605
606 /* Local echo */
607 ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
608 ts->LocalEcho_ini = ts->LocalEcho;
609
610 /* Answerback */
611 GetPrivateProfileString(Section, "Answerback", "", Temp,
612 sizeof(Temp), FName);
613 ts->AnswerbackLen =
614 Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
615
616 /* Kanji Code (receive) */
617 GetPrivateProfileString(Section, "KanjiReceive", "",
618 Temp, sizeof(Temp), FName);
619 if (_stricmp(Temp, "EUC") == 0)
620 ts->KanjiCode = IdEUC;
621 else if (_stricmp(Temp, "JIS") == 0)
622 ts->KanjiCode = IdJIS;
623 else if (_stricmp(Temp, "UTF-8") == 0)
624 ts->KanjiCode = IdUTF8;
625 else if (_stricmp(Temp, "UTF-8m") == 0)
626 ts->KanjiCode = IdUTF8m;
627 else if (_stricmp(Temp, "KS5601") == 0)
628 ts->KanjiCode = IdSJIS;
629 else
630 ts->KanjiCode = IdSJIS;
631 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
632 {
633 WORD KanjiCode = ts->KanjiCode;
634 ts->KanjiCode = KanjiCodeTranslate(ts->Language,KanjiCode);
635 }
636
637 /* Katakana (receive) */
638 GetPrivateProfileString(Section, "KatakanaReceive", "",
639 Temp, sizeof(Temp), FName);
640 if (_stricmp(Temp, "7") == 0)
641 ts->JIS7Katakana = 1;
642 else
643 ts->JIS7Katakana = 0;
644
645 /* Kanji Code (transmit) */
646 GetPrivateProfileString(Section, "KanjiSend", "",
647 Temp, sizeof(Temp), FName);
648 if (_stricmp(Temp, "EUC") == 0)
649 ts->KanjiCodeSend = IdEUC;
650 else if (_stricmp(Temp, "JIS") == 0)
651 ts->KanjiCodeSend = IdJIS;
652 else if (_stricmp(Temp, "UTF-8") == 0)
653 ts->KanjiCodeSend = IdUTF8;
654 else if (_stricmp(Temp, "KS5601") == 0)
655 ts->KanjiCode = IdSJIS;
656 else
657 ts->KanjiCodeSend = IdSJIS;
658 // KanjiCode/KanjiCodeSend �������� Language �����������l���u��������
659 {
660 WORD KanjiCodeSend = ts->KanjiCodeSend;
661 ts->KanjiCodeSend = KanjiCodeTranslate(ts->Language,KanjiCodeSend);
662 }
663
664 /* Katakana (receive) */
665 GetPrivateProfileString(Section, "KatakanaSend", "",
666 Temp, sizeof(Temp), FName);
667 if (_stricmp(Temp, "7") == 0)
668 ts->JIS7KatakanaSend = 1;
669 else
670 ts->JIS7KatakanaSend = 0;
671
672 /* KanjiIn */
673 GetPrivateProfileString(Section, "KanjiIn", "",
674 Temp, sizeof(Temp), FName);
675 if (_stricmp(Temp, "@") == 0)
676 ts->KanjiIn = IdKanjiInA;
677 else
678 ts->KanjiIn = IdKanjiInB;
679
680 /* KanjiOut */
681 GetPrivateProfileString(Section, "KanjiOut", "",
682 Temp, sizeof(Temp), FName);
683 if (_stricmp(Temp, "B") == 0)
684 ts->KanjiOut = IdKanjiOutB;
685 else if (_stricmp(Temp, "H") == 0)
686 ts->KanjiOut = IdKanjiOutH;
687 else
688 ts->KanjiOut = IdKanjiOutJ;
689
690 /* Auto Win Switch VT<->TEK */
691 ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
692
693 /* Terminal ID */
694 GetPrivateProfileString(Section, "TerminalID", "",
695 Temp, sizeof(Temp), FName);
696 ts->TerminalID = str2id(TermList, Temp, IdVT100);
697
698 /* Russian character set (host) */
699 GetPrivateProfileString(Section, "RussHost", "",
700 Temp, sizeof(Temp), FName);
701 ts->RussHost = str2id(RussList, Temp, IdKOI8);
702
703 /* Russian character set (client) */
704 GetPrivateProfileString(Section, "RussClient", "",
705 Temp, sizeof(Temp), FName);
706 ts->RussClient = str2id(RussList, Temp, IdWindows);
707
708 /* Title String */
709 GetPrivateProfileString(Section, "Title", "Tera Term",
710 ts->Title, sizeof(ts->Title), FName);
711
712 /* Cursor shape */
713 GetPrivateProfileString(Section, "CursorShape", "",
714 Temp, sizeof(Temp), FName);
715 if (_stricmp(Temp, "vertical") == 0)
716 ts->CursorShape = IdVCur;
717 else if (_stricmp(Temp, "horizontal") == 0)
718 ts->CursorShape = IdHCur;
719 else
720 ts->CursorShape = IdBlkCur;
721
722 /* Hide title */
723 ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
724
725 /* Popup menu */
726 ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
727
728 /* PC-Style bold color mapping */
729 if (GetOnOff(Section, "PcBoldColor", FName, FALSE))
730 ts->ColorFlag |= CF_PCBOLD16;
731
732 /* aixterm style 16 colors mode */
733 if (GetOnOff(Section, "Aixterm16Color", FName, FALSE))
734 ts->ColorFlag |= CF_AIXTERM16;
735
736 /* xterm style 256 colors mode */
737 if (GetOnOff(Section, "Xterm256Color", FName, TRUE))
738 ts->ColorFlag |= CF_XTERM256;
739
740 /* Enable scroll buffer */
741 ts->EnableScrollBuff =
742 GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
743
744 /* Scroll buffer size */
745 ts->ScrollBuffSize =
746 GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
747
748 /* VT Color */
749 GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
750 Temp, sizeof(Temp), FName);
751 for (i = 0; i <= 5; i++)
752 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
753 for (i = 0; i <= 1; i++)
754 ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
755 (BYTE) ts->TmpColor[0][i * 3 + 1],
756 (BYTE) ts->TmpColor[0][i * 3 + 2]);
757
758 /* VT Bold Color */
759 GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
760 Temp, sizeof(Temp), FName);
761 for (i = 0; i <= 5; i++)
762 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
763 for (i = 0; i <= 1; i++)
764 ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
765 (BYTE) ts->TmpColor[0][i * 3 + 1],
766 (BYTE) ts->TmpColor[0][i * 3 + 2]);
767 if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE))
768 ts->ColorFlag |= CF_BOLDCOLOR;
769
770 /* VT Blink Color */
771 GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
772 Temp, sizeof(Temp), FName);
773 for (i = 0; i <= 5; i++)
774 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
775 for (i = 0; i <= 1; i++)
776 ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
777 (BYTE) ts->TmpColor[0][i * 3 + 1],
778 (BYTE) ts->TmpColor[0][i * 3 + 2]);
779 if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE))
780 ts->ColorFlag |= CF_BLINKCOLOR;
781
782 /* VT Reverse Color */
783 GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
784 Temp, sizeof(Temp), FName);
785 for (i = 0; i <= 5; i++)
786 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
787 for (i = 0; i <= 1; i++)
788 ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
789 (BYTE) ts->TmpColor[0][i * 3 + 1],
790 (BYTE) ts->TmpColor[0][i * 3 + 2]);
791 if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE))
792 ts->ColorFlag |= CF_REVERSECOLOR;
793
794 ts->EnableClickableUrl =
795 GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
796
797 /* URL Color */
798 GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
799 Temp, sizeof(Temp), FName);
800 for (i = 0; i <= 5; i++)
801 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
802 for (i = 0; i <= 1; i++)
803 ts->URLColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
804 (BYTE) ts->TmpColor[0][i * 3 + 1],
805 (BYTE) ts->TmpColor[0][i * 3 + 2]);
806 if (GetOnOff(Section, "EnableURLColor", FName, TRUE))
807 ts->ColorFlag |= CF_URLCOLOR;
808
809 if (GetOnOff(Section, "URLUnderline", FName, TRUE))
810 ts->FontFlag |= FF_URLUNDERLINE;
811
812 /* TEK Color */
813 GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
814 Temp, sizeof(Temp), FName);
815 for (i = 0; i <= 5; i++)
816 GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
817 for (i = 0; i <= 1; i++)
818 ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
819 (BYTE) ts->TmpColor[0][i * 3 + 1],
820 (BYTE) ts->TmpColor[0][i * 3 + 2]);
821
822 /* ANSI color definition (in the case FullColor=on) -- special option
823 o UseTextColor should be off, or the background and foreground color of
824 VTColor are assigned to color-number 0 and 7 respectively, even if
825 they are specified in ANSIColor.
826 o ANSIColor is a set of 4 values that are color-number(0--15),
827 red-value(0--255), green-value(0--255) and blue-value(0--255). */
828 GetPrivateProfileString(Section, "ANSIColor",
829 " 0, 0, 0, 0,"
830 " 1,255, 0, 0,"
831 " 2, 0,255, 0,"
832 " 3,255,255, 0,"
833 " 4, 0, 0,255,"
834 " 5,255, 0,255,"
835 " 6, 0,255,255,"
836 " 7,255,255,255,"
837 " 8,128,128,128,"
838 " 9,128, 0, 0,"
839 "10, 0,128, 0,"
840 "11,128,128, 0,"
841 "12, 0, 0,128,"
842 "13,128, 0,128,"
843 "14, 0,128,128,"
844 "15,192,192,192", Temp, sizeof(Temp), FName);
845 {
846 char *t;
847 int n = 1;
848 for (t = Temp; *t; t++)
849 if (*t == ',')
850 n++;
851 n /= 4;
852 for (i = 0; i < n; i++) {
853 int colorid, r, g, b;
854 GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
855 GetNthNum(Temp, i * 4 + 2, (int far *) &r);
856 GetNthNum(Temp, i * 4 + 3, (int far *) &g);
857 GetNthNum(Temp, i * 4 + 4, (int far *) &b);
858 ts->ANSIColor[colorid & 15] =
859 RGB((BYTE) r, (BYTE) g, (BYTE) b);
860 }
861 }
862
863 TmpDC = GetDC(0); /* Get screen device context */
864 for (i = 0; i <= 1; i++)
865 ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
866 for (i = 0; i <= 1; i++)
867 ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
868 for (i = 0; i <= 1; i++)
869 ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
870 for (i = 0; i <= 1; i++)
871 ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
872 /* begin - ishizaki */
873 for (i = 0; i <= 1; i++)
874 ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
875 /* end - ishizaki */
876 for (i = 0; i < 16; i++)
877 ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
878 ReleaseDC(0, TmpDC);
879 if (GetOnOff(Section, "EnableANSIColor", FName, TRUE))
880 ts->ColorFlag |= CF_ANSICOLOR;
881
882 /* TEK color emulation */
883 ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
884
885 /* VT Font */
886 GetPrivateProfileString(Section, "VTFont", "Terminal,0,-13,1",
887 Temp, sizeof(Temp), FName);
888 GetNthString(Temp, 1, sizeof(ts->VTFont), ts->VTFont);
889 GetNthNum(Temp, 2, (int far *) &(ts->VTFontSize.x));
890 GetNthNum(Temp, 3, (int far *) &(ts->VTFontSize.y));
891 GetNthNum(Temp, 4, &(ts->VTFontCharSet));
892
893 /* Bold font flag */
894 if (GetOnOff(Section, "EnableBold", FName, TRUE))
895 ts->FontFlag |= FF_BOLD;
896
897 /* Russian character set (font) */
898 GetPrivateProfileString(Section, "RussFont", "",
899 Temp, sizeof(Temp), FName);
900 ts->RussFont = str2id(RussList, Temp, IdWindows);
901
902 /* TEK Font */
903 GetPrivateProfileString(Section, "TEKFont", "Courier,0,-13,0",
904 Temp, sizeof(Temp), FName);
905 GetNthString(Temp, 1, sizeof(ts->TEKFont), ts->TEKFont);
906 GetNthNum(Temp, 2, (int far *) &(ts->TEKFontSize.x));
907 GetNthNum(Temp, 3, (int far *) &(ts->TEKFontSize.y));
908 GetNthNum(Temp, 4, &(ts->TEKFontCharSet));
909
910 /* BS key */
911 GetPrivateProfileString(Section, "BSKey", "",
912 Temp, sizeof(Temp), FName);
913 if (_stricmp(Temp, "DEL") == 0)
914 ts->BSKey = IdDEL;
915 else
916 ts->BSKey = IdBS;
917 /* Delete key */
918 ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
919
920 /* Meta Key */
921 GetPrivateProfileString(Section, "MetaKey", "off", Temp, sizeof(Temp), FName);
922 if (_stricmp(Temp, "on") == 0)
923 ts->MetaKey = IdMetaOn;
924 else if (_stricmp(Temp, "left") == 0)
925 ts->MetaKey = IdMetaLeft;
926 else if (_stricmp(Temp, "right") == 0)
927 ts->MetaKey = IdMetaRight;
928 else
929 ts->MetaKey = IdMetaOff;
930
931 // Windows95 �n�����E�� Alt ��������������
932 if (!IsWindowsNTKernel() && ts->MetaKey != IdMetaOff) {
933 ts->MetaKey = IdMetaOn;
934 }
935
936 /* Application Keypad */
937 ts->DisableAppKeypad =
938 GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
939
940 /* Application Cursor */
941 ts->DisableAppCursor =
942 GetOnOff(Section, "DisableAppCursor", FName, FALSE);
943
944 /* Russian keyboard type */
945 GetPrivateProfileString(Section, "RussKeyb", "",
946 Temp, sizeof(Temp), FName);
947 ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
948
949 /* Serial port ID */
950 ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
951
952 /* Baud rate */
953 ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName);
954
955 /* Parity */
956 GetPrivateProfileString(Section, "Parity", "",
957 Temp, sizeof(Temp), FName);
958 if (_stricmp(Temp, "even") == 0)
959 ts->Parity = IdParityEven;
960 else if (_stricmp(Temp, "odd") == 0)
961 ts->Parity = IdParityOdd;
962 else if (_stricmp(Temp, "mark") == 0)
963 ts->Parity = IdParityMark;
964 else if (_stricmp(Temp, "space") == 0)
965 ts->Parity = IdParitySpace;
966 else
967 ts->Parity = IdParityNone;
968
969 /* Data bit */
970 GetPrivateProfileString(Section, "DataBit", "",
971 Temp, sizeof(Temp), FName);
972 if (_stricmp(Temp, "7") == 0)
973 ts->DataBit = IdDataBit7;
974 else
975 ts->DataBit = IdDataBit8;
976
977 /* Stop bit */
978 GetPrivateProfileString(Section, "StopBit", "",
979 Temp, sizeof(Temp), FName);
980 if (_stricmp(Temp, "2") == 0)
981 ts->StopBit = IdStopBit2;
982 else if (_stricmp(Temp, "1.5") == 0)
983 ts->StopBit = IdStopBit15;
984 else
985 ts->StopBit = IdStopBit1;
986
987 /* Flow control */
988 GetPrivateProfileString(Section, "FlowCtrl", "",
989 Temp, sizeof(Temp), FName);
990 if (_stricmp(Temp, "x") == 0)
991 ts->Flow = IdFlowX;
992 else if (_stricmp(Temp, "hard") == 0)
993 ts->Flow = IdFlowHard;
994 else
995 ts->Flow = IdFlowNone;
996
997 /* Delay per character */
998 ts->DelayPerChar =
999 GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
1000
1001 /* Delay per line */
1002 ts->DelayPerLine =
1003 GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
1004
1005 /* Telnet flag */
1006 ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
1007
1008 /* Telnet terminal type */
1009 GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
1010 sizeof(ts->TermType), FName);
1011
1012 /* TCP port num */
1013 ts->TCPPort =
1014 GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
1015
1016 /* Auto window close flag */
1017 ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
1018
1019 /* History list */
1020 ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
1021
1022 /* File transfer binary flag */
1023 ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
1024
1025 /* Log binary flag */
1026 ts->LogBinary = GetOnOff(Section, "LogBinary", FName, FALSE);
1027
1028 /* Log append */
1029 ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
1030
1031 /* Log plain text (2005.5.7 yutaka) */
1032 ts->LogTypePlainText =
1033 GetOnOff(Section, "LogTypePlainText", FName, FALSE);
1034
1035 /* Log with timestamp (2006.7.23 maya) */
1036 ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
1037
1038 /* Log without transfer dialog */
1039 ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
1040
1041 ts->LogAllBuffIncludedInFirst = GetOnOff(Section, "LogIncludeScreenBuffer", FName, FALSE);
1042
1043 /* File Transfer dialog visibility */
1044 ts->FTHideDialog = GetOnOff(Section, "FTHideDialog", FName, FALSE);
1045
1046 /* Default Log file name (2006.8.28 maya) */
1047 GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
1048 ts->LogDefaultName, sizeof(ts->LogDefaultName),
1049 FName);
1050
1051 /* Default Log file path (2007.5.30 maya) */
1052 GetPrivateProfileString(Section, "LogDefaultPath", "",
1053 ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
1054 FName);
1055
1056 /* Auto start logging (2007.5.31 maya) */
1057 ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
1058
1059 /* Log Rotate (2013.3.24 yutaka) */
1060 ts->LogRotate = GetPrivateProfileInt(Section, "LogRotate", 0, FName);
1061 ts->LogRotateSize = GetPrivateProfileInt(Section, "LogRotateSize", 0, FName);
1062 ts->LogRotateSizeType = GetPrivateProfileInt(Section, "LogRotateSizeType", 0, FName);
1063 ts->LogRotateStep = GetPrivateProfileInt(Section, "LogRotateStep", 0, FName);
1064
1065 /* Deferred Log Write Mode (2013.4.20 yutaka) */
1066 ts->DeferredLogWriteMode = GetOnOff(Section, "DeferredLogWriteMode", FName, TRUE);
1067
1068
1069 /* XMODEM option */
1070 GetPrivateProfileString(Section, "XmodemOpt", "",
1071 Temp, sizeof(Temp), FName);
1072 if (_stricmp(Temp, "crc") == 0)
1073 ts->XmodemOpt = XoptCRC;
1074 else if (_stricmp(Temp, "1k") == 0)
1075 ts->XmodemOpt = Xopt1kCRC;
1076 else
1077 ts->XmodemOpt = XoptCheck;
1078
1079 /* XMODEM binary file */
1080 ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
1081
1082 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1083 GetPrivateProfileString(Section, "XModemRcvCommand", "",
1084 ts->XModemRcvCommand,
1085 sizeof(ts->XModemRcvCommand), FName);
1086
1087 /* Default directory for file transfer */
1088 GetPrivateProfileString(Section, "FileDir", "",
1089 ts->FileDir, sizeof(ts->FileDir), FName);
1090 if (strlen(ts->FileDir) == 0)
1091 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
1092 else {
1093 _getcwd(Temp, sizeof(Temp));
1094 if (_chdir(ts->FileDir) != 0)
1095 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
1096 _chdir(Temp);
1097 }
1098
1099 /* filter on file send (2007.6.5 maya) */
1100 GetPrivateProfileString(Section, "FileSendFilter", "",
1101 ts->FileSendFilter, sizeof(ts->FileSendFilter),
1102 FName);
1103
1104 /* SCP���M���p�X (2012.4.6 yutaka) */
1105 GetPrivateProfileString(Section, "ScpSendDir", "~/",
1106 ts->ScpSendDir, sizeof(ts->ScpSendDir), FName);
1107
1108
1109 /*--------------------------------------------------*/
1110 /* 8 bit control code flag -- special option */
1111 if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
1112 ts->TermFlag |= TF_ACCEPT8BITCTRL;
1113
1114 /* Wrong sequence flag -- special option */
1115 if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
1116 ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
1117
1118 if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
1119 (ts->KanjiOut == IdKanjiOutH))
1120 ts->KanjiOut = IdKanjiOutJ;
1121
1122 // Detect disconnect/reconnect of serial port --- special option
1123 ts->AutoComPortReconnect = GetOnOff(Section, "AutoComPortReconnect", FName, TRUE);
1124
1125 // Auto file renaming --- special option
1126 if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
1127 ts->FTFlag |= FT_RENAME;
1128
1129 // Auto invoking (character set->G0->GL) --- special option
1130 if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
1131 ts->TermFlag |= TF_AUTOINVOKE;
1132
1133 // Auto text copy --- special option
1134 ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
1135
1136 /* Back wrap -- special option */
1137 if (GetOnOff(Section, "BackWrap", FName, FALSE))
1138 ts->TermFlag |= TF_BACKWRAP;
1139
1140 /* Beep type -- special option */
1141 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
1142 if (_stricmp(Temp, "off") == 0)
1143 ts->Beep = IdBeepOff;
1144 else if (_stricmp(Temp, "visual") == 0)
1145 ts->Beep = IdBeepVisual;
1146 else
1147 ts->Beep = IdBeepOn;
1148
1149 /* Beep on connection & disconnection -- special option */
1150 if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
1151 ts->PortFlag |= PF_BEEPONCONNECT;
1152
1153 /* Auto B-Plus activation -- special option */
1154 if (GetOnOff(Section, "BPAuto", FName, FALSE))
1155 ts->FTFlag |= FT_BPAUTO;
1156 if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
1157 strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
1158 _TRUNCATE);
1159 ts->AnswerbackLen = 5;
1160 }
1161
1162 /* B-Plus ESCCTL flag -- special option */
1163 if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
1164 ts->FTFlag |= FT_BPESCCTL;
1165
1166 /* B-Plus log -- special option */
1167 if (GetOnOff(Section, "BPLog", FName, FALSE))
1168 ts->LogFlag |= LOG_BP;
1169
1170 /* Clear serial port buffer when port opening -- special option */
1171 ts->ClearComBuffOnOpen =
1172 GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
1173
1174 /* Confirm disconnection -- special option */
1175 if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
1176 ts->PortFlag |= PF_CONFIRMDISCONN;
1177
1178 /* Ctrl code in Kanji -- special option */
1179 if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
1180 ts->TermFlag |= TF_CTRLINKANJI;
1181
1182 /* Debug flag -- special option */
1183 ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
1184
1185 /* Delimiter list -- special option */
1186 GetPrivateProfileString(Section, "DelimList",
1187 "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
1188 Temp, sizeof(Temp), FName);
1189 Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
1190
1191 /* regard DBCS characters as delimiters -- special option */
1192 ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
1193
1194 // Enable popup menu -- special option
1195 if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
1196 ts->MenuFlag |= MF_NOPOPUP;
1197
1198 // Enable "Show menu" -- special option
1199 if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
1200 ts->MenuFlag |= MF_NOSHOWMENU;
1201
1202 // Enable the status line -- special option
1203 if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
1204 ts->TermFlag |= TF_ENABLESLINE;
1205
1206 // Enable multiple bytes send -- special option
1207 ts->FileSendHighSpeedMode = GetOnOff(Section, "FileSendHighSpeedMode", FName, TRUE);
1208
1209 // fixed JIS --- special
1210 if (GetOnOff(Section, "FixedJIS", FName, FALSE))
1211 ts->TermFlag |= TF_FIXEDJIS;
1212
1213 /* IME Flag -- special option */
1214 ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
1215
1216 /* IME-inline Flag -- special option */
1217 ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
1218
1219 /* Kermit log -- special option */
1220 if (GetOnOff(Section, "KmtLog", FName, FALSE))
1221 ts->LogFlag |= LOG_KMT;
1222 if (GetOnOff(Section, "KmtLongPacket", FName, FALSE))
1223 ts->KermitOpt |= KmtOptLongPacket;
1224 if (GetOnOff(Section, "KmtFileAttr", FName, FALSE))
1225 ts->KermitOpt |= KmtOptFileAttr;
1226
1227 // Enable language selection -- special option
1228 if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
1229 ts->MenuFlag |= MF_NOLANGUAGE;
1230
1231 /* Maximum scroll buffer size -- special option */
1232 ts->ScrollBuffMax =
1233 GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
1234 if (ts->ScrollBuffMax < 24)
1235 ts->ScrollBuffMax = 10000;
1236
1237 /* Max com port number -- special option */
1238 ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 4, FName);
1239 if (ts->MaxComPort < 4)
1240 ts->MaxComPort = 4;
1241 // COM16����99���g�� (2005.11.30 yutaka)
1242 // 99����200���g�� (2007.7.23 maya)
1243 if (ts->MaxComPort > MAXCOMPORT)
1244 ts->MaxComPort = MAXCOMPORT;
1245 if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
1246 ts->ComPort = 1;
1247
1248 /* Non-blinking cursor -- special option */
1249 ts->NonblinkingCursor =
1250 GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
1251
1252 // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
1253 ts->KillFocusCursor =
1254 GetOnOff(Section, "KillFocusCursor", FName, TRUE);
1255
1256 /* Delay for pass-thru printing activation */
1257 /* -- special option */
1258 ts->PassThruDelay =
1259 GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
1260
1261 /* Printer port for pass-thru printing */
1262 /* -- special option */
1263 GetPrivateProfileString(Section, "PassThruPort", "",
1264 ts->PrnDev, sizeof(ts->PrnDev), FName);
1265
1266 /* �v�����^�p�����R�[�h�������t������ */
1267 if (GetOnOff(Section, "PrinterCtrlSequence", FName, TRUE))
1268 ts->TermFlag |= TF_PRINTERCTRL;
1269
1270 /* Printer Font --- special option */
1271 GetPrivateProfileString(Section, "PrnFont", "",
1272 Temp, sizeof(Temp), FName);
1273 if (strlen(Temp) == 0) {
1274 ts->PrnFont[0] = 0;
1275 ts->PrnFontSize.x = 0;
1276 ts->PrnFontSize.y = 0;
1277 ts->PrnFontCharSet = 0;
1278 }
1279 else {
1280 GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
1281 GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
1282 GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
1283 GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
1284 }
1285
1286 // Page margins (left, right, top, bottom) for printing
1287 // -- special option
1288 GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
1289 Temp, sizeof(Temp), FName);
1290 for (i = 0; i <= 3; i++)
1291 GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
1292
1293 /* Quick-VAN log -- special option */
1294 if (GetOnOff(Section, "QVLog", FName, FALSE))
1295 ts->LogFlag |= LOG_QV;
1296
1297 /* Quick-VAN window size -- special */
1298 ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
1299
1300 /* Russian character set (print) -- special option */
1301 GetPrivateProfileString(Section, "RussPrint", "",
1302 Temp, sizeof(Temp), FName);
1303 ts->RussPrint = str2id(RussList, Temp, IdWindows);
1304
1305 /* Scroll threshold -- special option */
1306 ts->ScrollThreshold =
1307 GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
1308
1309 ts->MouseWheelScrollLine =
1310 GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
1311
1312 // Select on activate -- special option
1313 ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
1314
1315 /* Send 8bit control sequence -- special option */
1316 ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
1317
1318 /* SendBreak time (in msec) -- special option */
1319 ts->SendBreakTime =
1320 GetPrivateProfileInt(Section, "SendBreakTime", 1000, FName);
1321
1322 /* Startup macro -- special option */
1323 GetPrivateProfileString(Section, "StartupMacro", "",
1324 ts->MacroFN, sizeof(ts->MacroFN), FName);
1325
1326 /* TEK GIN Mouse keycode -- special option */
1327 ts->GINMouseCode =
1328 GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
1329
1330 /* Telnet Auto Detect -- special option */
1331 ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
1332
1333 /* Telnet binary flag -- special option */
1334 ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
1335
1336 /* Telnet Echo flag -- special option */
1337 ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
1338
1339 /* Telnet log -- special option */
1340 if (GetOnOff(Section, "TelLog", FName, FALSE))
1341 ts->LogFlag |= LOG_TEL;
1342
1343 /* TCP port num for telnet -- special option */
1344 ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
1345
1346 /* Telnet keep-alive packet(NOP command) interval -- special option */
1347 ts->TelKeepAliveInterval =
1348 GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
1349
1350 /* Max number of broadcast commad history */
1351 ts->MaxBroadcatHistory =
1352 GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
1353
1354 /* Local echo for non-telnet */
1355 ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
1356
1357 /* "new-line (transmit)" option for non-telnet -- special option */
1358 GetPrivateProfileString(Section, "TCPCRSend", "",
1359 Temp, sizeof(Temp), FName);
1360 if (_stricmp(Temp, "CR") == 0)
1361 ts->TCPCRSend = IdCR;
1362 else if (_stricmp(Temp, "CRLF") == 0)
1363 ts->TCPCRSend = IdCRLF;
1364 else
1365 ts->TCPCRSend = 0; // disabled
1366
1367 /* Use text (background) color for "white (black)" --- special option */
1368 if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1369 ts->ColorFlag |= CF_USETEXTCOLOR;
1370
1371 /* Title format -- special option */
1372 ts->TitleFormat =
1373 GetPrivateProfileInt(Section, "TitleFormat", 13, FName);
1374
1375 /* VT Compatible Tab -- special option */
1376 ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1377
1378 /* VT Font space --- special option */
1379 GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1380 Temp, sizeof(Temp), FName);
1381 GetNthNum(Temp, 1, &ts->FontDX);
1382 GetNthNum(Temp, 2, &ts->FontDW);
1383 GetNthNum(Temp, 3, &ts->FontDY);
1384 GetNthNum(Temp, 4, &ts->FontDH);
1385 if (ts->FontDX < 0)
1386 ts->FontDX = 0;
1387 if (ts->FontDW < 0)
1388 ts->FontDW = 0;
1389 ts->FontDW = ts->FontDW + ts->FontDX;
1390 if (ts->FontDY < 0)
1391 ts->FontDY = 0;
1392 if (ts->FontDH < 0)
1393 ts->FontDH = 0;
1394 ts->FontDH = ts->FontDH + ts->FontDY;
1395
1396 // VT-print scaling factors (pixels per inch) --- special option
1397 GetPrivateProfileString(Section, "VTPPI", "0,0",
1398 Temp, sizeof(Temp), FName);
1399 GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1400 GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1401
1402 // TEK-print scaling factors (pixels per inch) --- special option
1403 GetPrivateProfileString(Section, "TEKPPI", "0,0",
1404 Temp, sizeof(Temp), FName);
1405 GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1406 GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1407
1408 // Show "Window" menu -- special option
1409 if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1410 ts->MenuFlag |= MF_SHOWWINMENU;
1411
1412 /* XMODEM log -- special option */
1413 if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1414 ts->LogFlag |= LOG_X;
1415
1416 /* YMODEM log -- special option */
1417 if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1418 ts->LogFlag |= LOG_Y;
1419
1420 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
1421 GetPrivateProfileString(Section, "YModemRcvCommand", "rb",
1422 ts->YModemRcvCommand, sizeof(ts->YModemRcvCommand), FName);
1423
1424 /* Auto ZMODEM activation -- special option */
1425 if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1426 ts->FTFlag |= FT_ZAUTO;
1427
1428 /* ZMODEM data subpacket length for sending -- special */
1429 ts->ZmodemDataLen =
1430 GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1431 /* ZMODEM window size for sending -- special */
1432 ts->ZmodemWinSize =
1433 GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1434
1435 /* ZMODEM ESCCTL flag -- special option */
1436 if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1437 ts->FTFlag |= FT_ZESCCTL;
1438
1439 /* ZMODEM log -- special option */
1440 if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1441 ts->LogFlag |= LOG_Z;
1442
1443 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1444 GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1445 ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1446
1447 #ifndef NO_COPYLINE_FIX
1448
1449 /* Enable continued-line copy -- special option */
1450 ts->EnableContinuedLineCopy =
1451 GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1452 #endif /* NO_COPYLINE_FIX */
1453
1454 ts->DisablePasteMouseRButton =
1455 GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE);
1456
1457 // added DisablePasteMouseMButton (2008.3.2 maya)
1458 ts->DisablePasteMouseMButton =
1459 GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE);
1460
1461 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1462 ts->ConfirmPasteMouseRButton =
1463 GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE);
1464
1465 // added ConfirmChangePaste (2008.2.3 yutaka)
1466 ts->ConfirmChangePaste =
1467 GetOnOff(Section, "ConfirmChangePaste", FName, TRUE);
1468 GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "",
1469 Temp, sizeof(Temp), FName);
1470 strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp,
1471 _TRUNCATE);
1472
1473 // added ScrollWindowClearScreen (2008.5.3 yutaka)
1474 ts->ScrollWindowClearScreen =
1475 GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1476
1477 // added SelectOnlyByLButton (2007.11.20 maya)
1478 ts->SelectOnlyByLButton =
1479 GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1480
1481 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1482 ts->DisableAcceleratorSendBreak =
1483 GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1484
1485 // WinSock connecting timeout value (2007.1.11 yutaka)
1486 ts->ConnectingTimeout =
1487 GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1488
1489 // mouse cursor
1490 GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1491 Temp, sizeof(Temp), FName);
1492 strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1493 _TRUNCATE);
1494
1495 // Translucent window
1496 ts->AlphaBlend =
1497 GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
1498 ts->AlphaBlend = max(0, ts->AlphaBlend);
1499 ts->AlphaBlend = min(255, ts->AlphaBlend);
1500
1501 // Cygwin install path
1502 GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1503 Temp, sizeof(Temp), FName);
1504 strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1505 _TRUNCATE);
1506
1507 // Viewlog Editor path
1508 if (GetWindowsDirectory(Temp, sizeof(Temp)) + 13 < sizeof(Temp)) { // "\\notepad.exe"(12) + NUL(1)
1509 strncat_s(Temp, sizeof(Temp), "\\notepad.exe", _TRUNCATE);
1510 }
1511 else {
1512 Temp[0] = '\0';
1513 }
1514 GetPrivateProfileString(Section, "ViewlogEditor ", Temp,
1515 ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName);
1516
1517 // Locale for UTF-8
1518 GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1519 Temp, sizeof(Temp), FName);
1520 strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1521
1522 // CodePage
1523 ts->CodePage =
1524 GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
1525 FName);
1526
1527 // UI language message file
1528 GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1529 Temp, sizeof(Temp), FName);
1530 {
1531 char CurDir[MAX_PATH];
1532
1533 // �t���p�X�������O������������������������������
1534 strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1535
1536 GetCurrentDirectory(sizeof(CurDir), CurDir);
1537 SetCurrentDirectory(ts->HomeDir);
1538 _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1539 SetCurrentDirectory(CurDir);
1540 }
1541
1542 // Broadcast Command History (2007.3.3 maya)
1543 ts->BroadcastCommandHistory =
1544 GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1545
1546 // 337: 2007/03/20 Accept Broadcast
1547 ts->AcceptBroadcast =
1548 GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1549
1550 // Confirm send a file when drag and drop (2007.12.28 maya)
1551 ts->ConfirmFileDragAndDrop =
1552 GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1553
1554 // Translate mouse wheel to cursor key when application cursor mode
1555 ts->TranslateWheelToCursor =
1556 GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1557
1558 // Display "New Connection" dialog on startup (2008.1.18 maya)
1559 ts->HostDialogOnStartup =
1560 GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1561
1562 // Mouse event tracking
1563 ts->MouseEventTracking =
1564 GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1565
1566 // Maximized bug tweak
1567 ts->MaximizedBugTweak =
1568 GetOnOff(Section, "MaximizedBugTweak", FName, TRUE);
1569
1570 // Convert Unicode symbol characters to DEC Special characters
1571 ts->UnicodeDecSpMapping =
1572 GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1573
1574 // VT Window Icon
1575 GetPrivateProfileString(Section, "VTIcon", "Default",
1576 Temp, sizeof(Temp), FName);
1577 ts->VTIcon = IconName2IconId(Temp);
1578
1579 // Tek Window Icon
1580 GetPrivateProfileString(Section, "TEKIcon", "Default",
1581 Temp, sizeof(Temp), FName);
1582 ts->TEKIcon = IconName2IconId(Temp);
1583
1584 // Unknown Unicode Character
1585 ts->UnknownUnicodeCharaAsWide =
1586 GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1587
1588 #ifdef USE_NORMAL_BGCOLOR
1589 // UseNormalBGColor
1590 ts->UseNormalBGColor =
1591 GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1592 // 2006/03/11 by 337
1593 if (ts->UseNormalBGColor) {
1594 ts->VTBoldColor[1] =
1595 ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1596 }
1597 #endif
1598
1599 // AutoScrollOnlyInBottomLine
1600 ts->AutoScrollOnlyInBottomLine =
1601 GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1602
1603 // Accept remote-controlled window title changing
1604 GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1605 Temp, sizeof(Temp), FName);
1606 if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1607 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1608 else if (_stricmp(Temp, "ahead") == 0)
1609 ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1610 else if (_stricmp(Temp, "last") == 0)
1611 ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1612 else
1613 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1614
1615 // Size of paste confirm dialog
1616 GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1617 Temp, sizeof(Temp), FName);
1618 GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1619 GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1620 if (ts->PasteDialogSize.cx < 0)
1621 ts->PasteDialogSize.cx = 330;
1622 if (ts->PasteDialogSize.cy < 0)
1623 ts->PasteDialogSize.cy = 220;
1624
1625 // Disable mouse event tracking when Control-Key is pressed.
1626 ts->DisableMouseTrackingByCtrl =
1627 GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1628
1629 // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1630 ts->DisableWheelToCursorByCtrl =
1631 GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1632
1633 // Strict Key Mapping.
1634 ts->StrictKeyMapping =
1635 GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1636
1637 // added Wait4allMacroCommand (2009.3.23 yutaka)
1638 ts->Wait4allMacroCommand =
1639 GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1640
1641 // added DisableMenuSendBreak (2009.4.6 maya)
1642 ts->DisableMenuSendBreak =
1643 GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE);
1644
1645 // added ClearScreenOnCloseConnection (2009.4.6 maya)
1646 ts->ClearScreenOnCloseConnection =
1647 GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE);
1648
1649 // added DisableAcceleratorDuplicateSession (2009.4.6 maya)
1650 ts->DisableAcceleratorDuplicateSession =
1651 GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE);
1652
1653 ts->AcceleratorNewConnection =
1654 GetOnOff(Section, "AcceleratorNewConnection", FName, TRUE);
1655
1656 ts->AcceleratorCygwinConnection =
1657 GetOnOff(Section, "AcceleratorCygwinConnection", FName, TRUE);
1658
1659 // added DisableMenuDuplicateSession (2010.8.3 maya)
1660 ts->DisableMenuDuplicateSession =
1661 GetOnOff(Section, "DisableMenuDuplicateSession", FName, FALSE);
1662
1663 // added DisableMenuNewConnection (2010.8.4 maya)
1664 ts->DisableMenuNewConnection =
1665 GetOnOff(Section, "DisableMenuNewConnection", FName, FALSE);
1666
1667 // added PasteDelayPerLine (2009.4.12 maya)
1668 ts->PasteDelayPerLine =
1669 GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName);
1670 {
1671 int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
1672 ts->PasteDelayPerLine = tmp;
1673 }
1674
1675 // Font scaling -- test
1676 ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
1677
1678 // Meta sets MSB
1679 GetPrivateProfileString(Section, "Meta8Bit", "off", Temp, sizeof(Temp), FName);
1680 if (_stricmp(Temp, "raw") == 0 || _stricmp(Temp, "on") == 0)
1681 ts->Meta8Bit = IdMeta8BitRaw;
1682 else if (_stricmp(Temp, "text") == 0)
1683 ts->Meta8Bit = IdMeta8BitText;
1684 else
1685 ts->Meta8Bit = IdMeta8BitOff;
1686
1687 // Window control sequence
1688 if (GetOnOff(Section, "WindowCtrlSequence", FName, TRUE))
1689 ts->WindowFlag |= WF_WINDOWCHANGE;
1690
1691 // Cursor control sequence
1692 if (GetOnOff(Section, "CursorCtrlSequence", FName, FALSE))
1693 ts->WindowFlag |= WF_CURSORCHANGE;
1694
1695 // Window report sequence
1696 if (GetOnOff(Section, "WindowReportSequence", FName, TRUE))
1697 ts->WindowFlag |= WF_WINDOWREPORT;
1698
1699 // Title report sequence
1700 GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName);
1701 if (_stricmp(Temp, "accept") == 0)
1702 ts->WindowFlag |= IdTitleReportAccept;
1703 else if (_stricmp(Temp, "ignore") == 0 || _stricmp(Temp, "off") == 0)
1704 ts->WindowFlag &= ~WF_TITLEREPORT;
1705 else // empty
1706 ts->WindowFlag |= IdTitleReportEmpty;
1707
1708 // Line at a time mode
1709 ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE);
1710
1711 // Clear window on resize
1712 if (GetOnOff(Section, "ClearOnResize", FName, TRUE))
1713 ts->TermFlag |= TF_CLEARONRESIZE;
1714
1715 // Alternate Screen Buffer
1716 if (GetOnOff(Section, "AlternateScreenBuffer", FName, TRUE))
1717 ts->TermFlag |= TF_ALTSCR;
1718
1719 // IME status related cursor style
1720 if (GetOnOff(Section, "IMERelatedCursor", FName, FALSE))
1721 ts->WindowFlag |= WF_IMECURSORCHANGE;
1722
1723 // Terminal Unique ID
1724 GetPrivateProfileString(Section, "TerminalUID", "FFFFFFFF", Temp, sizeof(Temp), FName);
1725 if (strlen(Temp) == 8) {
1726 for (i=0; i<8 && isxdigit((unsigned char)Temp[i]); i++) {
1727 if (islower(Temp[i])) {
1728 ts->TerminalUID[i] = toupper(Temp[i]);
1729 }
1730 else {
1731 ts->TerminalUID[i] = Temp[i];
1732 }
1733 }
1734 if (i == 8) {
1735 ts->TerminalUID[i] = 0;
1736 }
1737 else {
1738 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1739 }
1740 }
1741 else {
1742 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1743 }
1744
1745 // Lock Terminal UID
1746 if (GetOnOff(Section, "LockTUID", FName, TRUE))
1747 ts->TermFlag |= TF_LOCKTUID;
1748
1749 // Confirm PasteCR
1750 ts->ConfirmChangePasteCR = GetOnOff(Section, "ConfirmChangePasteCR", FName, TRUE);
1751
1752 // Jump List
1753 ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE);
1754
1755 // TabStopModifySequence
1756 GetPrivateProfileString(Section, "TabStopModifySequence", "on", Temp, sizeof(Temp), FName);
1757 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
1758 ts->TabStopFlag = TABF_ALL;
1759 else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0)
1760 ts->TabStopFlag = TABF_NONE;
1761 else {
1762 ts->TabStopFlag = TABF_NONE;
1763 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1764 if (_stricmp(Temp2, "HTS") == 0)
1765 ts->TabStopFlag |= TABF_HTS;
1766 else if (_stricmp(Temp2, "HTS7") == 0)
1767 ts->TabStopFlag |= TABF_HTS7;
1768 else if (_stricmp(Temp2, "HTS8") == 0)
1769 ts->TabStopFlag |= TABF_HTS8;
1770 else if (_stricmp(Temp2, "TBC") == 0)
1771 ts->TabStopFlag |= TABF_TBC;
1772 else if (_stricmp(Temp2, "TBC0") == 0)
1773 ts->TabStopFlag |= TABF_TBC0;
1774 else if (_stricmp(Temp2, "TBC3") == 0)
1775 ts->TabStopFlag |= TABF_TBC3;
1776 }
1777 }
1778
1779 // Clipboard Access from Remote
1780 GetPrivateProfileString(Section, "ClipboardAccessFromRemote", "off", Temp, sizeof(Temp), FName);
1781 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "readwrite") == 0)
1782 ts->CtrlFlag |= CSF_CBRW;
1783 else if (_stricmp(Temp, "read") == 0)
1784 ts->CtrlFlag |= CSF_CBREAD;
1785 else if (_stricmp(Temp, "write") == 0)
1786 ts->CtrlFlag |= CSF_CBWRITE;
1787
1788 // Use invalid DECRPSS (for testing)
1789 if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
1790 ts->TermFlag |= TF_INVALIDDECRPSS;
1791
1792 // ClickableUrlBrowser
1793 GetPrivateProfileString(Section, "ClickableUrlBrowser", "",
1794 ts->ClickableUrlBrowser, sizeof(ts->ClickableUrlBrowser), FName);
1795 GetPrivateProfileString(Section, "ClickableUrlBrowserArg", "",
1796 ts->ClickableUrlBrowserArg, sizeof(ts->ClickableUrlBrowserArg), FName);
1797
1798 // Exclusive Lock when open the log file
1799 ts->LogLockExclusive = GetOnOff(Section, "LogLockExclusive", FName, TRUE);
1800
1801 // Font quality
1802 GetPrivateProfileString(Section, "FontQuality", "default",
1803 Temp, sizeof(Temp), FName);
1804 if (_stricmp(Temp, "nonantialiased") == 0)
1805 ts->FontQuality = NONANTIALIASED_QUALITY;
1806 else if (_stricmp(Temp, "antialiased") == 0)
1807 ts->FontQuality = ANTIALIASED_QUALITY;
1808 else if (_stricmp(Temp, "cleartype") == 0)
1809 ts->FontQuality = CLEARTYPE_QUALITY;
1810 else
1811 ts->FontQuality = DEFAULT_QUALITY;
1812
1813 // Beep Over Used
1814 ts->BeepOverUsedCount =
1815 GetPrivateProfileInt(Section, "BeepOverUsedCount", 5, FName);
1816 ts->BeepOverUsedTime =
1817 GetPrivateProfileInt(Section, "BeepOverUsedTime", 2, FName);
1818 ts->BeepSuppressTime =
1819 GetPrivateProfileInt(Section, "BeepSuppressTime", 5, FName);
1820
1821 // Max OSC string buffer size
1822 ts->MaxOSCBufferSize =
1823 GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName);
1824
1825 ts->JoinSplitURL = GetOnOff(Section, "JoinSplitURL", FName, FALSE);
1826
1827 GetPrivateProfileString(Section, "JoinSplitURLIgnoreEOLChar", "\\", Temp, sizeof(Temp), FName);
1828 ts->JoinSplitURLIgnoreEOLChar = Temp[0];
1829
1830 // Debug modes.
1831 GetPrivateProfileString(Section, "DebugModes", "all", Temp, sizeof(Temp), FName);
1832 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
1833 ts->DebugModes = DBGF_ALL;
1834 else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0) {
1835 ts->DebugModes = DBGF_NONE;
1836 ts->Debug = FALSE;
1837 }
1838 else {
1839 ts->DebugModes = DBGF_NONE;
1840 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1841 if (_stricmp(Temp2, "normal") == 0)
1842 ts->DebugModes |= DBGF_NORM;
1843 else if (_stricmp(Temp2, "hex") == 0)
1844 ts->DebugModes |= DBGF_HEXD;
1845 else if (_stricmp(Temp2, "noout") == 0)
1846 ts->DebugModes |= DBGF_NOUT;
1847 }
1848 if (ts->DebugModes == DBGF_NONE)
1849 ts->Debug = FALSE;
1850 }
1851
1852 // CygTerm Configuration File
1853 ReadCygtermConfFile(ts);
1854 }
1855
1856 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1857 {
1858 int i;
1859 char Temp[MAX_PATH];
1860 char buf[20];
1861 int ret;
1862 char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG];
1863
1864 /* version */
1865 ret = WritePrivateProfileString(Section, "Version", "2.3", FName);
1866 if (ret == 0) {
1867 // ini�t�@�C�����������������s�������A�G���[���b�Z�[�W���\�������B(2012.10.18 yutaka)
1868 ret = GetLastError();
1869 get_lang_msg("MSG_INI_WRITE_ERROR", uimsg, sizeof(uimsg), "Cannot write ini file", ts->UILanguageFile);
1870 _snprintf_s(msg, sizeof(msg), _TRUNCATE, "%s (%d)", uimsg, ret);
1871
1872 get_lang_msg("MSG_INI_ERROR", uimsg2, sizeof(uimsg2), "Tera Term: Error", ts->UILanguageFile);
1873
1874 MessageBox(NULL, msg, uimsg2, MB_ICONEXCLAMATION);
1875 }
1876
1877 /* Language */
1878 switch (ts->Language) {
1879 case IdJapanese:
1880 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1881 break;
1882 case IdKorean:
1883 strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1884 break;
1885 case IdRussian:
1886 strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1887 break;
1888 case IdUtf8:
1889 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1890 break;
1891 default:
1892 strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1893 }
1894
1895 WritePrivateProfileString(Section, "Language", Temp, FName);
1896
1897 /* Port type */
1898 if (ts->PortType == IdSerial)
1899 strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1900 else if (ts->PortType == IdNamedPipe)
1901 strncpy_s(Temp, sizeof(Temp), "namedpipe", _TRUNCATE);
1902 else /* IdFile -> IdTCPIP */
1903 strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1904
1905 WritePrivateProfileString(Section, "Port", Temp, FName);
1906
1907 /* Save win position */
1908 if (ts->SaveVTWinPos) {
1909 /* VT win position */
1910 WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1911 }
1912
1913 /* VT terminal size */
1914 WriteInt2(Section, "TerminalSize", FName,
1915 ts->TerminalWidth, ts->TerminalHeight);
1916
1917 /* Terminal size = Window size */
1918 WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1919
1920 /* Auto window resize flag */
1921 WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1922
1923 /* CR Receive */
1924 if (ts->CRReceive == IdCRLF) {
1925 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1926 }
1927 else if (ts->CRReceive == IdLF) {
1928 strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1929 }
1930 else if (ts->CRReceive == IdAUTO) {
1931 strncpy_s(Temp, sizeof(Temp), "AUTO", _TRUNCATE);
1932 }
1933 else {
1934 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1935 }
1936 WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1937
1938 /* CR Send */
1939 if (ts->CRSend == IdCRLF)
1940 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1941 else
1942 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1943 WritePrivateProfileString(Section, "CRSend", Temp, FName);
1944
1945 /* Local echo */
1946 WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1947
1948 /* Answerback */
1949 if ((ts->FTFlag & FT_BPAUTO) == 0) {
1950 Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1951 sizeof(Temp) - 1, TRUE);
1952 WritePrivateProfileString(Section, "Answerback", Temp, FName);
1953 }
1954
1955 /* Kanji Code (receive) */
1956 switch (ts->KanjiCode) {
1957 case IdEUC:
1958 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1959 break;
1960 case IdJIS:
1961 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1962 break;
1963 case IdUTF8:
1964 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1965 break;
1966 case IdUTF8m:
1967 strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1968 break;
1969 default:
1970 switch (ts->Language) {
1971 case IdJapanese:
1972 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1973 break;
1974 case IdKorean:
1975 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1976 break;
1977 default:
1978 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1979 }
1980 }
1981 WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1982
1983 /* Katakana (receive) */
1984 if (ts->JIS7Katakana == 1)
1985 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1986 else
1987 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1988
1989 WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1990
1991 /* Kanji Code (transmit) */
1992 switch (ts->KanjiCodeSend) {
1993 case IdEUC:
1994 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1995 break;
1996 case IdJIS:
1997 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1998 break;
1999 case IdUTF8:
2000 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
2001 break;
2002 default:
2003 switch (ts->Language) {
2004 case IdJapanese:
2005 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
2006 break;
2007 case IdKorean:
2008 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
2009 break;
2010 default:
2011 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
2012 }
2013 }
2014 WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
2015
2016 /* Katakana (transmit) */
2017 if (ts->JIS7KatakanaSend == 1)
2018 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
2019 else
2020 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
2021
2022 WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
2023
2024 /* KanjiIn */
2025 if (ts->KanjiIn == IdKanjiInA)
2026 strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
2027 else
2028 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
2029
2030 WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
2031
2032 /* KanjiOut */
2033 switch (ts->KanjiOut) {
2034 case IdKanjiOutB:
2035 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
2036 break;
2037 case IdKanjiOutH:
2038 strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
2039 break;
2040 default:
2041 strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
2042 }
2043 WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
2044
2045 // new configuration
2046 WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
2047
2048 WriteOnOff(Section, "DisablePasteMouseRButton", FName,
2049 ts->DisablePasteMouseRButton);
2050
2051 // added DisablePasteMouseMButton (2008.3.2 maya)
2052 WriteOnOff(Section, "DisablePasteMouseMButton", FName,
2053 ts->DisablePasteMouseMButton);
2054
2055 // added ConfirmPasteMouseRButton (2007.3.17 maya)
2056 WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
2057 ts->ConfirmPasteMouseRButton);
2058
2059 // added ConfirmChangePaste
2060 WriteOnOff(Section, "ConfirmChangePaste", FName,
2061 ts->ConfirmChangePaste);
2062 WritePrivateProfileString(Section, "ConfirmChangePasteStringFile",
2063 ts->ConfirmChangePasteStringFile, FName);
2064
2065 // added ScrollWindowClearScreen
2066 WriteOnOff(Section, "ScrollWindowClearScreen", FName,
2067 ts->ScrollWindowClearScreen);
2068
2069 // added SelectOnlyByLButton (2007.11.20 maya)
2070 WriteOnOff(Section, "SelectOnlyByLButton", FName,
2071 ts->SelectOnlyByLButton);
2072 // added DisableAcceleratorSendBreak (2007.3.17 maya)
2073 WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
2074 ts->DisableAcceleratorSendBreak);
2075 WriteOnOff(Section, "EnableContinuedLineCopy", FName,
2076 ts->EnableContinuedLineCopy);
2077 WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
2078 FName);
2079 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
2080 WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
2081 WritePrivateProfileString(Section, "CygwinDirectory",
2082 ts->CygwinDirectory, FName);
2083 WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
2084 FName);
2085 WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
2086 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
2087 WritePrivateProfileString(Section, "CodePage", Temp, FName);
2088
2089 // ANSI color(2004.9.5 yutaka)
2090 Temp[0] = '\0';
2091 for (i = 0; i < 15; i++) {
2092 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
2093 i,
2094 GetRValue(ts->ANSIColor[i]),
2095 GetGValue(ts->ANSIColor[i]),
2096 GetBValue(ts->ANSIColor[i])
2097 );
2098 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
2099 }
2100 i = 15;
2101 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
2102 i,
2103 GetRValue(ts->ANSIColor[i]),
2104 GetGValue(ts->ANSIColor[i]),
2105 GetBValue(ts->ANSIColor[i])
2106 );
2107 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
2108 WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
2109
2110 /* AutoWinChange VT<->TEK */
2111 WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
2112
2113 /* Terminal ID */
2114 id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
2115 WritePrivateProfileString(Section, "TerminalID", Temp, FName);
2116
2117 /* Russian character set (host) */
2118 id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
2119 WritePrivateProfileString(Section, "RussHost", Temp, FName);
2120
2121 /* Russian character set (client) */
2122 id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
2123 WritePrivateProfileString(Section, "RussClient", Temp, FName);
2124
2125 /* Title text */
2126 WritePrivateProfileString(Section, "Title", ts->Title, FName);
2127
2128 /* Cursor shape */
2129 switch (ts->CursorShape) {
2130 case IdVCur:
2131 strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
2132 break;
2133 case IdHCur:
2134 strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
2135 break;
2136 default:
2137 strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
2138 }
2139 WritePrivateProfileString(Section, "CursorShape", Temp, FName);
2140
2141 /* Hide title */
2142 WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
2143
2144 /* Popup menu */
2145 WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
2146
2147 /* PC-Style bold color mapping */
2148 WriteOnOff(Section, "PcBoldColor", FName,
2149 (WORD) (ts->ColorFlag & CF_PCBOLD16));
2150
2151 /* aixterm 16 colors mode */
2152 WriteOnOff(Section, "Aixterm16Color", FName,
2153 (WORD) (ts->ColorFlag & CF_AIXTERM16));
2154
2155 /* xterm 256 colors mode */
2156 WriteOnOff(Section, "Xterm256Color", FName,
2157 (WORD) (ts->ColorFlag & CF_XTERM256));
2158
2159 /* Enable scroll buffer */
2160 WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
2161
2162 /* Scroll buffer size */
2163 WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
2164
2165 /* VT Color */
2166 for (i = 0; i <= 1; i++) {
2167 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2168 if (ts->ColorFlag & CF_REVERSECOLOR) {
2169 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
2170 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
2171 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
2172 }
2173 else {
2174 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
2175 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
2176 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
2177 }
2178 }
2179 else {
2180 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
2181 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
2182 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
2183 }
2184 }
2185 WriteInt6(Section, "VTColor", FName,
2186 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2187 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2188
2189 /* VT Bold Color */
2190 for (i = 0; i <= 1; i++) {
2191 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2192 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
2193 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
2194 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
2195 }
2196 else {
2197 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
2198 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
2199 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
2200 }
2201 }
2202 WriteInt6(Section, "VTBoldColor", FName,
2203 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2204 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2205
2206 /* VT Blink Color */
2207 for (i = 0; i <= 1; i++) {
2208 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2209 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
2210 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
2211 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
2212 }
2213 else {
2214 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
2215 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
2216 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
2217 }
2218 }
2219 WriteInt6(Section, "VTBlinkColor", FName,
2220 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2221 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2222
2223 /* VT Reverse Color */
2224 for (i = 0; i <= 1; i++) {
2225 if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
2226 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
2227 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
2228 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
2229 }
2230 else {
2231 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
2232 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
2233 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
2234 }
2235 }
2236 WriteInt6(Section, "VTReverseColor", FName,
2237 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2238 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2239
2240 WriteOnOff(Section, "EnableClickableUrl", FName,
2241 ts->EnableClickableUrl);
2242
2243 /* URL color */
2244 for (i = 0; i <= 1; i++) {
2245 if (ts->ColorFlag & CF_REVERSEVIDEO) {
2246 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
2247 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
2248 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
2249 }
2250 else {
2251 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
2252 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
2253 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
2254 }
2255 }
2256 WriteInt6(Section, "URLColor", FName,
2257 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2258 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2259
2260 WriteOnOff(Section, "EnableBoldAttrColor", FName,
2261 (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
2262
2263 WriteOnOff(Section, "EnableBlinkAttrColor", FName,
2264 (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
2265
2266 WriteOnOff(Section, "EnableReverseAttrColor", FName,
2267 (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
2268
2269 WriteOnOff(Section, "EnableURLColor", FName,
2270 (WORD) (ts->ColorFlag & CF_URLCOLOR));
2271
2272 WriteOnOff(Section, "URLUnderline", FName,
2273 (WORD) (ts->FontFlag & FF_URLUNDERLINE));
2274
2275 WriteOnOff(Section, "EnableANSIColor", FName,
2276 (WORD) (ts->ColorFlag & CF_ANSICOLOR));
2277
2278 /* TEK Color */
2279 for (i = 0; i <= 1; i++) {
2280 ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
2281 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
2282 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
2283 }
2284 WriteInt6(Section, "TEKColor", FName,
2285 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
2286 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
2287
2288 /* TEK color emulation */
2289 WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
2290
2291 /* VT Font */
2292 WriteFont(Section, "VTFont", FName,
2293 ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
2294 ts->VTFontCharSet);
2295
2296 /* Enable bold font flag */
2297 WriteOnOff(Section, "EnableBold", FName,
2298 (WORD) (ts->FontFlag & FF_BOLD));
2299
2300 /* Russian character set (font) */
2301 id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
2302 WritePrivateProfileString(Section, "RussFont", Temp, FName);
2303
2304 /* TEK Font */
2305 WriteFont(Section, "TEKFont", FName,
2306 ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
2307 ts->TEKFontCharSet);
2308
2309 /* BS key */
2310 if (ts->BSKey == IdDEL)
2311 strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
2312 else
2313 strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
2314 WritePrivateProfileString(Section, "BSKey", Temp, FName);
2315
2316 /* Delete key */
2317 WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
2318
2319 /* Meta key */
2320 switch (ts->MetaKey) {
2321 case 1:
2322 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
2323 break;
2324 case 2:
2325 strncpy_s(Temp, sizeof(Temp), "left", _TRUNCATE);
2326 break;
2327 case 3:
2328 strncpy_s(Temp, sizeof(Temp), "right", _TRUNCATE);
2329 break;
2330 default:
2331 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2332 }
2333 WritePrivateProfileString(Section, "Metakey", Temp, FName);
2334
2335 /* Application Keypad */
2336 WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
2337
2338 /* Application Cursor */
2339 WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
2340
2341 /* Russian keyboard type */
2342 id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
2343 WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
2344
2345 /* Serial port ID */
2346 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
2347 WritePrivateProfileString(Section, "ComPort", Temp, FName);
2348
2349 /* Baud rate */
2350 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->Baud);
2351 WritePrivateProfileString(Section, "BaudRate", Temp, FName);
2352
2353 /* Parity */
2354 switch (ts->Parity) {
2355 case IdParityEven:
2356 strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
2357 break;
2358 case IdParityOdd:
2359 strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
2360 break;
2361 case IdParityMark:
2362 strncpy_s(Temp, sizeof(Temp), "mark", _TRUNCATE);
2363 break;
2364 case IdParitySpace:
2365 strncpy_s(Temp, sizeof(Temp), "space", _TRUNCATE);
2366 break;
2367 default:
2368 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
2369 }
2370 WritePrivateProfileString(Section, "Parity", Temp, FName);
2371
2372 /* Data bit */
2373 if (ts->DataBit == IdDataBit7)
2374 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
2375 else
2376 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
2377
2378 WritePrivateProfileString(Section, "DataBit", Temp, FName);
2379
2380 /* Stop bit */
2381 switch (ts->StopBit) {
2382 case IdStopBit2:
2383 strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
2384 break;
2385 case IdStopBit15:
2386 strncpy_s(Temp, sizeof(Temp), "1.5", _TRUNCATE);
2387 break;
2388 default:
2389 strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
2390 break;
2391 }
2392
2393 WritePrivateProfileString(Section, "StopBit", Temp, FName);
2394
2395 /* Flow control */
2396 switch (ts->Flow) {
2397 case IdFlowX:
2398 strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
2399 break;
2400 case IdFlowHard:
2401 strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
2402 break;
2403 default:
2404 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
2405 }
2406 WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
2407
2408 /* Delay per character */
2409 WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
2410
2411 /* Delay per line */
2412 WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
2413
2414 /* Telnet flag */
2415 WriteOnOff(Section, "Telnet", FName, ts->Telnet);
2416
2417 /* Telnet terminal type */
2418 WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
2419
2420 /* TCP port num for non-telnet */
2421 WriteUint(Section, "TCPPort", FName, ts->TCPPort);
2422
2423 /* Auto close flag */
2424 WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
2425
2426 /* History list */
2427 WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
2428
2429 /* File transfer binary flag */
2430 WriteOnOff(Section, "TransBin", FName, ts->TransBin);
2431
2432 /* Log binary flag */
2433 WriteOnOff(Section, "LogBinary", FName, ts->LogBinary);
2434
2435 /* Log append */
2436 WriteOnOff(Section, "LogAppend", FName, ts->Append);
2437
2438 /* Log plain text flag */
2439 WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
2440
2441 /* Log with timestamp (2006.7.23 maya) */
2442 WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
2443
2444 /* Log without transfer dialog */
2445 WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
2446
2447 WriteOnOff(Section, "LogIncludeScreenBuffer", FName, ts->LogAllBuffIncludedInFirst);
2448
2449 /* Default Log file name (2006.8.28 maya) */
2450 WritePrivateProfileString(Section, "LogDefaultName",
2451 ts->LogDefaultName, FName);
2452
2453 /* Default Log file path (2007.5.30 maya) */
2454 WritePrivateProfileString(Section, "LogDefaultPath",
2455 ts->LogDefaultPath, FName);
2456
2457 /* Auto start logging (2007.5.31 maya) */
2458 WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
2459
2460 /* Log Rotate (2013.3.24 yutaka) */
2461 WriteInt(Section, "LogRotate", FName, ts->LogRotate);
2462 WriteInt(Section, "LogRotateSize", FName, ts->LogRotateSize);
2463 WriteInt(Section, "LogRotateSizeType", FName, ts->LogRotateSizeType);
2464 WriteInt(Section, "LogRotateStep", FName, ts->LogRotateStep);
2465
2466 /* Deferred Log Write Mode (2013.4.20 yutaka) */
2467 WriteOnOff(Section, "DeferredLogWriteMode", FName, ts->DeferredLogWriteMode);
2468
2469 /* XMODEM option */
2470 switch (ts->XmodemOpt) {
2471 case XoptCRC:
2472 strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
2473 break;
2474 case Xopt1kCRC:
2475 case Xopt1kCksum: /* Checksum/1k �����K���������������A������������ CRC/1k ������ */
2476 strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
2477 break;
2478 default:
2479 strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
2480 }
2481 WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
2482
2483 /* XMODEM binary flag */
2484 WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
2485
2486 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
2487 WritePrivateProfileString(Section, "XmodemRcvCommand",
2488 ts->XModemRcvCommand, FName);
2489
2490 /* Default directory for file transfer */
2491 WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
2492
2493 /* filter on file send (2007.6.5 maya) */
2494 WritePrivateProfileString(Section, "FileSendFilter",
2495 ts->FileSendFilter, FName);
2496
2497 WritePrivateProfileString(Section, "ScpSendDir", ts->ScpSendDir, FName);
2498
2499 /*------------------------------------------------------------------*/
2500 /* 8 bit control code flag -- special option */
2501 WriteOnOff(Section, "Accept8BitCtrl", FName,
2502 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
2503
2504 /* Wrong sequence flag -- special option */
2505 WriteOnOff(Section, "AllowWrongSequence", FName,
2506 (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
2507
2508 /* Detect disconnect/reconnect of serial port --- special option */
2509 WriteOnOff(Section, "AutoComPortReconnect", FName, ts->AutoComPortReconnect);
2510
2511 /* Auto file renaming --- special option */
2512 WriteOnOff(Section, "AutoFileRename", FName,
2513 (WORD) (ts->FTFlag & FT_RENAME));
2514
2515 /* Auto text copy --- special option */
2516 WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
2517
2518 /* Back wrap -- special option */
2519 WriteOnOff(Section, "BackWrap", FName,
2520 (WORD) (ts->TermFlag & TF_BACKWRAP));
2521
2522 /* Beep type -- special option */
2523 WriteOnOff(Section, "Beep", FName, ts->Beep);
2524 switch (ts->Beep) {
2525 case IdBeepOff:
2526 WritePrivateProfileString(Section, "Beep", "off", FName);
2527 break;
2528 case IdBeepOn:
2529 WritePrivateProfileString(Section, "Beep", "on", FName);
2530 break;
2531 case IdBeepVisual:
2532 WritePrivateProfileString(Section, "Beep", "visual", FName);
2533 break;
2534 }
2535
2536 /* Beep on connection & disconnection -- special option */
2537 WriteOnOff(Section, "BeepOnConnect", FName,
2538 (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
2539
2540 /* Auto B-Plus activation -- special option */
2541 WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
2542
2543 /* B-Plus ESCCTL flag -- special option */
2544 WriteOnOff(Section, "BPEscCtl", FName,
2545 (WORD) (ts->FTFlag & FT_BPESCCTL));
2546
2547 /* B-Plus log -- special option */
2548 WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
2549
2550 /* Clear serial port buffer when port opening -- special option */
2551 WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
2552
2553 /* Confirm disconnection -- special option */
2554 WriteOnOff(Section, "ConfirmDisconnect", FName,
2555 (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
2556
2557 /* Ctrl code in Kanji -- special option */
2558 WriteOnOff(Section, "CtrlInKanji", FName,
2559 (WORD) (ts->TermFlag & TF_CTRLINKANJI));
2560
2561 /* Debug flag -- special option */
2562 WriteOnOff(Section, "Debug", FName, ts->Debug);
2563
2564 /* Delimiter list -- special option */
2565 Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
2566 sizeof(Temp) - 1, TRUE);
2567 WritePrivateProfileString(Section, "DelimList", Temp, FName);
2568
2569 /* regard DBCS characters as delimiters -- special option */
2570 WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
2571
2572 // Enable popup menu -- special option
2573 if ((ts->MenuFlag & MF_NOPOPUP) == 0)
2574 WriteOnOff(Section, "EnablePopupMenu", FName, 1);
2575 else
2576 WriteOnOff(Section, "EnablePopupMenu", FName, 0);
2577
2578 // Enable "Show menu" -- special option
2579 if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
2580 WriteOnOff(Section, "EnableShowMenu", FName, 1);
2581 else
2582 WriteOnOff(Section, "EnableShowMenu", FName, 0);
2583
2584 /* Enable the status line -- special option */
2585 WriteOnOff(Section, "EnableStatusLine", FName,
2586 (WORD) (ts->TermFlag & TF_ENABLESLINE));
2587
2588 /* Enable multiple bytes send -- special option */
2589 WriteOnOff(Section, "FileSendHighSpeedMode", FName, ts->FileSendHighSpeedMode);
2590
2591 /* IME Flag -- special option */
2592 WriteOnOff(Section, "IME", FName, ts->UseIME);
2593
2594 /* IME-inline Flag -- special option */
2595 WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
2596
2597 /* Kermit log -- special option */
2598 WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
2599 WriteOnOff(Section, "KmtLongPacket", FName, (WORD) (ts->KermitOpt & KmtOptLongPacket));
2600 WriteOnOff(Section, "KmtFileAttr", FName, (WORD) (ts->KermitOpt & KmtOptFileAttr));
2601
2602 // Enable language selection -- special option
2603 if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
2604 WriteOnOff(Section, "LanguageSelection", FName, 1);
2605 else
2606 WriteOnOff(Section, "LanguageSelection", FName, 0);
2607
2608 /* Maximum scroll buffer size -- special option */
2609 WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
2610
2611 /* Max com port number -- special option */
2612 WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
2613
2614 /* Non-blinking cursor -- special option */
2615 WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
2616
2617 WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
2618
2619 /* Delay for pass-thru printing activation */
2620 /* -- special option */
2621 WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
2622
2623 /* Printer port for pass-thru printing */
2624 /* -- special option */
2625 WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
2626
2627 /* �v�����^�p�����R�[�h�������t������ */
2628 WriteOnOff(Section, "PrinterCtrlSequence", FName,
2629 ts->TermFlag & TF_PRINTERCTRL);
2630
2631 /* Printer Font --- special option */
2632 WriteFont(Section, "PrnFont", FName,
2633 ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
2634 ts->PrnFontCharSet);
2635
2636 // Page margins (left, right, top, bottom) for printing
2637 // -- special option
2638 WriteInt4(Section, "PrnMargin", FName,
2639 ts->PrnMargin[0], ts->PrnMargin[1],
2640 ts->PrnMargin[2], ts->PrnMargin[3]);
2641
2642 /* Quick-VAN log -- special option */
2643 WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
2644
2645 /* Quick-VAN window size -- special */
2646 WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
2647
2648 /* Russian character set (print) -- special option */
2649 id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
2650 WritePrivateProfileString(Section, "RussPrint", Temp, FName);
2651
2652 /* Scroll threshold -- special option */
2653 WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
2654
2655 WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
2656
2657 // Select on activate -- special option
2658 WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
2659
2660 /* Send 8bit control sequence -- special option */
2661 WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
2662
2663 /* SendBreak time (in msec) -- special option */
2664 WriteInt(Section, "SendBreakTime", FName, ts->SendBreakTime);
2665
2666 /* Startup macro -- special option */
2667 WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
2668
2669 /* TEK GIN Mouse keycode -- special option */
2670 WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
2671
2672 /* Telnet Auto Detect -- special option */
2673 WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
2674
2675 /* Telnet binary flag -- special option */
2676 WriteOnOff(Section, "TelBin", FName, ts->TelBin);
2677
2678 /* Telnet Echo flag -- special option */
2679 WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
2680
2681 /* Telnet log -- special option */
2682 WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
2683
2684 /* TCP port num for telnet -- special option */
2685 WriteUint(Section, "TelPort", FName, ts->TelPort);
2686
2687 /* Telnet keep-alive packet(NOP command) interval -- special option */
2688 WriteUint(Section, "TelKeepAliveInterval", FName,
2689 ts->TelKeepAliveInterval);
2690
2691 /* Max number of broadcast commad history */
2692 WriteUint(Section, "MaxBroadcatHistory", FName,
2693 ts->MaxBroadcatHistory);
2694
2695 /* Local echo for non-telnet */
2696 WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
2697
2698 /* "new-line (transmit)" option for non-telnet -- special option */
2699 if (ts->TCPCRSend == IdCRLF)
2700 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2701 else if (ts->TCPCRSend == IdCR)
2702 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2703 else
2704 Temp[0] = 0;
2705 WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2706
2707 /* Use text (background) color for "white (black)"
2708 --- special option */
2709 WriteOnOff(Section, "UseTextColor", FName,
2710 (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2711
2712 /* Title format -- special option */
2713 WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2714
2715 /* VT Compatible Tab -- special option */
2716 WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2717
2718 /* VT Font space --- special option */
2719 WriteInt4(Section, "VTFontSpace", FName,
2720 ts->FontDX, ts->FontDW - ts->FontDX,
2721 ts->FontDY, ts->FontDH - ts->FontDY);
2722
2723 // VT-print scaling factors (pixels per inch) --- special option
2724 WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2725
2726 // TEK-print scaling factors (pixels per inch) --- special option
2727 WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2728
2729 // Show "Window" menu -- special option
2730 WriteOnOff(Section, "WindowMenu", FName,
2731 (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2732
2733 /* XMODEM log -- special option */
2734 WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2735
2736 /* YMODEM log -- special option */
2737 WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2738
2739 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
2740 WritePrivateProfileString(Section, "YmodemRcvCommand", ts->YModemRcvCommand, FName);
2741
2742 /* Auto ZMODEM activation -- special option */
2743 WriteOnOff(Section, "ZmodemAuto", FName,
2744 (WORD) (ts->FTFlag & FT_ZAUTO));
2745
2746 /* ZMODEM data subpacket length for sending -- special */
2747 WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2748 /* ZMODEM window size for sending -- special */
2749 WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2750
2751 /* ZMODEM ESCCTL flag -- special option */
2752 WriteOnOff(Section, "ZmodemEscCtl", FName,
2753 (WORD) (ts->FTFlag & FT_ZESCCTL));
2754
2755 /* ZMODEM log -- special option */
2756 WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2757
2758 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2759 WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);