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 5316 - (show annotations) (download) (as text)
Tue Jun 11 18:03:59 2013 UTC (10 years, 10 months ago) by doda
File MIME type: text/x-csrc
File size: 115038 byte(s)
Beepが多量に鳴らされた時に抑制するようにした。

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