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 5493 - (show annotations) (download) (as text)
Sun Mar 2 14:46:06 2014 UTC (10 years, 1 month ago) by yutakapon
File MIME type: text/x-csrc
File size: 116578 byte(s)
チケット #32524
sendmulticast マクロコマンドの宛先を、Additional settings - General ダイアログで、
マルチキャスト名を設定できるようにした。また、それに伴い teraterm.ini に MulticastName 
エントリを追加した。

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 ts->LogAllBuffIncludedInFirst = GetOnOff(Section, "LogIncludeScreenBuffer", FName, FALSE);
766
767 /* File Transfer dialog visibility */
768 ts->FTHideDialog = GetOnOff(Section, "FTHideDialog", FName, FALSE);
769
770 /* Default Log file name (2006.8.28 maya) */
771 GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
772 ts->LogDefaultName, sizeof(ts->LogDefaultName),
773 FName);
774
775 /* Default Log file path (2007.5.30 maya) */
776 GetPrivateProfileString(Section, "LogDefaultPath", "",
777 ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
778 FName);
779
780 /* Auto start logging (2007.5.31 maya) */
781 ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
782
783 /* Log Rotate (2013.3.24 yutaka) */
784 ts->LogRotate = GetPrivateProfileInt(Section, "LogRotate", 0, FName);
785 ts->LogRotateSize = GetPrivateProfileInt(Section, "LogRotateSize", 0, FName);
786 ts->LogRotateSizeType = GetPrivateProfileInt(Section, "LogRotateSizeType", 0, FName);
787 ts->LogRotateStep = GetPrivateProfileInt(Section, "LogRotateStep", 0, FName);
788
789 /* Deferred Log Write Mode (2013.4.20 yutaka) */
790 ts->DeferredLogWriteMode = GetOnOff(Section, "DeferredLogWriteMode", FName, TRUE);
791
792
793 /* XMODEM option */
794 GetPrivateProfileString(Section, "XmodemOpt", "",
795 Temp, sizeof(Temp), FName);
796 if (_stricmp(Temp, "crc") == 0)
797 ts->XmodemOpt = XoptCRC;
798 else if (_stricmp(Temp, "1k") == 0)
799 ts->XmodemOpt = Xopt1K;
800 else
801 ts->XmodemOpt = XoptCheck;
802
803 /* XMODEM binary file */
804 ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
805
806 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
807 GetPrivateProfileString(Section, "XModemRcvCommand", "",
808 ts->XModemRcvCommand,
809 sizeof(ts->XModemRcvCommand), FName);
810
811 /* Default directory for file transfer */
812 GetPrivateProfileString(Section, "FileDir", "",
813 ts->FileDir, sizeof(ts->FileDir), FName);
814 if (strlen(ts->FileDir) == 0)
815 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
816 else {
817 _getcwd(Temp, sizeof(Temp));
818 if (_chdir(ts->FileDir) != 0)
819 strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
820 _chdir(Temp);
821 }
822
823 /* filter on file send (2007.6.5 maya) */
824 GetPrivateProfileString(Section, "FileSendFilter", "",
825 ts->FileSendFilter, sizeof(ts->FileSendFilter),
826 FName);
827
828 /* SCP���M���p�X (2012.4.6 yutaka) */
829 GetPrivateProfileString(Section, "ScpSendDir", "~/",
830 ts->ScpSendDir, sizeof(ts->ScpSendDir), FName);
831
832
833 /*--------------------------------------------------*/
834 /* 8 bit control code flag -- special option */
835 if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
836 ts->TermFlag |= TF_ACCEPT8BITCTRL;
837
838 /* Wrong sequence flag -- special option */
839 if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
840 ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
841
842 if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
843 (ts->KanjiOut == IdKanjiOutH))
844 ts->KanjiOut = IdKanjiOutJ;
845
846 // Auto file renaming --- special option
847 if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
848 ts->FTFlag |= FT_RENAME;
849
850 // Auto invoking (character set->G0->GL) --- special option
851 if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
852 ts->TermFlag |= TF_AUTOINVOKE;
853
854 // Auto text copy --- special option
855 ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
856
857 /* Back wrap -- special option */
858 if (GetOnOff(Section, "BackWrap", FName, FALSE))
859 ts->TermFlag |= TF_BACKWRAP;
860
861 /* Beep type -- special option */
862 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
863 if (_stricmp(Temp, "off") == 0)
864 ts->Beep = IdBeepOff;
865 else if (_stricmp(Temp, "visual") == 0)
866 ts->Beep = IdBeepVisual;
867 else
868 ts->Beep = IdBeepOn;
869
870 /* Beep on connection & disconnection -- special option */
871 if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
872 ts->PortFlag |= PF_BEEPONCONNECT;
873
874 /* Auto B-Plus activation -- special option */
875 if (GetOnOff(Section, "BPAuto", FName, FALSE))
876 ts->FTFlag |= FT_BPAUTO;
877 if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
878 strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
879 _TRUNCATE);
880 ts->AnswerbackLen = 5;
881 }
882
883 /* B-Plus ESCCTL flag -- special option */
884 if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
885 ts->FTFlag |= FT_BPESCCTL;
886
887 /* B-Plus log -- special option */
888 if (GetOnOff(Section, "BPLog", FName, FALSE))
889 ts->LogFlag |= LOG_BP;
890
891 /* Clear serial port buffer when port opening -- special option */
892 ts->ClearComBuffOnOpen =
893 GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
894
895 /* Confirm disconnection -- special option */
896 if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
897 ts->PortFlag |= PF_CONFIRMDISCONN;
898
899 /* Ctrl code in Kanji -- special option */
900 if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
901 ts->TermFlag |= TF_CTRLINKANJI;
902
903 /* Debug flag -- special option */
904 ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
905
906 /* Delimiter list -- special option */
907 GetPrivateProfileString(Section, "DelimList",
908 "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
909 Temp, sizeof(Temp), FName);
910 Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
911
912 /* regard DBCS characters as delimiters -- special option */
913 ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
914
915 // Enable popup menu -- special option
916 if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
917 ts->MenuFlag |= MF_NOPOPUP;
918
919 // Enable "Show menu" -- special option
920 if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
921 ts->MenuFlag |= MF_NOSHOWMENU;
922
923 // Enable the status line -- special option
924 if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
925 ts->TermFlag |= TF_ENABLESLINE;
926
927 // fixed JIS --- special
928 if (GetOnOff(Section, "FixedJIS", FName, FALSE))
929 ts->TermFlag |= TF_FIXEDJIS;
930
931 /* IME Flag -- special option */
932 ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
933
934 /* IME-inline Flag -- special option */
935 ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
936
937 /* Kermit log -- special option */
938 if (GetOnOff(Section, "KmtLog", FName, FALSE))
939 ts->LogFlag |= LOG_KMT;
940 if (GetOnOff(Section, "KmtLongPacket", FName, FALSE))
941 ts->KermitOpt |= KmtOptLongPacket;
942 if (GetOnOff(Section, "KmtFileAttr", FName, FALSE))
943 ts->KermitOpt |= KmtOptFileAttr;
944
945 // Enable language selection -- special option
946 if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
947 ts->MenuFlag |= MF_NOLANGUAGE;
948
949 /* Maximum scroll buffer size -- special option */
950 ts->ScrollBuffMax =
951 GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
952 if (ts->ScrollBuffMax < 24)
953 ts->ScrollBuffMax = 10000;
954
955 /* Max com port number -- special option */
956 ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 4, FName);
957 if (ts->MaxComPort < 4)
958 ts->MaxComPort = 4;
959 // COM16����99���g�� (2005.11.30 yutaka)
960 // 99����200���g�� (2007.7.23 maya)
961 if (ts->MaxComPort > MAXCOMPORT)
962 ts->MaxComPort = MAXCOMPORT;
963 if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
964 ts->ComPort = 1;
965
966 /* Non-blinking cursor -- special option */
967 ts->NonblinkingCursor =
968 GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
969
970 // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
971 ts->KillFocusCursor =
972 GetOnOff(Section, "KillFocusCursor", FName, TRUE);
973
974 /* Delay for pass-thru printing activation */
975 /* -- special option */
976 ts->PassThruDelay =
977 GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
978
979 /* Printer port for pass-thru printing */
980 /* -- special option */
981 GetPrivateProfileString(Section, "PassThruPort", "",
982 ts->PrnDev, sizeof(ts->PrnDev), FName);
983
984 /* �v�����^�p�����R�[�h�������t������ */
985 if (GetOnOff(Section, "PrinterCtrlSequence", FName, TRUE))
986 ts->TermFlag |= TF_PRINTERCTRL;
987
988 /* Printer Font --- special option */
989 GetPrivateProfileString(Section, "PrnFont", "",
990 Temp, sizeof(Temp), FName);
991 if (strlen(Temp) == 0) {
992 ts->PrnFont[0] = 0;
993 ts->PrnFontSize.x = 0;
994 ts->PrnFontSize.y = 0;
995 ts->PrnFontCharSet = 0;
996 }
997 else {
998 GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
999 GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
1000 GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
1001 GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
1002 }
1003
1004 // Page margins (left, right, top, bottom) for printing
1005 // -- special option
1006 GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
1007 Temp, sizeof(Temp), FName);
1008 for (i = 0; i <= 3; i++)
1009 GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
1010
1011 /* Quick-VAN log -- special option */
1012 if (GetOnOff(Section, "QVLog", FName, FALSE))
1013 ts->LogFlag |= LOG_QV;
1014
1015 /* Quick-VAN window size -- special */
1016 ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
1017
1018 /* Russian character set (print) -- special option */
1019 GetPrivateProfileString(Section, "RussPrint", "",
1020 Temp, sizeof(Temp), FName);
1021 ts->RussPrint = str2id(RussList, Temp, IdWindows);
1022
1023 /* Scroll threshold -- special option */
1024 ts->ScrollThreshold =
1025 GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
1026
1027 ts->MouseWheelScrollLine =
1028 GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
1029
1030 // Select on activate -- special option
1031 ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
1032
1033 /* Send 8bit control sequence -- special option */
1034 ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
1035
1036 /* Startup macro -- special option */
1037 GetPrivateProfileString(Section, "StartupMacro", "",
1038 ts->MacroFN, sizeof(ts->MacroFN), FName);
1039
1040 /* TEK GIN Mouse keycode -- special option */
1041 ts->GINMouseCode =
1042 GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
1043
1044 /* Telnet Auto Detect -- special option */
1045 ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
1046
1047 /* Telnet binary flag -- special option */
1048 ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
1049
1050 /* Telnet Echo flag -- special option */
1051 ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
1052
1053 /* Telnet log -- special option */
1054 if (GetOnOff(Section, "TelLog", FName, FALSE))
1055 ts->LogFlag |= LOG_TEL;
1056
1057 /* TCP port num for telnet -- special option */
1058 ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
1059
1060 /* Telnet keep-alive packet(NOP command) interval -- special option */
1061 ts->TelKeepAliveInterval =
1062 GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
1063
1064 /* Max number of broadcast commad history */
1065 ts->MaxBroadcatHistory =
1066 GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
1067
1068 /* Local echo for non-telnet */
1069 ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
1070
1071 /* "new-line (transmit)" option for non-telnet -- special option */
1072 GetPrivateProfileString(Section, "TCPCRSend", "",
1073 Temp, sizeof(Temp), FName);
1074 if (_stricmp(Temp, "CR") == 0)
1075 ts->TCPCRSend = IdCR;
1076 else if (_stricmp(Temp, "CRLF") == 0)
1077 ts->TCPCRSend = IdCRLF;
1078 else
1079 ts->TCPCRSend = 0; // disabled
1080
1081 /* Use text (background) color for "white (black)" --- special option */
1082 if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1083 ts->ColorFlag |= CF_USETEXTCOLOR;
1084
1085 /* Title format -- special option */
1086 ts->TitleFormat =
1087 GetPrivateProfileInt(Section, "TitleFormat", 5, FName);
1088
1089 /* VT Compatible Tab -- special option */
1090 ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1091
1092 /* VT Font space --- special option */
1093 GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1094 Temp, sizeof(Temp), FName);
1095 GetNthNum(Temp, 1, &ts->FontDX);
1096 GetNthNum(Temp, 2, &ts->FontDW);
1097 GetNthNum(Temp, 3, &ts->FontDY);
1098 GetNthNum(Temp, 4, &ts->FontDH);
1099 if (ts->FontDX < 0)
1100 ts->FontDX = 0;
1101 if (ts->FontDW < 0)
1102 ts->FontDW = 0;
1103 ts->FontDW = ts->FontDW + ts->FontDX;
1104 if (ts->FontDY < 0)
1105 ts->FontDY = 0;
1106 if (ts->FontDH < 0)
1107 ts->FontDH = 0;
1108 ts->FontDH = ts->FontDH + ts->FontDY;
1109
1110 // VT-print scaling factors (pixels per inch) --- special option
1111 GetPrivateProfileString(Section, "VTPPI", "0,0",
1112 Temp, sizeof(Temp), FName);
1113 GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1114 GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1115
1116 // TEK-print scaling factors (pixels per inch) --- special option
1117 GetPrivateProfileString(Section, "TEKPPI", "0,0",
1118 Temp, sizeof(Temp), FName);
1119 GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1120 GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1121
1122 // Show "Window" menu -- special option
1123 if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1124 ts->MenuFlag |= MF_SHOWWINMENU;
1125
1126 /* XMODEM log -- special option */
1127 if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1128 ts->LogFlag |= LOG_X;
1129
1130 /* YMODEM log -- special option */
1131 if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1132 ts->LogFlag |= LOG_Y;
1133
1134 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
1135 GetPrivateProfileString(Section, "YModemRcvCommand", "rb",
1136 ts->YModemRcvCommand, sizeof(ts->YModemRcvCommand), FName);
1137
1138 /* Auto ZMODEM activation -- special option */
1139 if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1140 ts->FTFlag |= FT_ZAUTO;
1141
1142 /* ZMODEM data subpacket length for sending -- special */
1143 ts->ZmodemDataLen =
1144 GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1145 /* ZMODEM window size for sending -- special */
1146 ts->ZmodemWinSize =
1147 GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1148
1149 /* ZMODEM ESCCTL flag -- special option */
1150 if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1151 ts->FTFlag |= FT_ZESCCTL;
1152
1153 /* ZMODEM log -- special option */
1154 if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1155 ts->LogFlag |= LOG_Z;
1156
1157 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1158 GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1159 ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1160
1161 #ifndef NO_COPYLINE_FIX
1162
1163 /* Enable continued-line copy -- special option */
1164 ts->EnableContinuedLineCopy =
1165 GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1166 #endif /* NO_COPYLINE_FIX */
1167
1168 ts->DisablePasteMouseRButton =
1169 GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE);
1170
1171 // added DisablePasteMouseMButton (2008.3.2 maya)
1172 ts->DisablePasteMouseMButton =
1173 GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE);
1174
1175 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1176 ts->ConfirmPasteMouseRButton =
1177 GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE);
1178
1179 // added ConfirmChangePaste (2008.2.3 yutaka)
1180 ts->ConfirmChangePaste =
1181 GetOnOff(Section, "ConfirmChangePaste", FName, TRUE);
1182 GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "",
1183 Temp, sizeof(Temp), FName);
1184 strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp,
1185 _TRUNCATE);
1186
1187 // added ScrollWindowClearScreen (2008.5.3 yutaka)
1188 ts->ScrollWindowClearScreen =
1189 GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1190
1191 // added SelectOnlyByLButton (2007.11.20 maya)
1192 ts->SelectOnlyByLButton =
1193 GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1194
1195 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1196 ts->DisableAcceleratorSendBreak =
1197 GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1198
1199 // WinSock connecting timeout value (2007.1.11 yutaka)
1200 ts->ConnectingTimeout =
1201 GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1202
1203 // mouse cursor
1204 GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1205 Temp, sizeof(Temp), FName);
1206 strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1207 _TRUNCATE);
1208
1209 // Translucent window
1210 ts->AlphaBlend =
1211 GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
1212 ts->AlphaBlend = max(0, ts->AlphaBlend);
1213 ts->AlphaBlend = min(255, ts->AlphaBlend);
1214
1215 // Cygwin install path
1216 GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1217 Temp, sizeof(Temp), FName);
1218 strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1219 _TRUNCATE);
1220
1221 // Viewlog Editor path
1222 if (GetWindowsDirectory(Temp, sizeof(Temp)) + 13 < sizeof(Temp)) { // "\\notepad.exe"(12) + NUL(1)
1223 strncat_s(Temp, sizeof(Temp), "\\notepad.exe", _TRUNCATE);
1224 }
1225 else {
1226 Temp[0] = '\0';
1227 }
1228 GetPrivateProfileString(Section, "ViewlogEditor ", Temp,
1229 ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName);
1230
1231 // Locale for UTF-8
1232 GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1233 Temp, sizeof(Temp), FName);
1234 strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1235
1236 // CodePage
1237 ts->CodePage =
1238 GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
1239 FName);
1240
1241 // UI language message file
1242 GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1243 Temp, sizeof(Temp), FName);
1244 {
1245 char CurDir[MAX_PATH];
1246
1247 // �t���p�X�������O������������������������������
1248 strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1249
1250 GetCurrentDirectory(sizeof(CurDir), CurDir);
1251 SetCurrentDirectory(ts->HomeDir);
1252 _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1253 SetCurrentDirectory(CurDir);
1254 }
1255
1256 // Broadcast Command History (2007.3.3 maya)
1257 ts->BroadcastCommandHistory =
1258 GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1259
1260 // 337: 2007/03/20 Accept Broadcast
1261 ts->AcceptBroadcast =
1262 GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1263
1264 // Multicast Name
1265 GetPrivateProfileString(Section, "MulticastName", "",
1266 Temp, sizeof(Temp), FName);
1267 strncpy_s(ts->MulticastName, sizeof(ts->MulticastName), Temp,
1268 _TRUNCATE);
1269
1270 // Confirm send a file when drag and drop (2007.12.28 maya)
1271 ts->ConfirmFileDragAndDrop =
1272 GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1273
1274 // Translate mouse wheel to cursor key when application cursor mode
1275 ts->TranslateWheelToCursor =
1276 GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1277
1278 // Display "New Connection" dialog on startup (2008.1.18 maya)
1279 ts->HostDialogOnStartup =
1280 GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1281
1282 // Mouse event tracking
1283 ts->MouseEventTracking =
1284 GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1285
1286 // Maximized bug tweak
1287 ts->MaximizedBugTweak =
1288 GetOnOff(Section, "MaximizedBugTweak", FName, TRUE);
1289
1290 // Convert Unicode symbol characters to DEC Special characters
1291 ts->UnicodeDecSpMapping =
1292 GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1293
1294 // VT Window Icon
1295 GetPrivateProfileString(Section, "VTIcon", "Default",
1296 Temp, sizeof(Temp), FName);
1297 ts->VTIcon = IconName2IconId(Temp);
1298
1299 // Tek Window Icon
1300 GetPrivateProfileString(Section, "TEKIcon", "Default",
1301 Temp, sizeof(Temp), FName);
1302 ts->TEKIcon = IconName2IconId(Temp);
1303
1304 // Unknown Unicode Character
1305 ts->UnknownUnicodeCharaAsWide =
1306 GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1307
1308 #ifdef USE_NORMAL_BGCOLOR
1309 // UseNormalBGColor
1310 ts->UseNormalBGColor =
1311 GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1312 // 2006/03/11 by 337
1313 if (ts->UseNormalBGColor) {
1314 ts->VTBoldColor[1] =
1315 ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1316 }
1317 #endif
1318
1319 // AutoScrollOnlyInBottomLine
1320 ts->AutoScrollOnlyInBottomLine =
1321 GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1322
1323 // Accept remote-controlled window title changing
1324 GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1325 Temp, sizeof(Temp), FName);
1326 if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1327 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1328 else if (_stricmp(Temp, "ahead") == 0)
1329 ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1330 else if (_stricmp(Temp, "last") == 0)
1331 ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1332 else
1333 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1334
1335 // Size of paste confirm dialog
1336 GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1337 Temp, sizeof(Temp), FName);
1338 GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1339 GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1340 if (ts->PasteDialogSize.cx < 0)
1341 ts->PasteDialogSize.cx = 330;
1342 if (ts->PasteDialogSize.cy < 0)
1343 ts->PasteDialogSize.cy = 220;
1344
1345 // Disable mouse event tracking when Control-Key is pressed.
1346 ts->DisableMouseTrackingByCtrl =
1347 GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1348
1349 // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1350 ts->DisableWheelToCursorByCtrl =
1351 GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1352
1353 // Strict Key Mapping.
1354 ts->StrictKeyMapping =
1355 GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1356
1357 // added Wait4allMacroCommand (2009.3.23 yutaka)
1358 ts->Wait4allMacroCommand =
1359 GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1360
1361 // added DisableMenuSendBreak (2009.4.6 maya)
1362 ts->DisableMenuSendBreak =
1363 GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE);
1364
1365 // added ClearScreenOnCloseConnection (2009.4.6 maya)
1366 ts->ClearScreenOnCloseConnection =
1367 GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE);
1368
1369 // added DisableAcceleratorDuplicateSession (2009.4.6 maya)
1370 ts->DisableAcceleratorDuplicateSession =
1371 GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE);
1372
1373 // added DisableMenuDuplicateSession (2010.8.3 maya)
1374 ts->DisableMenuDuplicateSession =
1375 GetOnOff(Section, "DisableMenuDuplicateSession", FName, FALSE);
1376
1377 // added DisableMenuNewConnection (2010.8.4 maya)
1378 ts->DisableMenuNewConnection =
1379 GetOnOff(Section, "DisableMenuNewConnection", FName, FALSE);
1380
1381 // added PasteDelayPerLine (2009.4.12 maya)
1382 ts->PasteDelayPerLine =
1383 GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName);
1384 {
1385 int tmp = min(max(0, ts->PasteDelayPerLine), 5000);
1386 ts->PasteDelayPerLine = tmp;
1387 }
1388
1389 // Font scaling -- test
1390 ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE);
1391
1392 // Meta sets MSB
1393 GetPrivateProfileString(Section, "Meta8Bit", "off", Temp, sizeof(Temp), FName);
1394 if (_stricmp(Temp, "raw") == 0 || _stricmp(Temp, "on") == 0)
1395 ts->Meta8Bit = IdMeta8BitRaw;
1396 else if (_stricmp(Temp, "text") == 0)
1397 ts->Meta8Bit = IdMeta8BitText;
1398 else
1399 ts->Meta8Bit = IdMeta8BitOff;
1400
1401 // Window control sequence
1402 if (GetOnOff(Section, "WindowCtrlSequence", FName, TRUE))
1403 ts->WindowFlag |= WF_WINDOWCHANGE;
1404
1405 // Cursor control sequence
1406 if (GetOnOff(Section, "CursorCtrlSequence", FName, FALSE))
1407 ts->WindowFlag |= WF_CURSORCHANGE;
1408
1409 // Window report sequence
1410 if (GetOnOff(Section, "WindowReportSequence", FName, TRUE))
1411 ts->WindowFlag |= WF_WINDOWREPORT;
1412
1413 // Title report sequence
1414 GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName);
1415 if (_stricmp(Temp, "accept") == 0)
1416 ts->WindowFlag |= IdTitleReportAccept;
1417 else if (_stricmp(Temp, "ignore") == 0 || _stricmp(Temp, "off") == 0)
1418 ts->WindowFlag &= ~WF_TITLEREPORT;
1419 else // empty
1420 ts->WindowFlag |= IdTitleReportEmpty;
1421
1422 // Line at a time mode
1423 ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE);
1424
1425 // Clear window on resize
1426 if (GetOnOff(Section, "ClearOnResize", FName, TRUE))
1427 ts->TermFlag |= TF_CLEARONRESIZE;
1428
1429 // Alternate Screen Buffer
1430 if (GetOnOff(Section, "AlternateScreenBuffer", FName, TRUE))
1431 ts->TermFlag |= TF_ALTSCR;
1432
1433 // IME status related cursor style
1434 if (GetOnOff(Section, "IMERelatedCursor", FName, FALSE))
1435 ts->WindowFlag |= WF_IMECURSORCHANGE;
1436
1437 // Terminal Unique ID
1438 GetPrivateProfileString(Section, "TerminalUID", "FFFFFFFF", Temp, sizeof(Temp), FName);
1439 if (strlen(Temp) == 8) {
1440 for (i=0; i<8 && isxdigit((unsigned char)Temp[i]); i++) {
1441 if (islower(Temp[i])) {
1442 ts->TerminalUID[i] = toupper(Temp[i]);
1443 }
1444 else {
1445 ts->TerminalUID[i] = Temp[i];
1446 }
1447 }
1448 if (i == 8) {
1449 ts->TerminalUID[i] = 0;
1450 }
1451 else {
1452 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1453 }
1454 }
1455 else {
1456 strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE);
1457 }
1458
1459 // Lock Terminal UID
1460 if (GetOnOff(Section, "LockTUID", FName, TRUE))
1461 ts->TermFlag |= TF_LOCKTUID;
1462
1463 // Confirm PasteCR
1464 ts->ConfirmChangePasteCR = GetOnOff(Section, "ConfirmChangePasteCR", FName, TRUE);
1465
1466 // Jump List
1467 ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE);
1468
1469 // TabStopModifySequence
1470 GetPrivateProfileString(Section, "TabStopModifySequence", "on", Temp, sizeof(Temp), FName);
1471 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
1472 ts->TabStopFlag = TABF_ALL;
1473 else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0)
1474 ts->TabStopFlag = TABF_NONE;
1475 else {
1476 ts->TabStopFlag = TABF_NONE;
1477 for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
1478 if (_stricmp(Temp2, "HTS") == 0)
1479 ts->TabStopFlag |= TABF_HTS;
1480 else if (_stricmp(Temp2, "HTS7") == 0)
1481 ts->TabStopFlag |= TABF_HTS7;
1482 else if (_stricmp(Temp2, "HTS8") == 0)
1483 ts->TabStopFlag |= TABF_HTS8;
1484 else if (_stricmp(Temp2, "TBC") == 0)
1485 ts->TabStopFlag |= TABF_TBC;
1486 else if (_stricmp(Temp2, "TBC0") == 0)
1487 ts->TabStopFlag |= TABF_TBC0;
1488 else if (_stricmp(Temp2, "TBC3") == 0)
1489 ts->TabStopFlag |= TABF_TBC3;
1490 }
1491 }
1492
1493 // Clipboard Access from Remote
1494 GetPrivateProfileString(Section, "ClipboardAccessFromRemote", "off", Temp, sizeof(Temp), FName);
1495 if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "readwrite") == 0)
1496 ts->CtrlFlag |= CSF_CBRW;
1497 else if (_stricmp(Temp, "read") == 0)
1498 ts->CtrlFlag |= CSF_CBREAD;
1499 else if (_stricmp(Temp, "write") == 0)
1500 ts->CtrlFlag |= CSF_CBWRITE;
1501
1502 // Use invalid DECRPSS (for testing)
1503 if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
1504 ts->TermFlag |= TF_INVALIDDECRPSS;
1505
1506 // ClickableUrlBrowser
1507 GetPrivateProfileString(Section, "ClickableUrlBrowser", "",
1508 ts->ClickableUrlBrowser, sizeof(ts->ClickableUrlBrowser), FName);
1509 GetPrivateProfileString(Section, "ClickableUrlBrowserArg", "",
1510 ts->ClickableUrlBrowserArg, sizeof(ts->ClickableUrlBrowserArg), FName);
1511
1512 // Exclusive Lock when open the log file
1513 ts->LogLockExclusive = GetOnOff(Section, "LogLockExclusive", FName, TRUE);
1514
1515 // Font quality
1516 GetPrivateProfileString(Section, "FontQuality", "default",
1517 Temp, sizeof(Temp), FName);
1518 if (_stricmp(Temp, "nonantialiased") == 0)
1519 ts->FontQuality = NONANTIALIASED_QUALITY;
1520 else if (_stricmp(Temp, "antialiased") == 0)
1521 ts->FontQuality = ANTIALIASED_QUALITY;
1522 else if (_stricmp(Temp, "cleartype") == 0)
1523 ts->FontQuality = CLEARTYPE_QUALITY;
1524 else
1525 ts->FontQuality = DEFAULT_QUALITY;
1526
1527 // Beep Over Used
1528 ts->BeepOverUsedCount =
1529 GetPrivateProfileInt(Section, "BeepOverUsedCount", 5, FName);
1530 ts->BeepOverUsedTime =
1531 GetPrivateProfileInt(Section, "BeepOverUsedTime", 2, FName);
1532 ts->BeepSuppressTime =
1533 GetPrivateProfileInt(Section, "BeepSuppressTime", 5, FName);
1534
1535 // Max OSC string buffer size
1536 ts->MaxOSCBufferSize =
1537 GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName);
1538
1539 ts->JoinSplitURL = GetOnOff(Section, "JoinSplitURL", FName, FALSE);
1540
1541 GetPrivateProfileString(Section, "JoinSplitURLIgnoreEOLChar", "\\", Temp, sizeof(Temp), FName);
1542 ts->JoinSplitURLIgnoreEOLChar = Temp[0];
1543 }
1544
1545 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1546 {
1547 int i;
1548 char Temp[MAX_PATH];
1549 char buf[20];
1550 int ret;
1551 char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG];
1552
1553 /* version */
1554 ret = WritePrivateProfileString(Section, "Version", "2.3", FName);
1555 if (ret == 0) {
1556 // ini�t�@�C�����������������s�������A�G���[���b�Z�[�W���\�������B(2012.10.18 yutaka)
1557 ret = GetLastError();
1558 get_lang_msg("MSG_INI_WRITE_ERROR", uimsg, sizeof(uimsg), "Cannot write ini file", ts->UILanguageFile);
1559 _snprintf_s(msg, sizeof(msg), _TRUNCATE, "%s (%d)", uimsg, ret);
1560
1561 get_lang_msg("MSG_INI_ERROR", uimsg2, sizeof(uimsg2), "Tera Term: Error", ts->UILanguageFile);
1562
1563 MessageBox(NULL, msg, uimsg2, MB_ICONEXCLAMATION);
1564 }
1565
1566 /* Language */
1567 switch (ts->Language) {
1568 case IdJapanese:
1569 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1570 break;
1571 case IdKorean:
1572 strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1573 break;
1574 case IdRussian:
1575 strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1576 break;
1577 case IdUtf8:
1578 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1579 break;
1580 default:
1581 strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1582 }
1583
1584 WritePrivateProfileString(Section, "Language", Temp, FName);
1585
1586 /* Port type */
1587 if (ts->PortType == IdSerial)
1588 strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1589 else if (ts->PortType == IdNamedPipe)
1590 strncpy_s(Temp, sizeof(Temp), "namedpipe", _TRUNCATE);
1591 else /* IdFile -> IdTCPIP */
1592 strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1593
1594 WritePrivateProfileString(Section, "Port", Temp, FName);
1595
1596 /* Save win position */
1597 if (ts->SaveVTWinPos) {
1598 /* VT win position */
1599 WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1600 }
1601
1602 /* VT terminal size */
1603 WriteInt2(Section, "TerminalSize", FName,
1604 ts->TerminalWidth, ts->TerminalHeight);
1605
1606 /* Terminal size = Window size */
1607 WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1608
1609 /* Auto window resize flag */
1610 WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1611
1612 /* CR Receive */
1613 if (ts->CRReceive == IdCRLF) {
1614 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1615 }
1616 else if (ts->CRReceive == IdLF) {
1617 strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1618 }
1619 else if (ts->CRReceive == IdAUTO) {
1620 strncpy_s(Temp, sizeof(Temp), "AUTO", _TRUNCATE);
1621 }
1622 else {
1623 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1624 }
1625 WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1626
1627 /* CR Send */
1628 if (ts->CRSend == IdCRLF)
1629 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1630 else
1631 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1632 WritePrivateProfileString(Section, "CRSend", Temp, FName);
1633
1634 /* Local echo */
1635 WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1636
1637 /* Answerback */
1638 if ((ts->FTFlag & FT_BPAUTO) == 0) {
1639 Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1640 sizeof(Temp) - 1, TRUE);
1641 WritePrivateProfileString(Section, "Answerback", Temp, FName);
1642 }
1643
1644 /* Kanji Code (receive) */
1645 switch (ts->KanjiCode) {
1646 case IdEUC:
1647 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1648 break;
1649 case IdJIS:
1650 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1651 break;
1652 case IdUTF8:
1653 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1654 break;
1655 case IdUTF8m:
1656 strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1657 break;
1658 default:
1659 switch (ts->Language) {
1660 case IdJapanese:
1661 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1662 break;
1663 case IdKorean:
1664 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1665 break;
1666 default:
1667 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1668 }
1669 }
1670 WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1671
1672 /* Katakana (receive) */
1673 if (ts->JIS7Katakana == 1)
1674 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1675 else
1676 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1677
1678 WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1679
1680 /* Kanji Code (transmit) */
1681 switch (ts->KanjiCodeSend) {
1682 case IdEUC:
1683 strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1684 break;
1685 case IdJIS:
1686 strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1687 break;
1688 case IdUTF8:
1689 strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1690 break;
1691 default:
1692 switch (ts->Language) {
1693 case IdJapanese:
1694 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1695 break;
1696 case IdKorean:
1697 strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1698 break;
1699 default:
1700 strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1701 }
1702 }
1703 WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1704
1705 /* Katakana (transmit) */
1706 if (ts->JIS7KatakanaSend == 1)
1707 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1708 else
1709 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1710
1711 WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1712
1713 /* KanjiIn */
1714 if (ts->KanjiIn == IdKanjiInA)
1715 strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1716 else
1717 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1718
1719 WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1720
1721 /* KanjiOut */
1722 switch (ts->KanjiOut) {
1723 case IdKanjiOutB:
1724 strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1725 break;
1726 case IdKanjiOutH:
1727 strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1728 break;
1729 default:
1730 strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1731 }
1732 WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1733
1734 // new configuration
1735 WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1736
1737 WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1738 ts->DisablePasteMouseRButton);
1739
1740 // added DisablePasteMouseMButton (2008.3.2 maya)
1741 WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1742 ts->DisablePasteMouseMButton);
1743
1744 // added ConfirmPasteMouseRButton (2007.3.17 maya)
1745 WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1746 ts->ConfirmPasteMouseRButton);
1747
1748 // added ConfirmChangePaste
1749 WriteOnOff(Section, "ConfirmChangePaste", FName,
1750 ts->ConfirmChangePaste);
1751 WritePrivateProfileString(Section, "ConfirmChangePasteStringFile",
1752 ts->ConfirmChangePasteStringFile, FName);
1753
1754 // added ScrollWindowClearScreen
1755 WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1756 ts->ScrollWindowClearScreen);
1757
1758 // added SelectOnlyByLButton (2007.11.20 maya)
1759 WriteOnOff(Section, "SelectOnlyByLButton", FName,
1760 ts->SelectOnlyByLButton);
1761 // added DisableAcceleratorSendBreak (2007.3.17 maya)
1762 WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1763 ts->DisableAcceleratorSendBreak);
1764 WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1765 ts->EnableContinuedLineCopy);
1766 WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1767 FName);
1768 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1769 WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1770 WritePrivateProfileString(Section, "CygwinDirectory",
1771 ts->CygwinDirectory, FName);
1772 WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1773 FName);
1774 WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1775 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1776 WritePrivateProfileString(Section, "CodePage", Temp, FName);
1777
1778 // ANSI color(2004.9.5 yutaka)
1779 Temp[0] = '\0';
1780 for (i = 0; i < 15; i++) {
1781 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1782 i,
1783 GetRValue(ts->ANSIColor[i]),
1784 GetGValue(ts->ANSIColor[i]),
1785 GetBValue(ts->ANSIColor[i])
1786 );
1787 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1788 }
1789 i = 15;
1790 _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1791 i,
1792 GetRValue(ts->ANSIColor[i]),
1793 GetGValue(ts->ANSIColor[i]),
1794 GetBValue(ts->ANSIColor[i])
1795 );
1796 strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1797 WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1798
1799 /* AutoWinChange VT<->TEK */
1800 WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1801
1802 /* Terminal ID */
1803 id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1804 WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1805
1806 /* Russian character set (host) */
1807 id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1808 WritePrivateProfileString(Section, "RussHost", Temp, FName);
1809
1810 /* Russian character set (client) */
1811 id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1812 WritePrivateProfileString(Section, "RussClient", Temp, FName);
1813
1814 /* Title text */
1815 WritePrivateProfileString(Section, "Title", ts->Title, FName);
1816
1817 /* Cursor shape */
1818 switch (ts->CursorShape) {
1819 case IdVCur:
1820 strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1821 break;
1822 case IdHCur:
1823 strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1824 break;
1825 default:
1826 strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1827 }
1828 WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1829
1830 /* Hide title */
1831 WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1832
1833 /* Popup menu */
1834 WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1835
1836 /* PC-Style bold color mapping */
1837 WriteOnOff(Section, "PcBoldColor", FName,
1838 (WORD) (ts->ColorFlag & CF_PCBOLD16));
1839
1840 /* aixterm 16 colors mode */
1841 WriteOnOff(Section, "Aixterm16Color", FName,
1842 (WORD) (ts->ColorFlag & CF_AIXTERM16));
1843
1844 /* xterm 256 colors mode */
1845 WriteOnOff(Section, "Xterm256Color", FName,
1846 (WORD) (ts->ColorFlag & CF_XTERM256));
1847
1848 /* Enable scroll buffer */
1849 WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1850
1851 /* Scroll buffer size */
1852 WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1853
1854 /* VT Color */
1855 for (i = 0; i <= 1; i++) {
1856 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1857 if (ts->ColorFlag & CF_REVERSECOLOR) {
1858 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1859 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1860 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1861 }
1862 else {
1863 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1864 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1865 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1866 }
1867 }
1868 else {
1869 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1870 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1871 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1872 }
1873 }
1874 WriteInt6(Section, "VTColor", 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 Bold Color */
1879 for (i = 0; i <= 1; i++) {
1880 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1881 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1882 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1883 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1884 }
1885 else {
1886 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1887 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1888 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1889 }
1890 }
1891 WriteInt6(Section, "VTBoldColor", 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 Blink Color */
1896 for (i = 0; i <= 1; i++) {
1897 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1898 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1899 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1900 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1901 }
1902 else {
1903 ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1904 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1905 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1906 }
1907 }
1908 WriteInt6(Section, "VTBlinkColor", 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 /* VT Reverse Color */
1913 for (i = 0; i <= 1; i++) {
1914 if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1915 ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1916 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1917 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1918 }
1919 else {
1920 ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1921 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1922 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1923 }
1924 }
1925 WriteInt6(Section, "VTReverseColor", FName,
1926 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1927 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1928
1929 WriteOnOff(Section, "EnableClickableUrl", FName,
1930 ts->EnableClickableUrl);
1931
1932 /* URL color */
1933 for (i = 0; i <= 1; i++) {
1934 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1935 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1936 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1937 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1938 }
1939 else {
1940 ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1941 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1942 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1943 }
1944 }
1945 WriteInt6(Section, "URLColor", FName,
1946 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1947 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1948
1949 WriteOnOff(Section, "EnableBoldAttrColor", FName,
1950 (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1951
1952 WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1953 (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1954
1955 WriteOnOff(Section, "EnableReverseAttrColor", FName,
1956 (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1957
1958 WriteOnOff(Section, "EnableURLColor", FName,
1959 (WORD) (ts->ColorFlag & CF_URLCOLOR));
1960
1961 WriteOnOff(Section, "URLUnderline", FName,
1962 (WORD) (ts->FontFlag & FF_URLUNDERLINE));
1963
1964 WriteOnOff(Section, "EnableANSIColor", FName,
1965 (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1966
1967 /* TEK Color */
1968 for (i = 0; i <= 1; i++) {
1969 ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1970 ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1971 ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1972 }
1973 WriteInt6(Section, "TEKColor", FName,
1974 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1975 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1976
1977 /* TEK color emulation */
1978 WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1979
1980 /* VT Font */
1981 WriteFont(Section, "VTFont", FName,
1982 ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1983 ts->VTFontCharSet);
1984
1985 /* Enable bold font flag */
1986 WriteOnOff(Section, "EnableBold", FName,
1987 (WORD) (ts->FontFlag & FF_BOLD));
1988
1989 /* Russian character set (font) */
1990 id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1991 WritePrivateProfileString(Section, "RussFont", Temp, FName);
1992
1993 /* TEK Font */
1994 WriteFont(Section, "TEKFont", FName,
1995 ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1996 ts->TEKFontCharSet);
1997
1998 /* BS key */
1999 if (ts->BSKey == IdDEL)
2000 strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
2001 else
2002 strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
2003 WritePrivateProfileString(Section, "BSKey", Temp, FName);
2004
2005 /* Delete key */
2006 WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
2007
2008 /* Meta key */
2009 switch (ts->MetaKey) {
2010 case 1:
2011 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
2012 break;
2013 case 2:
2014 strncpy_s(Temp, sizeof(Temp), "left", _TRUNCATE);
2015 break;
2016 case 3:
2017 strncpy_s(Temp, sizeof(Temp), "right", _TRUNCATE);
2018 break;
2019 default:
2020 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2021 }
2022 WritePrivateProfileString(Section, "Metakey", Temp, FName);
2023
2024 /* Application Keypad */
2025 WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
2026
2027 /* Application Cursor */
2028 WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
2029
2030 /* Russian keyboard type */
2031 id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
2032 WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
2033
2034 /* Serial port ID */
2035 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
2036 WritePrivateProfileString(Section, "ComPort", Temp, FName);
2037
2038 /* Baud rate */
2039 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->Baud);
2040 WritePrivateProfileString(Section, "BaudRate", Temp, FName);
2041
2042 /* Parity */
2043 switch (ts->Parity) {
2044 case IdParityEven:
2045 strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
2046 break;
2047 case IdParityOdd:
2048 strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
2049 break;
2050 case IdParityMark:
2051 strncpy_s(Temp, sizeof(Temp), "mark", _TRUNCATE);
2052 break;
2053 case IdParitySpace:
2054 strncpy_s(Temp, sizeof(Temp), "space", _TRUNCATE);
2055 break;
2056 default:
2057 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
2058 }
2059 WritePrivateProfileString(Section, "Parity", Temp, FName);
2060
2061 /* Data bit */
2062 if (ts->DataBit == IdDataBit7)
2063 strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
2064 else
2065 strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
2066
2067 WritePrivateProfileString(Section, "DataBit", Temp, FName);
2068
2069 /* Stop bit */
2070 switch (ts->StopBit) {
2071 case IdStopBit2:
2072 strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
2073 break;
2074 case IdStopBit15:
2075 strncpy_s(Temp, sizeof(Temp), "1.5", _TRUNCATE);
2076 break;
2077 default:
2078 strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
2079 break;
2080 }
2081
2082 WritePrivateProfileString(Section, "StopBit", Temp, FName);
2083
2084 /* Flow control */
2085 switch (ts->Flow) {
2086 case IdFlowX:
2087 strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
2088 break;
2089 case IdFlowHard:
2090 strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
2091 break;
2092 default:
2093 strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
2094 }
2095 WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
2096
2097 /* Delay per character */
2098 WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
2099
2100 /* Delay per line */
2101 WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
2102
2103 /* Telnet flag */
2104 WriteOnOff(Section, "Telnet", FName, ts->Telnet);
2105
2106 /* Telnet terminal type */
2107 WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
2108
2109 /* TCP port num for non-telnet */
2110 WriteUint(Section, "TCPPort", FName, ts->TCPPort);
2111
2112 /* Auto close flag */
2113 WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
2114
2115 /* History list */
2116 WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
2117
2118 /* File transfer binary flag */
2119 WriteOnOff(Section, "TransBin", FName, ts->TransBin);
2120
2121 /* Log binary flag */
2122 WriteOnOff(Section, "LogBinary", FName, ts->LogBinary);
2123
2124 /* Log append */
2125 WriteOnOff(Section, "LogAppend", FName, ts->Append);
2126
2127 /* Log plain text flag */
2128 WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
2129
2130 /* Log with timestamp (2006.7.23 maya) */
2131 WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
2132
2133 /* Log without transfer dialog */
2134 WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
2135
2136 WriteOnOff(Section, "LogIncludeScreenBuffer", FName, ts->LogAllBuffIncludedInFirst);
2137
2138 /* Default Log file name (2006.8.28 maya) */
2139 WritePrivateProfileString(Section, "LogDefaultName",
2140 ts->LogDefaultName, FName);
2141
2142 /* Default Log file path (2007.5.30 maya) */
2143 WritePrivateProfileString(Section, "LogDefaultPath",
2144 ts->LogDefaultPath, FName);
2145
2146 /* Auto start logging (2007.5.31 maya) */
2147 WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
2148
2149 /* Log Rotate (2013.3.24 yutaka) */
2150 WriteInt(Section, "LogRotate", FName, ts->LogRotate);
2151 WriteInt(Section, "LogRotateSize", FName, ts->LogRotateSize);
2152 WriteInt(Section, "LogRotateSizeType", FName, ts->LogRotateSizeType);
2153 WriteInt(Section, "LogRotateStep", FName, ts->LogRotateStep);
2154
2155 /* Deferred Log Write Mode (2013.4.20 yutaka) */
2156 WriteOnOff(Section, "DeferredLogWriteMode", FName, ts->DeferredLogWriteMode);
2157
2158 /* XMODEM option */
2159 switch (ts->XmodemOpt) {
2160 case XoptCRC:
2161 strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
2162 break;
2163 case Xopt1K:
2164 strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
2165 break;
2166 default:
2167 strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
2168 }
2169 WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
2170
2171 /* XMODEM binary flag */
2172 WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
2173
2174 /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
2175 WritePrivateProfileString(Section, "XmodemRcvCommand",
2176 ts->XModemRcvCommand, FName);
2177
2178 /* Default directory for file transfer */
2179 WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
2180
2181 /* filter on file send (2007.6.5 maya) */
2182 WritePrivateProfileString(Section, "FileSendFilter",
2183 ts->FileSendFilter, FName);
2184
2185 WritePrivateProfileString(Section, "ScpSendDir", ts->ScpSendDir, FName);
2186
2187 /*------------------------------------------------------------------*/
2188 /* 8 bit control code flag -- special option */
2189 WriteOnOff(Section, "Accept8BitCtrl", FName,
2190 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
2191
2192 /* Wrong sequence flag -- special option */
2193 WriteOnOff(Section, "AllowWrongSequence", FName,
2194 (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
2195
2196 /* Auto file renaming --- special option */
2197 WriteOnOff(Section, "AutoFileRename", FName,
2198 (WORD) (ts->FTFlag & FT_RENAME));
2199
2200 /* Auto text copy --- special option */
2201 WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
2202
2203 /* Back wrap -- special option */
2204 WriteOnOff(Section, "BackWrap", FName,
2205 (WORD) (ts->TermFlag & TF_BACKWRAP));
2206
2207 /* Beep type -- special option */
2208 WriteOnOff(Section, "Beep", FName, ts->Beep);
2209 switch (ts->Beep) {
2210 case IdBeepOff:
2211 WritePrivateProfileString(Section, "Beep", "off", FName);
2212 break;
2213 case IdBeepOn:
2214 WritePrivateProfileString(Section, "Beep", "on", FName);
2215 break;
2216 case IdBeepVisual:
2217 WritePrivateProfileString(Section, "Beep", "visual", FName);
2218 break;
2219 }
2220
2221 /* Beep on connection & disconnection -- special option */
2222 WriteOnOff(Section, "BeepOnConnect", FName,
2223 (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
2224
2225 /* Auto B-Plus activation -- special option */
2226 WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
2227
2228 /* B-Plus ESCCTL flag -- special option */
2229 WriteOnOff(Section, "BPEscCtl", FName,
2230 (WORD) (ts->FTFlag & FT_BPESCCTL));
2231
2232 /* B-Plus log -- special option */
2233 WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
2234
2235 /* Clear serial port buffer when port opening -- special option */
2236 WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
2237
2238 /* Confirm disconnection -- special option */
2239 WriteOnOff(Section, "ConfirmDisconnect", FName,
2240 (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
2241
2242 /* Ctrl code in Kanji -- special option */
2243 WriteOnOff(Section, "CtrlInKanji", FName,
2244 (WORD) (ts->TermFlag & TF_CTRLINKANJI));
2245
2246 /* Debug flag -- special option */
2247 WriteOnOff(Section, "Debug", FName, ts->Debug);
2248
2249 /* Delimiter list -- special option */
2250 Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
2251 sizeof(Temp) - 1, TRUE);
2252 WritePrivateProfileString(Section, "DelimList", Temp, FName);
2253
2254 /* regard DBCS characters as delimiters -- special option */
2255 WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
2256
2257 // Enable popup menu -- special option
2258 if ((ts->MenuFlag & MF_NOPOPUP) == 0)
2259 WriteOnOff(Section, "EnablePopupMenu", FName, 1);
2260 else
2261 WriteOnOff(Section, "EnablePopupMenu", FName, 0);
2262
2263 // Enable "Show menu" -- special option
2264 if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
2265 WriteOnOff(Section, "EnableShowMenu", FName, 1);
2266 else
2267 WriteOnOff(Section, "EnableShowMenu", FName, 0);
2268
2269 /* Enable the status line -- special option */
2270 WriteOnOff(Section, "EnableStatusLine", FName,
2271 (WORD) (ts->TermFlag & TF_ENABLESLINE));
2272
2273 /* IME Flag -- special option */
2274 WriteOnOff(Section, "IME", FName, ts->UseIME);
2275
2276 /* IME-inline Flag -- special option */
2277 WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
2278
2279 /* Kermit log -- special option */
2280 WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
2281 WriteOnOff(Section, "KmtLongPacket", FName, (WORD) (ts->KermitOpt & KmtOptLongPacket));
2282 WriteOnOff(Section, "KmtFileAttr", FName, (WORD) (ts->KermitOpt & KmtOptFileAttr));
2283
2284 // Enable language selection -- special option
2285 if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
2286 WriteOnOff(Section, "LanguageSelection", FName, 1);
2287 else
2288 WriteOnOff(Section, "LanguageSelection", FName, 0);
2289
2290 /* Maximum scroll buffer size -- special option */
2291 WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
2292
2293 /* Max com port number -- special option */
2294 WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
2295
2296 /* Non-blinking cursor -- special option */
2297 WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
2298
2299 WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
2300
2301 /* Delay for pass-thru printing activation */
2302 /* -- special option */
2303 WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
2304
2305 /* Printer port for pass-thru printing */
2306 /* -- special option */
2307 WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
2308
2309 /* �v�����^�p�����R�[�h�������t������ */
2310 WriteOnOff(Section, "PrinterCtrlSequence", FName,
2311 ts->TermFlag & TF_PRINTERCTRL);
2312
2313 /* Printer Font --- special option */
2314 WriteFont(Section, "PrnFont", FName,
2315 ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
2316 ts->PrnFontCharSet);
2317
2318 // Page margins (left, right, top, bottom) for printing
2319 // -- special option
2320 WriteInt4(Section, "PrnMargin", FName,
2321 ts->PrnMargin[0], ts->PrnMargin[1],
2322 ts->PrnMargin[2], ts->PrnMargin[3]);
2323
2324 /* Quick-VAN log -- special option */
2325 WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
2326
2327 /* Quick-VAN window size -- special */
2328 WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
2329
2330 /* Russian character set (print) -- special option */
2331 id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
2332 WritePrivateProfileString(Section, "RussPrint", Temp, FName);
2333
2334 /* Scroll threshold -- special option */
2335 WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
2336
2337 WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
2338
2339 // Select on activate -- special option
2340 WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
2341
2342 /* Send 8bit control sequence -- special option */
2343 WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
2344
2345 /* Startup macro -- special option */
2346 WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
2347
2348 /* TEK GIN Mouse keycode -- special option */
2349 WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
2350
2351 /* Telnet Auto Detect -- special option */
2352 WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
2353
2354 /* Telnet binary flag -- special option */
2355 WriteOnOff(Section, "TelBin", FName, ts->TelBin);
2356
2357 /* Telnet Echo flag -- special option */
2358 WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
2359
2360 /* Telnet log -- special option */
2361 WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
2362
2363 /* TCP port num for telnet -- special option */
2364 WriteUint(Section, "TelPort", FName, ts->TelPort);
2365
2366 /* Telnet keep-alive packet(NOP command) interval -- special option */
2367 WriteUint(Section, "TelKeepAliveInterval", FName,
2368 ts->TelKeepAliveInterval);
2369
2370 /* Max number of broadcast commad history */
2371 WriteUint(Section, "MaxBroadcatHistory", FName,
2372 ts->MaxBroadcatHistory);
2373
2374 /* Local echo for non-telnet */
2375 WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
2376
2377 /* "new-line (transmit)" option for non-telnet -- special option */
2378 if (ts->TCPCRSend == IdCRLF)
2379 strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2380 else if (ts->TCPCRSend == IdCR)
2381 strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2382 else
2383 Temp[0] = 0;
2384 WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2385
2386 /* Use text (background) color for "white (black)"
2387 --- special option */
2388 WriteOnOff(Section, "UseTextColor", FName,
2389 (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2390
2391 /* Title format -- special option */
2392 WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2393
2394 /* VT Compatible Tab -- special option */
2395 WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2396
2397 /* VT Font space --- special option */
2398 WriteInt4(Section, "VTFontSpace", FName,
2399 ts->FontDX, ts->FontDW - ts->FontDX,
2400 ts->FontDY, ts->FontDH - ts->FontDY);
2401
2402 // VT-print scaling factors (pixels per inch) --- special option
2403 WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2404
2405 // TEK-print scaling factors (pixels per inch) --- special option
2406 WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2407
2408 // Show "Window" menu -- special option
2409 WriteOnOff(Section, "WindowMenu", FName,
2410 (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2411
2412 /* XMODEM log -- special option */
2413 WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2414
2415 /* YMODEM log -- special option */
2416 WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2417
2418 /* YMODEM ���M�R�}���h (2010.3.23 yutaka) */
2419 WritePrivateProfileString(Section, "YmodemRcvCommand", ts->YModemRcvCommand, FName);
2420
2421 /* Auto ZMODEM activation -- special option */
2422 WriteOnOff(Section, "ZmodemAuto", FName,
2423 (WORD) (ts->FTFlag & FT_ZAUTO));
2424
2425 /* ZMODEM data subpacket length for sending -- special */
2426 WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2427 /* ZMODEM window size for sending -- special */
2428 WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2429
2430 /* ZMODEM ESCCTL flag -- special option */
2431 WriteOnOff(Section, "ZmodemEscCtl", FName,
2432 (WORD) (ts->FTFlag & FT_ZESCCTL));
2433
2434 /* ZMODEM log -- special option */
2435 WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2436
2437 /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2438 WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
2439
2440 /* update file */
2441 WritePrivateProfileString(NULL, NULL, NULL, FName);
2442
2443 // Eterm lookfeel alphablend (2005.4.24 yutaka)
2444 #define ETERM_SECTION BG_SECTION
2445 WriteOnOff(ETERM_SECTION, "BGEnable", FName,
2446 ts->EtermLookfeel.BGEnable);
2447 WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
2448 ts->EtermLookfeel.BGUseAlphaBlendAPI);
2449 WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
2450 ts->EtermLookfeel.BGSPIPath, FName);
2451 WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
2452 ts->EtermLookfeel.BGFastSizeMove);
2453 WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
2454 ts->EtermLookfeel.BGNoCopyBits);
2455 WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
2456 ts->EtermLookfeel.BGNoFrame);
2457 WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2458 ts->EtermLookfeel.BGThemeFile, FName);
2459 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s\\%s", ts->HomeDir, BG_THEME_IMAGEFILE);
2460 WritePrivateProfileString(BG_SECTION, BG_DESTFILE, ts->BGImageFilePath, Temp);
2461
2462 #ifdef USE_NORMAL_BGCOLOR
2463 // UseNormalBGColor
2464 WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2465 #endif
2466
2467 // UI language message file
2468 WritePrivateProfileString(Section, "UILanguageFile",
2469 ts->UILanguageFile_ini, FName);
2470
2471 // Broadcast Command History (2007.3.3 maya)
2472 WriteOnOff(Section, "BroadcastCommandHistory", FName,
2473 ts->BroadcastCommandHistory);
2474
2475 // 337: 2007/03/20 Accept Broadcast
2476 WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2477
2478 // Multicast Name
2479 WritePrivateProfileString(Section, "MulticastName",
2480 ts->MulticastName, FName);
2481
2482 // Confirm send a file when drag and drop (2007.12.28 maya)
2483 WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2484 ts->ConfirmFileDragAndDrop);
2485
2486 // Translate mouse wheel to cursor key when application cursor mode
2487 WriteOnOff(Section, "TranslateWheelToCursor", FName,
2488 ts->TranslateWheelToCursor);
2489
2490 // Display "New Connection" dialog on startup (2008.1.18 maya)
2491 WriteOnOff(Section, "HostDialogOnStartup", FName,
2492 ts->HostDialogOnStartup);
2493
2494 // Mouse event tracking
2495 WriteOnOff(Section, "MouseEventTracking", FName,
2496 ts->MouseEventTracking);
2497
2498 // Maximized bug tweak
2499 WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2500
2501 // Convert Unicode symbol characters to DEC Special characters
2502 WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2503
2504 // AutoScrollOnlyInBottomLine
2505 WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2506 ts->AutoScrollOnlyInBottomLine);
2507
2508 // Unknown Unicode Character
2509 WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2510 ts->UnknownUnicodeCharaAsWide);
2511
2512 // Accept remote-controlled window title changing
2513 if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2514 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2515 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2516 strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2517 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2518 strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2519 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2520 strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2521 else
2522 Temp[0] = 0;
2523 WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2524
2525 // Size of paste confirm dialog
2526 WriteInt2(Section, "PasteDialogSize", FName,
2527 ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2528
2529 // Disable mouse event tracking when Control-Key is pressed.
2530 WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2531 ts->DisableMouseTrackingByCtrl);
2532
2533 // Disable TranslateWHeelToCursor when Control-Key is pressed.
2534 WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2535 ts->DisableWheelToCursorByCtrl);
2536
2537 // Strict Key Mapping.
2538 WriteOnOff(Section, "StrictKeyMapping", FName,
2539 ts->StrictKeyMapping);
2540
2541 // Wait4allMacroCommand
2542 WriteOnOff(Section, "Wait4allMacroCommand", FName,
2543 ts->Wait4allMacroCommand);
2544
2545 // DisableMenuSendBreak
2546 WriteOnOff(Section, "DisableMenuSendBreak", FName,
2547 ts->DisableMenuSendBreak);
2548
2549 // ClearScreenOnCloseConnection
2550 WriteOnOff(Section, "ClearScreenOnCloseConnection", FName,
2551 ts->ClearScreenOnCloseConnection);
2552
2553 // DisableAcceleratorDuplicateSession
2554 WriteOnOff(Section, "DisableAcceleratorDuplicateSession", FName,
2555 ts->DisableAcceleratorDuplicateSession);
2556
2557 // DisableMenuDuplicateSession
2558 WriteOnOff(Section, "DisableMenuDuplicateSession", FName,
2559 ts->DisableMenuDuplicateSession);
2560
2561 // DisableMenuNewConnection
2562 WriteOnOff(Section, "DisableMenuNewConnection", FName,
2563 ts->DisableMenuNewConnection);
2564
2565 // added PasteDelayPerLine (2009.4.12 maya)
2566 WriteInt(Section, "PasteDelayPerLine", FName,
2567 ts->PasteDelayPerLine);
2568
2569 // Meta sets MSB
2570 switch (ts->Meta8Bit) {
2571 case IdMeta8BitRaw:
2572 WritePrivateProfileString(Section, "Meta8Bit", "raw", FName);
2573 break;
2574 case IdMeta8BitText:
2575 WritePrivateProfileString(Section, "Meta8Bit", "text", FName);
2576 break;
2577 default:
2578 WritePrivateProfileString(Section, "Meta8Bit", "off", FName);
2579 }
2580
2581 // Window control sequence
2582 WriteOnOff(Section, "WindowCtrlSequence", FName,
2583 ts->WindowFlag & WF_WINDOWCHANGE);
2584
2585 // Cursor control sequence
2586 WriteOnOff(Section, "CursorCtrlSequence", FName,
2587 ts->WindowFlag & WF_CURSORCHANGE);
2588
2589 // Window report sequence
2590 WriteOnOff(Section, "WindowReportSequence", FName,
2591 ts->WindowFlag & WF_WINDOWREPORT);
2592
2593 // Title report sequence
2594 switch (ts->WindowFlag & WF_TITLEREPORT) {
2595 case IdTitleReportIgnore:
2596 WritePrivateProfileString(Section, "TitleReportSequence", "ignore", FName);
2597 break;
2598 case IdTitleReportAccept:
2599 WritePrivateProfileString(Section, "TitleReportSequence", "accept", FName);
2600 break;
2601 default: // IdTitleReportEmpty
2602 WritePrivateProfileString(Section, "TitleReportSequence", "empty", FName);
2603 break;
2604 }
2605
2606 // Line at a time mode
2607 WriteOnOff(Section, "EnableLineMode", FName, ts->EnableLineMode);
2608
2609 // Clear window on resize
2610 WriteOnOff(Section, "ClearOnResize", FName,
2611 ts->TermFlag & TF_CLEARONRESIZE);
2612
2613 // Alternate Screen Buffer
2614 WriteOnOff(Section, "AlternateScreenBuffer", FName,
2615 ts->TermFlag & TF_ALTSCR);
2616
2617 // IME status related cursor style
2618 WriteOnOff(Section, "IMERelatedCursor", FName,
2619 ts->WindowFlag & WF_IMECURSORCHANGE);
2620
2621 // Terminal Unique ID
2622 WritePrivateProfileString(Section, "TerminalUID", ts->TerminalUID, FName);
2623
2624 // Lock Terminal UID
2625 WriteOnOff(Section, "LockTUID", FName, ts->TermFlag & TF_LOCKTUID);
2626
2627 // Confirm PasteCR
2628 WriteOnOff(Section, "ConfirmChangePasteCR", FName, ts->ConfirmChangePasteCR);
2629
2630 // Jump List
2631 WriteOnOff(Section, "JumpList", FName, ts->JumpList);
2632
2633 // TabStopModifySequence
2634 switch (ts->TabStopFlag) {
2635 case TABF_ALL:
2636 strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
2637 break;
2638 case TABF_NONE:
2639 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2640 break;
2641 default:
2642 switch (ts->TabStopFlag & TABF_HTS) {
2643 case TABF_HTS7: strncpy_s(Temp, sizeof(Temp), "HTS7", _TRUNCATE); break;
2644 case TABF_HTS8: strncpy_s(Temp, sizeof(Temp), "HTS8", _TRUNCATE); break;
2645 case TABF_HTS: strncpy_s(Temp, sizeof(Temp), "HTS", _TRUNCATE); break;
2646 default: Temp[0] = 0; break;
2647 }
2648
2649 if (ts->TabStopFlag & TABF_TBC) {
2650 if (Temp[0] != 0) {
2651 strncat_s(Temp, sizeof(Temp), ",", _TRUNCATE);
2652 }
2653 switch (ts->TabStopFlag & TABF_TBC) {
2654 case TABF_TBC0: strncat_s(Temp, sizeof(Temp), "TBC0", _TRUNCATE); break;
2655 case TABF_TBC3: strncat_s(Temp, sizeof(Temp), "TBC3", _TRUNCATE); break;
2656 case TABF_TBC: strncat_s(Temp, sizeof(Temp), "TBC", _TRUNCATE); break;
2657 }
2658 }
2659
2660 if (Temp[0] == 0) { // �����������������O������
2661 strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2662 }
2663 break;
2664 }
2665 WritePrivateProfileString(Section, "TabStopModifySequence", Temp, FName);
2666
2667 // Clipboard Access from Remote
2668 switch (ts->CtrlFlag & CSF_CBRW) {
2669 case CSF_CBREAD:
2670 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "read", FName);
2671 break;
2672 case CSF_CBWRITE:
2673 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "write", FName);
2674 break;
2675 case CSF_CBRW:
2676 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "on", FName);
2677 break;
2678 default:
2679 WritePrivateProfileString(Section, "ClipboardAccessFromRemote", "off", FName);
2680 break;
2681 }
2682
2683 // ClickableUrlBrowser
2684 WritePrivateProfileString(Section, "ClickableUrlBrowser", ts->ClickableUrlBrowser, FName);
2685 WritePrivateProfileString(Section, "ClickableUrlBrowserArg", ts->ClickableUrlBrowserArg, FName);
2686
2687 // Exclusive Lock when open the log file
2688 WriteOnOff(Section, "LogLockExclusive", FName, ts->LogLockExclusive);
2689
2690 // Font quality
2691 if (ts->FontQuality == NONANTIALIASED_QUALITY)
2692 strncpy_s(Temp, sizeof(Temp), "nonantialiased", _TRUNCATE);
2693 else if (ts->FontQuality == ANTIALIASED_QUALITY)
2694 strncpy_s(Temp, sizeof(Temp), "antialiased", _TRUNCATE);
2695 else if (ts->FontQuality == CLEARTYPE_QUALITY)
2696 strncpy_s(Temp, sizeof(Temp), "cleartype", _TRUNCATE);
2697 else
2698 strncpy_s(Temp, sizeof(Temp), "default", _TRUNCATE);
2699 WritePrivateProfileString(Section, "FontQuality", Temp, FName);
2700
2701 // Beep Over Used
2702 WriteInt(Section, "BeepOverUsedCount", FName, ts->BeepOverUsedCount);
2703 WriteInt(Section, "BeepOverUsedTime", FName, ts->BeepOverUsedTime);
2704 WriteInt(Section, "BeepSuppressTime", FName, ts->BeepSuppressTime);
2705
2706 // Max OSC string buffer size
2707 WriteInt(Section, "MaxOSCBufferSize", FName, ts->MaxOSCBufferSize);
2708
2709 WriteOnOff(Section, "JoinSplitURL", FName, ts->JoinSplitURL);
2710
2711 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%c", ts->JoinSplitURLIgnoreEOLChar);
2712 WritePrivateProfileString(Section, "JoinSplitURLIgnoreEOLChar", Temp, FName);
2713 }
2714
2715 #define VTEditor "VT editor keypad"
2716 #define VTNumeric "VT numeric keypad"
2717 #define VTFunction "VT function keys"
2718 #define XFunction "X function keys"
2719 #define ShortCut "Shortcut keys"
2720
2721 void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2722 {
2723 char Temp[11];
2724 WORD Num;
2725
2726 GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2727 if (Temp[0] == 0)
2728 Num = 0xFFFF;
2729 else if (_stricmp(Temp, "off") == 0)
2730 Num = 0xFFFF;
2731 else if (sscanf(Temp, "%d", &Num) != 1)
2732 Num = 0xFFFF;
2733
2734 KeyMap->Map[KeyId - 1] = Num;
2735 }
2736
2737 void FAR PASCAL ReadKeyboardCnf
2738 (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2739 int i, j, Ptr;
2740 char EntName[7];
2741 char TempStr[221];
2742 char KStr[201];
2743
2744 // clear key map
2745 for (i = 0; i <= IdKeyMax - 1; i++)
2746 KeyMap->Map[i] = 0xFFFF;
2747 for (i = 0; i <= NumOfUserKey - 1; i++) {
2748 KeyMap->UserKeyPtr[i] = 0;
2749 KeyMap->UserKeyLen[i] = 0;
2750 }
2751
2752 // VT editor keypad
2753 GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2754
2755 GetInt(KeyMap, IdDown, VTEditor, "Down", FName);
2756
2757 GetInt(KeyMap, IdRight, VTEditor, "Right", FName);
2758
2759 GetInt(KeyMap, IdLeft, VTEditor, "Left", FName);
2760
2761 GetInt(KeyMap, IdFind, VTEditor, "Find", FName);
2762
2763 GetInt(KeyMap, IdInsert, VTEditor, "Insert", FName);
2764
2765 GetInt(KeyMap, IdRemove, VTEditor, "Remove", FName);
2766
2767 GetInt(KeyMap, IdSelect, VTEditor, "Select", FName);
2768
2769 GetInt(KeyMap, IdPrev, VTEditor, "Prev", FName);
2770
2771 GetInt(KeyMap, IdNext, VTEditor, "Next", FName);
2772
2773 // VT numeric keypad
2774 GetInt(KeyMap, Id0, VTNumeric, "Num0", FName);
2775
2776 GetInt(KeyMap, Id1, VTNumeric, "Num1", FName);
2777
2778 GetInt(KeyMap, Id2, VTNumeric, "Num2", FName);
2779
2780 GetInt(KeyMap, Id3, VTNumeric, "Num3", FName);
2781
2782 GetInt(KeyMap, Id4, VTNumeric, "Num4", FName);
2783
2784 GetInt(KeyMap, Id5, VTNumeric, "Num5", FName);
2785
2786 GetInt(KeyMap, Id6, VTNumeric, "Num6", FName);
2787
2788 GetInt(KeyMap, Id7, VTNumeric, "Num7", FName);
2789
2790 GetInt(KeyMap, Id8, VTNumeric, "Num8", FName);
2791
2792 GetInt(KeyMap, Id9, VTNumeric, "Num9", FName);
2793
2794 GetInt(KeyMap, IdMinus, VTNumeric, "NumMinus", FName);
2795
2796 GetInt(KeyMap, IdComma, VTNumeric, "NumComma", FName);
2797
2798 GetInt(KeyMap, IdPeriod, VTNumeric, "NumPeriod", FName);
2799
2800 GetInt(KeyMap, IdEnter, VTNumeric, "NumEnter", FName);
2801
2802 GetInt(KeyMap, IdSlash, VTNumeric, "NumSlash", FName);
2803
2804 GetInt(KeyMap, IdAsterisk, VTNumeric, "NumAsterisk", FName);
2805
2806 GetInt(KeyMap, IdPlus, VTNumeric, "NumPlus", FName);
2807