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