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 4480 - (show annotations) (download) (as text)
Mon Jun 6 00:55:49 2011 UTC (12 years, 10 months ago) by doda
File MIME type: text/x-csrc
File size: 106175 byte(s)
ジャンプリスのの(不)使用の設定を、ホスト履歴の設定から分離。

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