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 4393 - (show annotations) (download) (as text)
Fri Mar 25 12:04:41 2011 UTC (13 years ago) by yutakapon
File MIME type: text/x-csrc
File size: 105154 byte(s)
プリンタ制御コードが来ても無視することができるエントリを追加した。
デフォルトは下位互換性のため、オフ。

; Ignore printer control sequence(MC)
IgnorePrinterCtrl=off

ランニング試験中、ホストからプリンタ制御コードが届くと、印刷ダイアログが
表示され、Tera Termが一時停止し、試験が止まらないようにしたい。

メモ:
# echo -e '\x1b\x5b\x69'
とすれば、擬似的にテストできる。ESC [ 'i' でMC(Media Copy)を示す。

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