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 5021 - (show annotations) (download) (as text)
Tue Sep 18 07:18:40 2012 UTC (11 years, 6 months ago) by doda
File MIME type: text/x-csrc
File size: 112761 byte(s)
VTIcon, TEKIcon の設定を保存しないようにした。

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