Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/teraterm/ttpset/ttset.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2690 - (hide annotations) (download) (as text)
Fri Mar 6 00:47:21 2009 UTC (15 years, 1 month ago) by maya
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 92356 byte(s)
TERATERM.INI の読み方を変えたときに、OnOffを逆に読んでしまう問題を修正した。

1 maya 2476 /* 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 "ttlib.h"
17 doda 2497 #include "tt_res.h"
18 maya 2476
19 maya 2664 #include "compat_w95.h"
20 maya 2660
21 maya 2476 #define Section "Tera Term"
22    
23     static PCHAR far TermList[] =
24     { "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
25     "VT320", "VT382", NULL };
26     // expansion (2005.11.30 yutaka)
27     static PCHAR BaudList[] =
28     { "110", "300", "600", "1200", "2400", "4800", "9600",
29     "14400", "19200", "38400", "57600", "115200",
30     "230400", "460800", "921600", NULL
31     };
32    
33     static PCHAR far RussList[] =
34     { "Windows", "KOI8-R", "CP-866", "ISO-8859-5", NULL };
35     static PCHAR far RussList2[] = { "Windows", "KOI8-R", NULL };
36    
37     WORD str2id(PCHAR far * List, PCHAR str, WORD DefId)
38     {
39     WORD i;
40     i = 0;
41     while ((List[i] != NULL) && (_stricmp(List[i], str) != 0))
42     i++;
43     if (List[i] == NULL)
44     i = DefId;
45     else
46     i++;
47    
48     return i;
49     }
50    
51     void id2str(PCHAR far * List, WORD Id, WORD DefId, PCHAR str, int destlen)
52     {
53     int i;
54    
55     if (Id == 0)
56     i = DefId - 1;
57     else {
58     i = 0;
59     while ((List[i] != NULL) && (i < Id - 1))
60     i++;
61     if (List[i] == NULL)
62     i = DefId - 1;
63     }
64     strncpy_s(str, destlen, List[i], _TRUNCATE);
65     }
66    
67 doda 2497 int IconName2IconId(const char *name) {
68     int id;
69    
70     if (_stricmp(name, "tterm") == 0) {
71     id = IDI_TTERM;
72     }
73     else if (_stricmp(name, "vt") == 0) {
74     id = IDI_VT;
75     }
76     else if (_stricmp(name, "tek") == 0) {
77     id = IDI_TEK;
78     }
79     else if (_stricmp(name, "tterm_classic") == 0) {
80     id = IDI_TTERM_CLASSIC;
81     }
82     else if (_stricmp(name, "vt_classic") == 0) {
83     id = IDI_VT_CLASSIC;
84     }
85     else if (_stricmp(name, "cygterm") == 0) {
86     id = IDI_CYGTERM;
87     }
88     else {
89     id = IdIconDefault;
90     }
91     return id;
92     }
93    
94     void IconId2IconName(char *name, int len, int id) {
95     char *icon;
96     switch (id) {
97     case IDI_TTERM:
98     icon = "tterm";
99     break;
100     case IDI_VT:
101     icon = "vt";
102     break;
103     case IDI_TEK:
104     icon = "tek";
105     break;
106     case IDI_TTERM_CLASSIC:
107     icon = "tterm_classic";
108     break;
109     case IDI_VT_CLASSIC:
110     icon = "vt_classic";
111     break;
112     case IDI_CYGTERM:
113     icon = "cygterm";
114     break;
115     default:
116     icon = "Default";
117     }
118     strncpy_s(name, len, icon, _TRUNCATE);
119     }
120    
121 maya 2476 WORD GetOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, BOOL Default)
122     {
123     char Temp[4];
124     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
125     if (Default) {
126     if (_stricmp(Temp, "off") == 0)
127     return 0;
128     else
129     return 1;
130     }
131     else {
132     if (_stricmp(Temp, "on") == 0)
133     return 1;
134     else
135     return 0;
136     }
137     }
138    
139     void WriteOnOff(PCHAR Sect, PCHAR Key, PCHAR FName, WORD Flag)
140     {
141     char Temp[4];
142    
143     if (Flag != 0)
144     strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
145     else
146     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
147     WritePrivateProfileString(Sect, Key, Temp, FName);
148     }
149    
150     void WriteInt(PCHAR Sect, PCHAR Key, PCHAR FName, int i)
151     {
152     char Temp[15];
153     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i);
154     WritePrivateProfileString(Sect, Key, Temp, FName);
155     }
156    
157     void WriteUint(PCHAR Sect, PCHAR Key, PCHAR FName, UINT i)
158     {
159     char Temp[15];
160     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i);
161     WritePrivateProfileString(Sect, Key, Temp, FName);
162     }
163    
164     void WriteInt2(PCHAR Sect, PCHAR Key, PCHAR FName, int i1, int i2)
165     {
166     char Temp[32];
167     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2);
168     WritePrivateProfileString(Sect, Key, Temp, FName);
169     }
170    
171     void WriteInt4(PCHAR Sect, PCHAR Key, PCHAR FName,
172     int i1, int i2, int i3, int i4)
173     {
174     char Temp[64];
175     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d",
176     i1, i2, i3, i4);
177     WritePrivateProfileString(Sect, Key, Temp, FName);
178     }
179    
180     void WriteInt6(PCHAR Sect, PCHAR Key, PCHAR FName,
181     int i1, int i2, int i3, int i4, int i5, int i6)
182     {
183     char Temp[96];
184     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d",
185     i1, i2,i3, i4, i5, i6);
186     WritePrivateProfileString(Sect, Key, Temp, FName);
187     }
188    
189     void WriteFont(PCHAR Sect, PCHAR Key, PCHAR FName,
190     PCHAR Name, int x, int y, int charset)
191     {
192     char Temp[80];
193     if (Name[0] != 0)
194     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d",
195     Name, x, y, charset);
196     else
197     Temp[0] = 0;
198     WritePrivateProfileString(Sect, Key, Temp, FName);
199     }
200    
201     void FAR PASCAL ReadIniFile(PCHAR FName, PTTSet ts)
202     {
203     int i;
204     HDC TmpDC;
205     char Temp[MAXPATHLEN];
206    
207     ts->Minimize = 0;
208     ts->HideWindow = 0;
209     ts->LogFlag = 0; // Log flags
210     ts->FTFlag = 0; // File transfer flags
211     ts->MenuFlag = 0; // Menu flags
212     ts->TermFlag = 0; // Terminal flag
213 doda 2666 ts->ColorFlag = 0; // ANSI/Attribute color flags
214 maya 2476 ts->PortFlag = 0; // Port flags
215     ts->TelPort = 23;
216    
217     /* Version number */
218     /* GetPrivateProfileString(Section,"Version","",
219     Temp,sizeof(Temp),FName); */
220    
221     /* Language */
222     GetPrivateProfileString(Section, "Language", "",
223     Temp, sizeof(Temp), FName);
224     if (_stricmp(Temp, "Japanese") == 0)
225     ts->Language = IdJapanese;
226     else if (_stricmp(Temp, "Russian") == 0)
227     ts->Language = IdRussian;
228     else if (_stricmp(Temp, "English") == 0)
229     ts->Language = IdEnglish;
230 yutakapon 2556 else if (_stricmp(Temp,"Korean") == 0) // HKS
231     ts->Language = IdKorean;
232 maya 2476 else {
233     switch (PRIMARYLANGID(GetSystemDefaultLangID())) {
234     case LANG_JAPANESE:
235     ts->Language = IdJapanese;
236     break;
237     case LANG_RUSSIAN:
238     ts->Language = IdRussian;
239     break;
240 yutakapon 2556 case LANG_KOREAN: // HKS
241     ts->Language = IdKorean;
242     break;
243 maya 2476 default:
244     ts->Language = IdEnglish;
245     }
246     }
247    
248     /* Port type */
249     GetPrivateProfileString(Section, "Port", "",
250     Temp, sizeof(Temp), FName);
251     if (_stricmp(Temp, "tcpip") == 0)
252     ts->PortType = IdTCPIP;
253     else if (_stricmp(Temp, "serial") == 0)
254     ts->PortType = IdSerial;
255     else {
256     ts->PortType = IdTCPIP;
257     }
258    
259     /* VT win position */
260     GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
261     GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x));
262     GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y));
263    
264     /* TEK win position */
265     GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */
266     GetNthNum(Temp, 1, (int far *) &(ts->TEKPos.x));
267     GetNthNum(Temp, 2, (int far *) &(ts->TEKPos.y));
268    
269     /* Save VT Window position */
270     ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE);
271    
272     /* VT terminal size */
273     GetPrivateProfileString(Section, "TerminalSize", "80,24",
274     Temp, sizeof(Temp), FName);
275     GetNthNum(Temp, 1, &ts->TerminalWidth);
276     GetNthNum(Temp, 2, &ts->TerminalHeight);
277     if (ts->TerminalWidth < 0)
278     ts->TerminalWidth = 1;
279     if (ts->TerminalHeight < 0)
280     ts->TerminalHeight = 1;
281    
282     /* Terminal size = Window size */
283     ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE);
284    
285     /* Auto window resize flag */
286     ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE);
287    
288     /* CR Receive */
289     GetPrivateProfileString(Section, "CRReceive", "",
290     Temp, sizeof(Temp), FName);
291     if (_stricmp(Temp, "CRLF") == 0) {
292     ts->CRReceive = IdCRLF;
293     }
294     else if (_stricmp(Temp, "LF") == 0) {
295     ts->CRReceive = IdLF;
296     }
297     else {
298     ts->CRReceive = IdCR;
299     }
300     /* CR Send */
301     GetPrivateProfileString(Section, "CRSend", "",
302     Temp, sizeof(Temp), FName);
303     if (_stricmp(Temp, "CRLF") == 0)
304     ts->CRSend = IdCRLF;
305     else
306     ts->CRSend = IdCR;
307 maya 2482 ts->CRSend_ini = ts->CRSend;
308 maya 2476
309     /* Local echo */
310     ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE);
311 maya 2482 ts->LocalEcho_ini = ts->LocalEcho;
312 maya 2476
313     /* Answerback */
314     GetPrivateProfileString(Section, "Answerback", "", Temp,
315     sizeof(Temp), FName);
316     ts->AnswerbackLen =
317     Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback));
318    
319     /* Kanji Code (receive) */
320     GetPrivateProfileString(Section, "KanjiReceive", "",
321     Temp, sizeof(Temp), FName);
322     if (_stricmp(Temp, "EUC") == 0)
323     ts->KanjiCode = IdEUC;
324     else if (_stricmp(Temp, "JIS") == 0)
325     ts->KanjiCode = IdJIS;
326     else if (_stricmp(Temp, "UTF-8") == 0)
327     ts->KanjiCode = IdUTF8;
328     else if (_stricmp(Temp, "UTF-8m") == 0)
329     ts->KanjiCode = IdUTF8m;
330     else
331     ts->KanjiCode = IdSJIS;
332    
333     /* Katakana (receive) */
334     GetPrivateProfileString(Section, "KatakanaReceive", "",
335     Temp, sizeof(Temp), FName);
336     if (_stricmp(Temp, "7") == 0)
337     ts->JIS7Katakana = 1;
338     else
339     ts->JIS7Katakana = 0;
340    
341     /* Kanji Code (transmit) */
342     GetPrivateProfileString(Section, "KanjiSend", "",
343     Temp, sizeof(Temp), FName);
344     if (_stricmp(Temp, "EUC") == 0)
345     ts->KanjiCodeSend = IdEUC;
346     else if (_stricmp(Temp, "JIS") == 0)
347     ts->KanjiCodeSend = IdJIS;
348     else if (_stricmp(Temp, "UTF-8") == 0)
349     ts->KanjiCodeSend = IdUTF8;
350     else
351     ts->KanjiCodeSend = IdSJIS;
352    
353     /* Katakana (receive) */
354     GetPrivateProfileString(Section, "KatakanaSend", "",
355     Temp, sizeof(Temp), FName);
356     if (_stricmp(Temp, "7") == 0)
357     ts->JIS7KatakanaSend = 1;
358     else
359     ts->JIS7KatakanaSend = 0;
360    
361     /* KanjiIn */
362     GetPrivateProfileString(Section, "KanjiIn", "",
363     Temp, sizeof(Temp), FName);
364     if (_stricmp(Temp, "@") == 0)
365     ts->KanjiIn = IdKanjiInA;
366     else
367     ts->KanjiIn = IdKanjiInB;
368    
369     /* KanjiOut */
370     GetPrivateProfileString(Section, "KanjiOut", "",
371     Temp, sizeof(Temp), FName);
372     if (_stricmp(Temp, "B") == 0)
373     ts->KanjiOut = IdKanjiOutB;
374     else if (_stricmp(Temp, "H") == 0)
375     ts->KanjiOut = IdKanjiOutH;
376     else
377     ts->KanjiOut = IdKanjiOutJ;
378    
379     /* Auto Win Switch VT<->TEK */
380     ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE);
381    
382     /* Terminal ID */
383     GetPrivateProfileString(Section, "TerminalID", "",
384     Temp, sizeof(Temp), FName);
385     ts->TerminalID = str2id(TermList, Temp, IdVT100);
386    
387     /* Russian character set (host) */
388     GetPrivateProfileString(Section, "RussHost", "",
389     Temp, sizeof(Temp), FName);
390     ts->RussHost = str2id(RussList, Temp, IdKOI8);
391    
392     /* Russian character set (client) */
393     GetPrivateProfileString(Section, "RussClient", "",
394     Temp, sizeof(Temp), FName);
395     ts->RussClient = str2id(RussList, Temp, IdWindows);
396    
397     /* Title String */
398     GetPrivateProfileString(Section, "Title", "Tera Term",
399     ts->Title, sizeof(ts->Title), FName);
400    
401     /* Cursor shape */
402     GetPrivateProfileString(Section, "CursorShape", "",
403     Temp, sizeof(Temp), FName);
404     if (_stricmp(Temp, "vertical") == 0)
405     ts->CursorShape = IdVCur;
406     else if (_stricmp(Temp, "horizontal") == 0)
407     ts->CursorShape = IdHCur;
408     else
409     ts->CursorShape = IdBlkCur;
410    
411     /* Hide title */
412     ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE);
413    
414     /* Popup menu */
415     ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE);
416    
417     /* PC-Style bold color mapping */
418 doda 2682 if (GetOnOff(Section, "PcBoldColor", FName, FALSE))
419     ts->ColorFlag |= CF_PCBOLD16;
420 maya 2476
421     /* aixterm style 16 colors mode */
422 doda 2682 if (GetOnOff(Section, "Aixterm16Color", FName, FALSE))
423     ts->ColorFlag |= CF_AIXTERM16;
424 maya 2476
425     /* xterm style 256 colors mode */
426 doda 2682 if (GetOnOff(Section, "Xterm256Color", FName, TRUE))
427     ts->ColorFlag |= CF_XTERM256;
428 maya 2476
429     /* Enable scroll buffer */
430     ts->EnableScrollBuff =
431     GetOnOff(Section, "EnableScrollBuff", FName, TRUE);
432    
433     /* Scroll buffer size */
434     ts->ScrollBuffSize =
435     GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName);
436    
437     /* VT Color */
438     GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255",
439     Temp, sizeof(Temp), FName);
440     for (i = 0; i <= 5; i++)
441     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
442     for (i = 0; i <= 1; i++)
443     ts->VTColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
444     (BYTE) ts->TmpColor[0][i * 3 + 1],
445     (BYTE) ts->TmpColor[0][i * 3 + 2]);
446    
447     /* VT Bold Color */
448     GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255",
449     Temp, sizeof(Temp), FName);
450     for (i = 0; i <= 5; i++)
451     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
452     for (i = 0; i <= 1; i++)
453     ts->VTBoldColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
454     (BYTE) ts->TmpColor[0][i * 3 + 1],
455     (BYTE) ts->TmpColor[0][i * 3 + 2]);
456 doda 2682 if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE))
457     ts->ColorFlag |= CF_BOLDCOLOR;
458 maya 2476
459     /* VT Blink Color */
460     GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255",
461     Temp, sizeof(Temp), FName);
462     for (i = 0; i <= 5; i++)
463     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
464     for (i = 0; i <= 1; i++)
465     ts->VTBlinkColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
466     (BYTE) ts->TmpColor[0][i * 3 + 1],
467     (BYTE) ts->TmpColor[0][i * 3 + 2]);
468 doda 2682 if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE))
469     ts->ColorFlag |= CF_BLINKCOLOR;
470 maya 2476
471 doda 2640 /* VT Reverse Color */
472     GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0",
473     Temp, sizeof(Temp), FName);
474     for (i = 0; i <= 5; i++)
475     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
476     for (i = 0; i <= 1; i++)
477     ts->VTReverseColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
478     (BYTE) ts->TmpColor[0][i * 3 + 1],
479     (BYTE) ts->TmpColor[0][i * 3 + 2]);
480 doda 2682 if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE))
481     ts->ColorFlag |= CF_REVERSECOLOR;
482 doda 2640
483 maya 2476 ts->EnableClickableUrl =
484     GetOnOff(Section, "EnableClickableUrl", FName, FALSE);
485    
486     /* URL Color */
487     GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255",
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->URLColor[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 doda 2682 if (GetOnOff(Section, "EnableURLColor", FName, TRUE))
496     ts->ColorFlag |= CF_URLCOLOR;
497 maya 2476
498     /* TEK Color */
499     GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255",
500     Temp, sizeof(Temp), FName);
501     for (i = 0; i <= 5; i++)
502     GetNthNum(Temp, i + 1, (int far *) &(ts->TmpColor[0][i]));
503     for (i = 0; i <= 1; i++)
504     ts->TEKColor[i] = RGB((BYTE) ts->TmpColor[0][i * 3],
505     (BYTE) ts->TmpColor[0][i * 3 + 1],
506     (BYTE) ts->TmpColor[0][i * 3 + 2]);
507    
508     #ifndef NO_ANSI_COLOR_EXTENSION
509     /* ANSI color definition (in the case FullColor=on) -- special option
510     o UseTextColor should be off, or the background and foreground color of
511     VTColor are assigned to color-number 0 and 7 respectively, even if
512     they are specified in ANSIColor.
513     o ANSIColor is a set of 4 values that are color-number(0--15),
514     red-value(0--255), green-value(0--255) and blue-value(0--255). */
515     GetPrivateProfileString(Section, "ANSIColor",
516     " 0, 0, 0, 0,"
517     " 1,255, 0, 0,"
518     " 2, 0,255, 0,"
519     " 3,255,255, 0,"
520     " 4, 0, 0,255,"
521     " 5,255, 0,255,"
522     " 6, 0,255,255,"
523     " 7,255,255,255,"
524     " 8,128,128,128,"
525     " 9,128, 0, 0,"
526     "10, 0,128, 0,"
527     "11,128,128, 0,"
528     "12, 0, 0,128,"
529     "13,128, 0,128,"
530     "14, 0,128,128,"
531     "15,192,192,192", Temp, sizeof(Temp), FName);
532     {
533     char *t;
534     int n = 1;
535     for (t = Temp; *t; t++)
536     if (*t == ',')
537     n++;
538     n /= 4;
539     for (i = 0; i <= n; i++) {
540     int colorid, r, g, b;
541     GetNthNum(Temp, i * 4 + 1, (int far *) &colorid);
542     GetNthNum(Temp, i * 4 + 2, (int far *) &r);
543     GetNthNum(Temp, i * 4 + 3, (int far *) &g);
544     GetNthNum(Temp, i * 4 + 4, (int far *) &b);
545     ts->ANSIColor[colorid & 15] =
546     RGB((BYTE) r, (BYTE) g, (BYTE) b);
547     }
548     }
549 doda 2496 #endif /* NO_ANSI_COLOR_EXTENSION */
550 maya 2476
551     TmpDC = GetDC(0); /* Get screen device context */
552     for (i = 0; i <= 1; i++)
553     ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]);
554     for (i = 0; i <= 1; i++)
555     ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]);
556     for (i = 0; i <= 1; i++)
557     ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
558     for (i = 0; i <= 1; i++)
559     ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
560     /* begin - ishizaki */
561     for (i = 0; i <= 1; i++)
562     ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]);
563     /* end - ishizaki */
564     #ifndef NO_ANSI_COLOR_EXTENSION
565     for (i = 0; i < 16; i++)
566     ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
567 doda 2496 #endif /* NO_ANSI_COLOR_EXTENSION */
568 maya 2476 ReleaseDC(0, TmpDC);
569 doda 2682 if (GetOnOff(Section, "EnableANSIColor", FName, TRUE))
570     ts->ColorFlag |= CF_ANSICOLOR;
571 maya 2476
572     /* TEK color emulation */
573     ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE);
574    
575     /* VT Font */
576     GetPrivateProfileString(Section, "VTFont", "Terminal,0,-13,1",
577     Temp, sizeof(Temp), FName);
578     GetNthString(Temp, 1, sizeof(ts->VTFont), ts->VTFont);
579     GetNthNum(Temp, 2, (int far *) &(ts->VTFontSize.x));
580     GetNthNum(Temp, 3, (int far *) &(ts->VTFontSize.y));
581     GetNthNum(Temp, 4, &(ts->VTFontCharSet));
582    
583     /* Bold font flag */
584     ts->EnableBold = GetOnOff(Section, "EnableBold", FName, TRUE);
585    
586     /* Russian character set (font) */
587     GetPrivateProfileString(Section, "RussFont", "",
588     Temp, sizeof(Temp), FName);
589     ts->RussFont = str2id(RussList, Temp, IdWindows);
590    
591     /* TEK Font */
592     GetPrivateProfileString(Section, "TEKFont", "Courier,0,-13,0",
593     Temp, sizeof(Temp), FName);
594     GetNthString(Temp, 1, sizeof(ts->TEKFont), ts->TEKFont);
595     GetNthNum(Temp, 2, (int far *) &(ts->TEKFontSize.x));
596     GetNthNum(Temp, 3, (int far *) &(ts->TEKFontSize.y));
597     GetNthNum(Temp, 4, &(ts->TEKFontCharSet));
598    
599     /* BS key */
600     GetPrivateProfileString(Section, "BSKey", "",
601     Temp, sizeof(Temp), FName);
602     if (_stricmp(Temp, "DEL") == 0)
603     ts->BSKey = IdDEL;
604     else
605     ts->BSKey = IdBS;
606     /* Delete key */
607     ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE);
608    
609     /* Meta Key */
610     ts->MetaKey = GetOnOff(Section, "MetaKey", FName, FALSE);
611    
612     /* Application Keypad */
613 doda 2496 ts->DisableAppKeypad =
614     GetOnOff(Section, "DisableAppKeypad", FName, FALSE);
615 maya 2476
616     /* Application Cursor */
617 doda 2496 ts->DisableAppCursor =
618     GetOnOff(Section, "DisableAppCursor", FName, FALSE);
619 maya 2476
620     /* Russian keyboard type */
621     GetPrivateProfileString(Section, "RussKeyb", "",
622     Temp, sizeof(Temp), FName);
623     ts->RussKeyb = str2id(RussList2, Temp, IdWindows);
624    
625     /* Serial port ID */
626     ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName);
627    
628     /* Baud rate */
629     GetPrivateProfileString(Section, "BaudRate", "9600",
630     Temp, sizeof(Temp), FName);
631     ts->Baud = str2id(BaudList, Temp, IdBaud9600);
632    
633     /* Parity */
634     GetPrivateProfileString(Section, "Parity", "",
635     Temp, sizeof(Temp), FName);
636     if (_stricmp(Temp, "even") == 0)
637     ts->Parity = IdParityEven;
638     else if (_stricmp(Temp, "odd") == 0)
639     ts->Parity = IdParityOdd;
640     else
641     ts->Parity = IdParityNone;
642    
643     /* Data bit */
644     GetPrivateProfileString(Section, "DataBit", "",
645     Temp, sizeof(Temp), FName);
646     if (_stricmp(Temp, "7") == 0)
647     ts->DataBit = IdDataBit7;
648     else
649     ts->DataBit = IdDataBit8;
650    
651     /* Stop bit */
652     GetPrivateProfileString(Section, "StopBit", "",
653     Temp, sizeof(Temp), FName);
654     if (_stricmp(Temp, "2") == 0)
655     ts->StopBit = IdStopBit2;
656     else
657     ts->StopBit = IdStopBit1;
658    
659     /* Flow control */
660     GetPrivateProfileString(Section, "FlowCtrl", "",
661     Temp, sizeof(Temp), FName);
662     if (_stricmp(Temp, "x") == 0)
663     ts->Flow = IdFlowX;
664     else if (_stricmp(Temp, "hard") == 0)
665     ts->Flow = IdFlowHard;
666     else
667     ts->Flow = IdFlowNone;
668    
669     /* Delay per character */
670     ts->DelayPerChar =
671     GetPrivateProfileInt(Section, "DelayPerChar", 0, FName);
672    
673     /* Delay per line */
674     ts->DelayPerLine =
675     GetPrivateProfileInt(Section, "DelayPerLine", 0, FName);
676    
677     /* Telnet flag */
678     ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE);
679    
680     /* Telnet terminal type */
681     GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType,
682 doda 2496 sizeof(ts->TermType), FName);
683 maya 2476
684     /* TCP port num */
685     ts->TCPPort =
686     GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName);
687    
688     /* Auto window close flag */
689     ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE);
690    
691     /* History list */
692     ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE);
693    
694     /* File transfer binary flag */
695     ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE);
696    
697     /* Log append */
698     ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE);
699    
700     /* Log plain text (2005.5.7 yutaka) */
701     ts->LogTypePlainText =
702     GetOnOff(Section, "LogTypePlainText", FName, FALSE);
703    
704     /* Log with timestamp (2006.7.23 maya) */
705     ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE);
706    
707     /* Log without transfer dialog */
708     ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE);
709    
710     /* Default Log file name (2006.8.28 maya) */
711     GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log",
712     ts->LogDefaultName, sizeof(ts->LogDefaultName),
713     FName);
714    
715     /* Default Log file path (2007.5.30 maya) */
716     GetPrivateProfileString(Section, "LogDefaultPath", "",
717     ts->LogDefaultPath, sizeof(ts->LogDefaultPath),
718     FName);
719    
720     /* Auto start logging (2007.5.31 maya) */
721     ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE);
722    
723     /* XMODEM option */
724     GetPrivateProfileString(Section, "XmodemOpt", "",
725     Temp, sizeof(Temp), FName);
726     if (_stricmp(Temp, "crc") == 0)
727     ts->XmodemOpt = XoptCRC;
728     else if (_stricmp(Temp, "1k") == 0)
729     ts->XmodemOpt = Xopt1K;
730     else
731     ts->XmodemOpt = XoptCheck;
732    
733     /* XMODEM binary file */
734     ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE);
735    
736     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
737 yutakapon 2478 GetPrivateProfileString(Section, "XModemRcvCommand", "",
738 doda 2496 ts->XModemRcvCommand,
739     sizeof(ts->XModemRcvCommand), FName);
740 maya 2476
741     /* Default directory for file transfer */
742     GetPrivateProfileString(Section, "FileDir", "",
743     ts->FileDir, sizeof(ts->FileDir), FName);
744     if (strlen(ts->FileDir) == 0)
745     strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
746     else {
747     _getcwd(Temp, sizeof(Temp));
748     if (_chdir(ts->FileDir) != 0)
749     strncpy_s(ts->FileDir, sizeof(ts->FileDir), ts->HomeDir, _TRUNCATE);
750     _chdir(Temp);
751     }
752    
753     /* filter on file send (2007.6.5 maya) */
754     GetPrivateProfileString(Section, "FileSendFilter", "",
755     ts->FileSendFilter, sizeof(ts->FileSendFilter),
756     FName);
757    
758     /*--------------------------------------------------*/
759     /* 8 bit control code flag -- special option */
760 doda 2682 if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE))
761     ts->TermFlag |= TF_ACCEPT8BITCTRL;
762 maya 2476
763     /* Wrong sequence flag -- special option */
764 doda 2682 if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE))
765     ts->TermFlag |= TF_ALLOWWRONGSEQUENCE;
766 maya 2476
767     if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) &&
768     (ts->KanjiOut == IdKanjiOutH))
769     ts->KanjiOut = IdKanjiOutJ;
770    
771     // Auto file renaming --- special option
772 doda 2682 if (GetOnOff(Section, "AutoFileRename", FName, FALSE))
773     ts->FTFlag |= FT_RENAME;
774 maya 2476
775     // Auto invoking (character set->G0->GL) --- special option
776 doda 2682 if (GetOnOff(Section, "AutoInvoke", FName, FALSE))
777     ts->TermFlag |= TF_AUTOINVOKE;
778 maya 2476
779     // Auto text copy --- special option
780     ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE);
781    
782     /* Back wrap -- special option */
783 doda 2682 if (GetOnOff(Section, "BackWrap", FName, FALSE))
784     ts->TermFlag |= TF_BACKWRAP;
785 maya 2476
786     /* Beep type -- special option */
787 doda 2554 GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName);
788     if (_stricmp(Temp, "off") == 0)
789     ts->Beep = IdBeepOff;
790     else if (_stricmp(Temp, "visual") == 0)
791     ts->Beep = IdBeepVisual;
792     else
793     ts->Beep = IdBeepOn;
794 maya 2476
795     /* Beep on connection & disconnection -- special option */
796 doda 2682 if (GetOnOff(Section, "BeepOnConnect", FName, FALSE))
797     ts->PortFlag |= PF_BEEPONCONNECT;
798 maya 2476
799     /* Auto B-Plus activation -- special option */
800 doda 2682 if (GetOnOff(Section, "BPAuto", FName, FALSE))
801     ts->FTFlag |= FT_BPAUTO;
802 maya 2476 if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */
803     strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200",
804     _TRUNCATE);
805     ts->AnswerbackLen = 5;
806     }
807    
808     /* B-Plus ESCCTL flag -- special option */
809 doda 2682 if (GetOnOff(Section, "BPEscCtl", FName, FALSE))
810     ts->FTFlag |= FT_BPESCCTL;
811 maya 2476
812     /* B-Plus log -- special option */
813 doda 2682 if (GetOnOff(Section, "BPLog", FName, FALSE))
814     ts->LogFlag |= LOG_BP;
815 maya 2476
816     /* Clear serial port buffer when port opening -- special option */
817 doda 2496 ts->ClearComBuffOnOpen =
818     GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE);
819 maya 2476
820     /* Confirm disconnection -- special option */
821 doda 2682 if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE))
822     ts->PortFlag |= PF_CONFIRMDISCONN;
823 maya 2476
824     /* Ctrl code in Kanji -- special option */
825 doda 2682 if (GetOnOff(Section, "CtrlInKanji", FName, TRUE))
826     ts->TermFlag |= TF_CTRLINKANJI;
827 maya 2476
828     /* Debug flag -- special option */
829     ts->Debug = GetOnOff(Section, "Debug", FName, FALSE);
830    
831     /* Delimiter list -- special option */
832     GetPrivateProfileString(Section, "DelimList",
833     "$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~",
834     Temp, sizeof(Temp), FName);
835     Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList));
836    
837     /* regard DBCS characters as delimiters -- special option */
838     ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE);
839    
840     // Enable popup menu -- special option
841 maya 2690 if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE))
842 maya 2476 ts->MenuFlag |= MF_NOPOPUP;
843    
844     // Enable "Show menu" -- special option
845 maya 2690 if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE))
846 maya 2476 ts->MenuFlag |= MF_NOSHOWMENU;
847    
848     // Enable the status line -- special option
849 doda 2682 if (GetOnOff(Section, "EnableStatusLine", FName, TRUE))
850     ts->TermFlag |= TF_ENABLESLINE;
851 maya 2476
852     // fixed JIS --- special
853 doda 2682 if (GetOnOff(Section, "FixedJIS", FName, FALSE))
854     ts->TermFlag |= TF_FIXEDJIS;
855 maya 2476
856     /* IME Flag -- special option */
857     ts->UseIME = GetOnOff(Section, "IME", FName, TRUE);
858    
859     /* IME-inline Flag -- special option */
860     ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE);
861    
862     /* Kermit log -- special option */
863 doda 2682 if (GetOnOff(Section, "KmtLog", FName, FALSE))
864     ts->LogFlag |= LOG_KMT;
865 maya 2476
866     // Enable language selection -- special option
867 maya 2690 if (!GetOnOff(Section, "LanguageSelection", FName, TRUE))
868 maya 2476 ts->MenuFlag |= MF_NOLANGUAGE;
869    
870     /* Maximum scroll buffer size -- special option */
871     ts->ScrollBuffMax =
872     GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName);
873     if (ts->ScrollBuffMax < 24)
874     ts->ScrollBuffMax = 10000;
875    
876     /* Max com port number -- special option */
877     ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 4, FName);
878     if (ts->MaxComPort < 4)
879     ts->MaxComPort = 4;
880     // COM16����99���g�� (2005.11.30 yutaka)
881     // 99����200���g�� (2007.7.23 maya)
882     if (ts->MaxComPort > MAXCOMPORT)
883     ts->MaxComPort = MAXCOMPORT;
884     if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort))
885     ts->ComPort = 1;
886    
887     /* Non-blinking cursor -- special option */
888     ts->NonblinkingCursor =
889     GetOnOff(Section, "NonblinkingCursor", FName, FALSE);
890    
891     // �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka)
892     ts->KillFocusCursor =
893     GetOnOff(Section, "KillFocusCursor", FName, TRUE);
894    
895     /* Delay for pass-thru printing activation */
896     /* -- special option */
897     ts->PassThruDelay =
898     GetPrivateProfileInt(Section, "PassThruDelay", 3, FName);
899    
900     /* Printer port for pass-thru printing */
901     /* -- special option */
902     GetPrivateProfileString(Section, "PassThruPort", "",
903 doda 2496 ts->PrnDev, sizeof(ts->PrnDev), FName);
904 maya 2476
905     /* Printer Font --- special option */
906     GetPrivateProfileString(Section, "PrnFont", "",
907     Temp, sizeof(Temp), FName);
908     if (strlen(Temp) == 0) {
909     ts->PrnFont[0] = 0;
910     ts->PrnFontSize.x = 0;
911     ts->PrnFontSize.y = 0;
912     ts->PrnFontCharSet = 0;
913     }
914     else {
915     GetNthString(Temp, 1, sizeof(ts->PrnFont), ts->PrnFont);
916     GetNthNum(Temp, 2, (int far *) &(ts->PrnFontSize.x));
917     GetNthNum(Temp, 3, (int far *) &(ts->PrnFontSize.y));
918     GetNthNum(Temp, 4, &(ts->PrnFontCharSet));
919     }
920    
921     // Page margins (left, right, top, bottom) for printing
922     // -- special option
923     GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50",
924     Temp, sizeof(Temp), FName);
925     for (i = 0; i <= 3; i++)
926     GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]);
927    
928     /* Quick-VAN log -- special option */
929 doda 2682 if (GetOnOff(Section, "QVLog", FName, FALSE))
930     ts->LogFlag |= LOG_QV;
931 maya 2476
932     /* Quick-VAN window size -- special */
933     ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName);
934    
935     /* Russian character set (print) -- special option */
936     GetPrivateProfileString(Section, "RussPrint", "",
937     Temp, sizeof(Temp), FName);
938     ts->RussPrint = str2id(RussList, Temp, IdWindows);
939    
940     /* Scroll threshold -- special option */
941     ts->ScrollThreshold =
942     GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName);
943    
944     ts->MouseWheelScrollLine =
945     GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName);
946    
947     // Select on activate -- special option
948     ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE);
949    
950     /* Send 8bit control sequence -- special option */
951     ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE);
952    
953     /* Startup macro -- special option */
954     GetPrivateProfileString(Section, "StartupMacro", "",
955     ts->MacroFN, sizeof(ts->MacroFN), FName);
956    
957     /* TEK GIN Mouse keycode -- special option */
958     ts->GINMouseCode =
959     GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName);
960    
961     /* Telnet Auto Detect -- special option */
962     ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE);
963    
964     /* Telnet binary flag -- special option */
965     ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE);
966    
967     /* Telnet Echo flag -- special option */
968     ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE);
969    
970     /* Telnet log -- special option */
971 doda 2682 if (GetOnOff(Section, "TelLog", FName, FALSE))
972     ts->LogFlag |= LOG_TEL;
973 maya 2476
974     /* TCP port num for telnet -- special option */
975     ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName);
976    
977     /* Telnet keep-alive packet(NOP command) interval -- special option */
978     ts->TelKeepAliveInterval =
979     GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName);
980    
981     /* Max number of broadcast commad history */
982     ts->MaxBroadcatHistory =
983     GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName);
984    
985     /* Local echo for non-telnet */
986     ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE);
987    
988     /* "new-line (transmit)" option for non-telnet -- special option */
989     GetPrivateProfileString(Section, "TCPCRSend", "",
990     Temp, sizeof(Temp), FName);
991     if (_stricmp(Temp, "CR") == 0)
992     ts->TCPCRSend = IdCR;
993     else if (_stricmp(Temp, "CRLF") == 0)
994     ts->TCPCRSend = IdCRLF;
995     else
996     ts->TCPCRSend = 0; // disabled
997    
998 doda 2682 /* Use text (background) color for "white (black)" --- special option */
999     if (GetOnOff(Section, "UseTextColor", FName, FALSE))
1000     ts->ColorFlag |= CF_USETEXTCOLOR;
1001 maya 2476
1002     /* Title format -- special option */
1003     ts->TitleFormat =
1004     GetPrivateProfileInt(Section, "TitleFormat", 5, FName);
1005    
1006     /* VT Compatible Tab -- special option */
1007     ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE);
1008    
1009     /* VT Font space --- special option */
1010     GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0",
1011     Temp, sizeof(Temp), FName);
1012     GetNthNum(Temp, 1, &ts->FontDX);
1013     GetNthNum(Temp, 2, &ts->FontDW);
1014     GetNthNum(Temp, 3, &ts->FontDY);
1015     GetNthNum(Temp, 4, &ts->FontDH);
1016     if (ts->FontDX < 0)
1017     ts->FontDX = 0;
1018     if (ts->FontDW < 0)
1019     ts->FontDW = 0;
1020     ts->FontDW = ts->FontDW + ts->FontDX;
1021     if (ts->FontDY < 0)
1022     ts->FontDY = 0;
1023     if (ts->FontDH < 0)
1024     ts->FontDH = 0;
1025     ts->FontDH = ts->FontDH + ts->FontDY;
1026    
1027     // VT-print scaling factors (pixels per inch) --- special option
1028     GetPrivateProfileString(Section, "VTPPI", "0,0",
1029     Temp, sizeof(Temp), FName);
1030     GetNthNum(Temp, 1, (int far *) &ts->VTPPI.x);
1031     GetNthNum(Temp, 2, (int far *) &ts->VTPPI.y);
1032    
1033     // TEK-print scaling factors (pixels per inch) --- special option
1034     GetPrivateProfileString(Section, "TEKPPI", "0,0",
1035     Temp, sizeof(Temp), FName);
1036     GetNthNum(Temp, 1, (int far *) &ts->TEKPPI.x);
1037     GetNthNum(Temp, 2, (int far *) &ts->TEKPPI.y);
1038    
1039     // Show "Window" menu -- special option
1040 doda 2682 if (GetOnOff(Section, "WindowMenu", FName, TRUE))
1041     ts->MenuFlag |= MF_SHOWWINMENU;
1042 maya 2476
1043     /* XMODEM log -- special option */
1044 doda 2682 if (GetOnOff(Section, "XmodemLog", FName, FALSE))
1045     ts->LogFlag |= LOG_X;
1046 maya 2476
1047 yutakapon 2539 /* YMODEM log -- special option */
1048 doda 2682 if (GetOnOff(Section, "YmodemLog", FName, FALSE))
1049     ts->LogFlag |= LOG_Y;
1050 yutakapon 2539
1051 maya 2476 /* Auto ZMODEM activation -- special option */
1052 doda 2682 if (GetOnOff(Section, "ZmodemAuto", FName, FALSE))
1053     ts->FTFlag |= FT_ZAUTO;
1054 maya 2476
1055     /* ZMODEM data subpacket length for sending -- special */
1056     ts->ZmodemDataLen =
1057     GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName);
1058     /* ZMODEM window size for sending -- special */
1059     ts->ZmodemWinSize =
1060     GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName);
1061    
1062     /* ZMODEM ESCCTL flag -- special option */
1063 doda 2682 if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE))
1064     ts->FTFlag |= FT_ZESCCTL;
1065 maya 2476
1066     /* ZMODEM log -- special option */
1067 doda 2682 if (GetOnOff(Section, "ZmodemLog", FName, FALSE))
1068     ts->LogFlag |= LOG_Z;
1069 maya 2476
1070     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
1071     GetPrivateProfileString(Section, "ZModemRcvCommand", "rz",
1072     ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName);
1073    
1074     #ifndef NO_COPYLINE_FIX
1075    
1076     /* Enable continued-line copy -- special option */
1077     ts->EnableContinuedLineCopy =
1078     GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE);
1079     #endif /* NO_COPYLINE_FIX */
1080    
1081     ts->DisablePasteMouseRButton =
1082     GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE);
1083    
1084     // added DisablePasteMouseMButton (2008.3.2 maya)
1085     ts->DisablePasteMouseMButton =
1086     GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE);
1087    
1088     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1089     ts->ConfirmPasteMouseRButton =
1090     GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE);
1091    
1092     // added ConfirmChangePaste (2008.2.3 yutaka)
1093     ts->ConfirmChangePaste =
1094 doda 2665 GetOnOff(Section, "ConfirmChangePaste", FName, TRUE);
1095 maya 2476
1096 yutakapon 2498 // added ScrollWindowClearScreen (2008.5.3 yutaka)
1097     ts->ScrollWindowClearScreen =
1098     GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE);
1099    
1100 maya 2476 // added SelectOnlyByLButton (2007.11.20 maya)
1101     ts->SelectOnlyByLButton =
1102     GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE);
1103    
1104     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1105     ts->DisableAcceleratorSendBreak =
1106     GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE);
1107    
1108     // WinSock connecting timeout value (2007.1.11 yutaka)
1109     ts->ConnectingTimeout =
1110     GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName);
1111    
1112     // mouse cursor
1113     GetPrivateProfileString(Section, "MouseCursor", "IBEAM",
1114     Temp, sizeof(Temp), FName);
1115     strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp,
1116     _TRUNCATE);
1117    
1118     // Translucent window
1119     ts->AlphaBlend =
1120     GetPrivateProfileInt(Section, "AlphaBlend ", 255, FName);
1121     ts->AlphaBlend = max(0, ts->AlphaBlend);
1122     ts->AlphaBlend = min(255, ts->AlphaBlend);
1123    
1124     // Cygwin install path
1125     GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin",
1126     Temp, sizeof(Temp), FName);
1127     strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp,
1128 doda 2496 _TRUNCATE);
1129 maya 2476
1130     // Viewlog Editor path
1131     GetPrivateProfileString(Section, "ViewlogEditor ", "notepad.exe",
1132     Temp, sizeof(Temp), FName);
1133     strncpy_s(ts->ViewlogEditor, sizeof(ts->ViewlogEditor), Temp,
1134 doda 2496 _TRUNCATE);
1135 maya 2476
1136     // Locale for UTF-8
1137     GetPrivateProfileString(Section, "Locale ", DEFAULT_LOCALE,
1138     Temp, sizeof(Temp), FName);
1139     strncpy_s(ts->Locale, sizeof(ts->Locale), Temp, _TRUNCATE);
1140    
1141     // CodePage
1142     ts->CodePage =
1143     GetPrivateProfileInt(Section, "CodePage ", DEFAULT_CODEPAGE,
1144     FName);
1145    
1146     // UI language message file
1147     GetPrivateProfileString(Section, "UILanguageFile", "lang\\Default.lng",
1148     Temp, sizeof(Temp), FName);
1149     {
1150     char CurDir[MAX_PATH];
1151    
1152     // �t���p�X�������O������������������������������
1153     strncpy_s(ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini), Temp, _TRUNCATE);
1154    
1155     GetCurrentDirectory(sizeof(CurDir), CurDir);
1156     SetCurrentDirectory(ts->HomeDir);
1157     _fullpath(ts->UILanguageFile, Temp, sizeof(ts->UILanguageFile));
1158     SetCurrentDirectory(CurDir);
1159     }
1160    
1161     // Broadcast Command History (2007.3.3 maya)
1162     ts->BroadcastCommandHistory =
1163     GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE);
1164    
1165     // 337: 2007/03/20 Accept Broadcast
1166     ts->AcceptBroadcast =
1167     GetOnOff(Section, "AcceptBroadcast", FName, TRUE);
1168    
1169     // Confirm send a file when drag and drop (2007.12.28 maya)
1170     ts->ConfirmFileDragAndDrop =
1171     GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE);
1172    
1173     // Translate mouse wheel to cursor key when application cursor mode
1174     ts->TranslateWheelToCursor =
1175     GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE);
1176    
1177     // Display "New Connection" dialog on startup (2008.1.18 maya)
1178     ts->HostDialogOnStartup =
1179     GetOnOff(Section, "HostDialogOnStartup", FName, TRUE);
1180    
1181     // Mouse event tracking
1182     ts->MouseEventTracking =
1183     GetOnOff(Section, "MouseEventTracking", FName, TRUE);
1184    
1185     // Maximized bug tweak
1186     ts->MaximizedBugTweak =
1187     GetOnOff(Section, "MaximizedBugTweak", FName, TRUE);
1188    
1189 doda 2535 // Convert Unicode symbol characters to DEC Special characters
1190     ts->UnicodeDecSpMapping =
1191     GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName);
1192 doda 2496
1193 doda 2497 // VT Window Icon
1194     GetPrivateProfileString(Section, "VTIcon", "Default",
1195     Temp, sizeof(Temp), FName);
1196     ts->VTIcon = IconName2IconId(Temp);
1197    
1198     // Tek Window Icon
1199 doda 2506 GetPrivateProfileString(Section, "TEKIcon", "Default",
1200 doda 2497 Temp, sizeof(Temp), FName);
1201 doda 2506 ts->TEKIcon = IconName2IconId(Temp);
1202 doda 2497
1203 doda 2510 // Unknown Unicode Character
1204     ts->UnknownUnicodeCharaAsWide =
1205 doda 2518 GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE);
1206 doda 2510
1207 maya 2476 #ifdef USE_NORMAL_BGCOLOR
1208     // UseNormalBGColor
1209     ts->UseNormalBGColor =
1210     GetOnOff(Section, "UseNormalBGColor", FName, FALSE);
1211     // 2006/03/11 by 337
1212     if (ts->UseNormalBGColor) {
1213     ts->VTBoldColor[1] =
1214     ts->VTBlinkColor[1] = ts->URLColor[1] = ts->VTColor[1];
1215     }
1216     #endif
1217 yutakapon 2499
1218     // AutoScrollOnlyInBottomLine
1219     ts->AutoScrollOnlyInBottomLine =
1220     GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE);
1221 doda 2558
1222     // Accept remote-controlled window title changing
1223 maya 2605 GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite",
1224 maya 2603 Temp, sizeof(Temp), FName);
1225 maya 2604 if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0)
1226 maya 2603 ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite;
1227 maya 2608 else if (_stricmp(Temp, "ahead") == 0)
1228     ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead;
1229     else if (_stricmp(Temp, "last") == 0)
1230     ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast;
1231 maya 2603 else
1232     ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff;
1233 doda 2558
1234 maya 2565 // Size of paste confirm dialog
1235     GetPrivateProfileString(Section, "PasteDialogSize", "330,220",
1236     Temp, sizeof(Temp), FName);
1237     GetNthNum(Temp, 1, &ts->PasteDialogSize.cx);
1238     GetNthNum(Temp, 2, &ts->PasteDialogSize.cy);
1239     if (ts->PasteDialogSize.cx < 0)
1240     ts->PasteDialogSize.cx = 330;
1241     if (ts->PasteDialogSize.cy < 0)
1242     ts->PasteDialogSize.cy = 220;
1243    
1244 doda 2628 // Disable mouse event tracking when Control-Key is pressed.
1245     ts->DisableMouseTrackingByCtrl =
1246 doda 2671 GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE);
1247 doda 2631
1248     // Disable TranslateWheelToCursor setting when Control-Key is pressed.
1249     ts->DisableWheelToCursorByCtrl =
1250 doda 2671 GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE);
1251 doda 2643
1252     // Strict Key Mapping.
1253     ts->StrictKeyMapping =
1254     GetOnOff(Section, "StrictKeyMapping", FName, FALSE);
1255 maya 2476 }
1256    
1257     void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1258     {
1259     int i;
1260     char Temp[MAXPATHLEN];
1261     char buf[20];
1262    
1263     /* version */
1264     WritePrivateProfileString(Section, "Version", "2.3", FName);
1265    
1266     /* Language */
1267     if (ts->Language == IdJapanese)
1268     strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1269     else if (ts->Language == IdRussian)
1270     strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1271 yutakapon 2556 else if (ts->Language == IdKorean) //HKS
1272     strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1273 maya 2476 else
1274     strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1275     WritePrivateProfileString(Section, "Language", Temp, FName);
1276    
1277     /* Port type */
1278     if (ts->PortType == IdSerial)
1279     strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1280     else /* IdFile -> IdTCPIP */
1281     strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1282    
1283     WritePrivateProfileString(Section, "Port", Temp, FName);
1284    
1285     /* Save win position */
1286     if (ts->SaveVTWinPos) {
1287     /* VT win position */
1288     WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1289     }
1290    
1291     /* VT terminal size */
1292     WriteInt2(Section, "TerminalSize", FName,
1293     ts->TerminalWidth, ts->TerminalHeight);
1294    
1295     /* Terminal size = Window size */
1296     WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1297    
1298     /* Auto window resize flag */
1299     WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1300    
1301     /* CR Receive */
1302     if (ts->CRReceive == IdCRLF) {
1303     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1304     }
1305     else if (ts->CRReceive == IdLF) {
1306     strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1307     }
1308     else {
1309     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1310     }
1311     WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1312    
1313     /* CR Send */
1314     if (ts->CRSend == IdCRLF)
1315     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1316     else
1317     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1318     WritePrivateProfileString(Section, "CRSend", Temp, FName);
1319    
1320     /* Local echo */
1321     WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1322    
1323     /* Answerback */
1324     if ((ts->FTFlag & FT_BPAUTO) == 0) {
1325     Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1326     sizeof(Temp) - 1, TRUE);
1327     WritePrivateProfileString(Section, "Answerback", Temp, FName);
1328     }
1329    
1330     /* Kanji Code (receive) */
1331     switch (ts->KanjiCode) {
1332     case IdEUC:
1333     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1334     break;
1335     case IdJIS:
1336     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1337     break;
1338     case IdUTF8:
1339     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1340     break;
1341     case IdUTF8m:
1342     strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1343     break;
1344     default:
1345     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1346     }
1347     WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1348    
1349     /* Katakana (receive) */
1350     if (ts->JIS7Katakana == 1)
1351     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1352     else
1353     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1354    
1355     WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1356    
1357     /* Kanji Code (transmit) */
1358     switch (ts->KanjiCodeSend) {
1359     case IdEUC:
1360     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1361     break;
1362     case IdJIS:
1363     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1364     break;
1365     case IdUTF8:
1366     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1367     break;
1368     default:
1369     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1370     }
1371     WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1372    
1373     /* Katakana (transmit) */
1374     if (ts->JIS7KatakanaSend == 1)
1375     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1376     else
1377     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1378    
1379     WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1380    
1381     /* KanjiIn */
1382     if (ts->KanjiIn == IdKanjiInA)
1383     strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1384     else
1385     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1386    
1387     WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1388    
1389     /* KanjiOut */
1390     switch (ts->KanjiOut) {
1391     case IdKanjiOutB:
1392     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1393     break;
1394     case IdKanjiOutH:
1395     strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1396     break;
1397     default:
1398     strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1399     }
1400     WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1401    
1402     // new configuration
1403     WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1404    
1405     WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1406     ts->DisablePasteMouseRButton);
1407    
1408     // added DisablePasteMouseMButton (2008.3.2 maya)
1409     WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1410     ts->DisablePasteMouseMButton);
1411    
1412     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1413     WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1414     ts->ConfirmPasteMouseRButton);
1415    
1416     // added ConfirmChangePaste
1417     WriteOnOff(Section, "ConfirmChangePaste", FName,
1418 doda 2496 ts->ConfirmChangePaste);
1419 maya 2476
1420 yutakapon 2498 // added ScrollWindowClearScreen
1421     WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1422     ts->ScrollWindowClearScreen);
1423    
1424 maya 2476 // added SelectOnlyByLButton (2007.11.20 maya)
1425     WriteOnOff(Section, "SelectOnlyByLButton", FName,
1426     ts->SelectOnlyByLButton);
1427     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1428     WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1429     ts->DisableAcceleratorSendBreak);
1430     WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1431     ts->EnableContinuedLineCopy);
1432     WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1433     FName);
1434     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1435     WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1436     WritePrivateProfileString(Section, "CygwinDirectory",
1437     ts->CygwinDirectory, FName);
1438     WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1439     FName);
1440     WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1441     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1442     WritePrivateProfileString(Section, "CodePage", Temp, FName);
1443    
1444     // ANSI color(2004.9.5 yutaka)
1445     Temp[0] = '\0';
1446     for (i = 0; i < 15; i++) {
1447     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1448     i,
1449     GetRValue(ts->ANSIColor[i]),
1450     GetGValue(ts->ANSIColor[i]),
1451     GetBValue(ts->ANSIColor[i])
1452     );
1453     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1454     }
1455     i = 15;
1456     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1457     i,
1458     GetRValue(ts->ANSIColor[i]),
1459     GetGValue(ts->ANSIColor[i]),
1460     GetBValue(ts->ANSIColor[i])
1461     );
1462     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1463     WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1464    
1465     /* AutoWinChange VT<->TEK */
1466     WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1467    
1468     /* Terminal ID */
1469     id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1470     WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1471    
1472     /* Russian character set (host) */
1473     id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1474     WritePrivateProfileString(Section, "RussHost", Temp, FName);
1475    
1476     /* Russian character set (client) */
1477     id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1478     WritePrivateProfileString(Section, "RussClient", Temp, FName);
1479    
1480     /* Title text */
1481     WritePrivateProfileString(Section, "Title", ts->Title, FName);
1482    
1483     /* Cursor shape */
1484     switch (ts->CursorShape) {
1485     case IdVCur:
1486     strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1487     break;
1488     case IdHCur:
1489     strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1490     break;
1491     default:
1492     strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1493     }
1494     WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1495    
1496     /* Hide title */
1497     WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1498    
1499     /* Popup menu */
1500     WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1501    
1502     /* PC-Style bold color mapping */
1503     WriteOnOff(Section, "PcBoldColor", FName,
1504     (WORD) (ts->ColorFlag & CF_PCBOLD16));
1505    
1506     /* aixterm 16 colors mode */
1507     WriteOnOff(Section, "Aixterm16Color", FName,
1508     (WORD) (ts->ColorFlag & CF_AIXTERM16));
1509    
1510     /* xterm 256 colors mode */
1511     WriteOnOff(Section, "Xterm256Color", FName,
1512     (WORD) (ts->ColorFlag & CF_XTERM256));
1513    
1514     /* Enable scroll buffer */
1515     WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1516    
1517     /* Scroll buffer size */
1518     WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1519    
1520     /* VT Color */
1521     for (i = 0; i <= 1; i++) {
1522 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1523     if (ts->ColorFlag & CF_REVERSECOLOR) {
1524     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1525     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1526     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1527     }
1528     else {
1529     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1530     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1531     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1532     }
1533     }
1534     else {
1535     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1536     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1537     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1538     }
1539 maya 2476 }
1540     WriteInt6(Section, "VTColor", FName,
1541 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1542     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1543 maya 2476
1544 doda 2640 /* VT Bold Color */
1545 maya 2476 for (i = 0; i <= 1; i++) {
1546 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1547     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1548     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1549     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1550     }
1551     else {
1552     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1553     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1554     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1555     }
1556 maya 2476 }
1557     WriteInt6(Section, "VTBoldColor", FName,
1558 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1559     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1560 maya 2476
1561 doda 2640 /* VT Blink Color */
1562 maya 2476 for (i = 0; i <= 1; i++) {
1563 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1564     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1565     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1566     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1567     }
1568     else {
1569     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1570     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1571     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1572     }
1573 maya 2476 }
1574     WriteInt6(Section, "VTBlinkColor", FName,
1575 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1576     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1577 maya 2476
1578 doda 2640 /* VT Reverse Color */
1579     for (i = 0; i <= 1; i++) {
1580 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1581     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1582     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1583     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1584     }
1585     else {
1586     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1587     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1588     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1589     }
1590 doda 2640 }
1591 maya 2656 WriteInt6(Section, "VTReverseColor", FName,
1592 doda 2640 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1593     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1594    
1595 maya 2476 WriteOnOff(Section, "EnableClickableUrl", FName,
1596 doda 2496 ts->EnableClickableUrl);
1597 maya 2476
1598     /* URL color */
1599     for (i = 0; i <= 1; i++) {
1600 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1601     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1602     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1603     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1604     }
1605     else {
1606     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1607     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1608     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1609     }
1610 maya 2476 }
1611     WriteInt6(Section, "URLColor", FName,
1612 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1613     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1614 maya 2476
1615 doda 2666 WriteOnOff(Section, "EnableBoldAttrColor", FName,
1616     (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1617    
1618     WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1619     (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1620    
1621     WriteOnOff(Section, "EnableReverseAttrColor", FName,
1622     (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1623    
1624     WriteOnOff(Section, "EnableURLColor", FName,
1625     (WORD) (ts->ColorFlag & CF_URLCOLOR));
1626    
1627     WriteOnOff(Section, "EnableANSIColor", FName,
1628     (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1629    
1630 maya 2476 /* TEK Color */
1631     for (i = 0; i <= 1; i++) {
1632     ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1633     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1634     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1635     }
1636     WriteInt6(Section, "TEKColor", FName,
1637     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1638 doda 2496 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1639 maya 2476
1640     /* TEK color emulation */
1641     WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1642    
1643     /* VT Font */
1644     WriteFont(Section, "VTFont", FName,
1645     ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1646     ts->VTFontCharSet);
1647    
1648     /* Enable bold font flag */
1649     WriteOnOff(Section, "EnableBold", FName, ts->EnableBold);
1650    
1651     /* Russian character set (font) */
1652     id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1653     WritePrivateProfileString(Section, "RussFont", Temp, FName);
1654    
1655     /* TEK Font */
1656     WriteFont(Section, "TEKFont", FName,
1657     ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1658     ts->TEKFontCharSet);
1659    
1660     /* BS key */
1661     if (ts->BSKey == IdDEL)
1662     strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1663     else
1664     strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1665     WritePrivateProfileString(Section, "BSKey", Temp, FName);
1666    
1667     /* Delete key */
1668     WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1669    
1670     /* Meta key */
1671     WriteOnOff(Section, "MetaKey", FName, ts->MetaKey);
1672    
1673     /* Application Keypad */
1674     WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1675    
1676     /* Application Cursor */
1677     WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1678    
1679     /* Russian keyboard type */
1680     id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1681     WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1682    
1683     /* Serial port ID */
1684     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1685     WritePrivateProfileString(Section, "ComPort", Temp, FName);
1686    
1687     /* Baud rate */
1688     id2str(BaudList, ts->Baud, IdBaud9600, Temp, sizeof(Temp));
1689     WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1690    
1691     /* Parity */
1692     switch (ts->Parity) {
1693     case IdParityEven:
1694     strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1695     break;
1696     case IdParityOdd:
1697     strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1698     break;
1699     default:
1700     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1701     }
1702     WritePrivateProfileString(Section, "Parity", Temp, FName);
1703    
1704     /* Data bit */
1705     if (ts->DataBit == IdDataBit7)
1706     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1707     else
1708     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1709    
1710     WritePrivateProfileString(Section, "DataBit", Temp, FName);
1711    
1712     /* Stop bit */
1713     if (ts->StopBit == IdStopBit2)
1714     strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1715     else
1716     strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1717    
1718     WritePrivateProfileString(Section, "StopBit", Temp, FName);
1719    
1720     /* Flow control */
1721     switch (ts->Flow) {
1722     case IdFlowX:
1723     strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1724     break;
1725     case IdFlowHard:
1726     strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1727     break;
1728     default:
1729     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1730     }
1731     WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1732    
1733     /* Delay per character */
1734     WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1735    
1736     /* Delay per line */
1737     WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1738    
1739     /* Telnet flag */
1740     WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1741    
1742     /* Telnet terminal type */
1743     WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
1744    
1745     /* TCP port num for non-telnet */
1746     WriteUint(Section, "TCPPort", FName, ts->TCPPort);
1747    
1748     /* Auto close flag */
1749     WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
1750    
1751     /* History list */
1752     WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
1753    
1754     /* File transfer binary flag */
1755     WriteOnOff(Section, "TransBin", FName, ts->TransBin);
1756    
1757     /* Log append */
1758     WriteOnOff(Section, "LogAppend", FName, ts->Append);
1759    
1760     /* File transfer binary flag */
1761     WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
1762    
1763     /* Log with timestamp (2006.7.23 maya) */
1764     WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
1765    
1766     /* Log without transfer dialog */
1767     WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
1768    
1769     /* Default Log file name (2006.8.28 maya) */
1770     WritePrivateProfileString(Section, "LogDefaultName",
1771 doda 2496 ts->LogDefaultName, FName);
1772 maya 2476
1773     /* Default Log file path (2007.5.30 maya) */
1774     WritePrivateProfileString(Section, "LogDefaultPath",
1775 doda 2496 ts->LogDefaultPath, FName);
1776 maya 2476
1777     /* Auto start logging (2007.5.31 maya) */
1778     WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
1779    
1780     /* XMODEM option */
1781     switch (ts->XmodemOpt) {
1782     case XoptCRC:
1783     strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
1784     break;
1785     case Xopt1K:
1786     strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
1787     break;
1788     default:
1789     strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
1790     }
1791     WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
1792    
1793     /* XMODEM binary flag */
1794     WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
1795    
1796     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1797 doda 2496 WritePrivateProfileString(Section, "XmodemRcvCommand",
1798     ts->XModemRcvCommand, FName);
1799 maya 2476
1800     /* Default directory for file transfer */
1801     WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
1802    
1803     /* filter on file send (2007.6.5 maya) */
1804     WritePrivateProfileString(Section, "FileSendFilter",
1805 doda 2496 ts->FileSendFilter, FName);
1806 maya 2476
1807     /*------------------------------------------------------------------*/
1808     /* 8 bit control code flag -- special option */
1809     WriteOnOff(Section, "Accept8BitCtrl", FName,
1810 doda 2496 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
1811 maya 2476
1812     /* Wrong sequence flag -- special option */
1813     WriteOnOff(Section, "AllowWrongSequence", FName,
1814 doda 2496 (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
1815 maya 2476
1816     /* Auto file renaming --- special option */
1817     WriteOnOff(Section, "AutoFileRename", FName,
1818 doda 2496 (WORD) (ts->FTFlag & FT_RENAME));
1819 maya 2476
1820     /* Auto text copy --- special option */
1821     WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
1822    
1823     /* Back wrap -- special option */
1824     WriteOnOff(Section, "BackWrap", FName,
1825     (WORD) (ts->TermFlag & TF_BACKWRAP));
1826    
1827     /* Beep type -- special option */
1828     WriteOnOff(Section, "Beep", FName, ts->Beep);
1829 doda 2554 switch (ts->Beep) {
1830     case IdBeepOff:
1831     WritePrivateProfileString(Section, "Beep", "Off", FName);
1832     break;
1833     case IdBeepOn:
1834     WritePrivateProfileString(Section, "Beep", "On", FName);
1835     break;
1836     case IdBeepVisual:
1837     WritePrivateProfileString(Section, "Beep", "Visual", FName);
1838     break;
1839     }
1840 maya 2476
1841     /* Beep on connection & disconnection -- special option */
1842     WriteOnOff(Section, "BeepOnConnect", FName,
1843     (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
1844    
1845     /* Auto B-Plus activation -- special option */
1846     WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
1847    
1848     /* B-Plus ESCCTL flag -- special option */
1849     WriteOnOff(Section, "BPEscCtl", FName,
1850     (WORD) (ts->FTFlag & FT_BPESCCTL));
1851    
1852     /* B-Plus log -- special option */
1853     WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
1854    
1855     /* Clear serial port buffer when port opening -- special option */
1856     WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
1857    
1858     /* Confirm disconnection -- special option */
1859     WriteOnOff(Section, "ConfirmDisconnect", FName,
1860     (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
1861    
1862     /* Ctrl code in Kanji -- special option */
1863     WriteOnOff(Section, "CtrlInKanji", FName,
1864     (WORD) (ts->TermFlag & TF_CTRLINKANJI));
1865    
1866     /* Debug flag -- special option */
1867     WriteOnOff(Section, "Debug", FName, ts->Debug);
1868    
1869     /* Delimiter list -- special option */
1870     Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
1871     sizeof(Temp) - 1, TRUE);
1872     WritePrivateProfileString(Section, "DelimList", Temp, FName);
1873    
1874     /* regard DBCS characters as delimiters -- special option */
1875     WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
1876    
1877     // Enable popup menu -- special option
1878     if ((ts->MenuFlag & MF_NOPOPUP) == 0)
1879     WriteOnOff(Section, "EnablePopupMenu", FName, 1);
1880     else
1881     WriteOnOff(Section, "EnablePopupMenu", FName, 0);
1882    
1883     // Enable "Show menu" -- special option
1884     if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
1885     WriteOnOff(Section, "EnableShowMenu", FName, 1);
1886     else
1887     WriteOnOff(Section, "EnableShowMenu", FName, 0);
1888    
1889     /* Enable the status line -- special option */
1890     WriteOnOff(Section, "EnableStatusLine", FName,
1891     (WORD) (ts->TermFlag & TF_ENABLESLINE));
1892    
1893     /* IME Flag -- special option */
1894     WriteOnOff(Section, "IME", FName, ts->UseIME);
1895    
1896     /* IME-inline Flag -- special option */
1897     WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
1898    
1899     /* Kermit log -- special option */
1900     WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
1901    
1902     // Enable language selection -- special option
1903     if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
1904     WriteOnOff(Section, "LanguageSelection", FName, 1);
1905     else
1906     WriteOnOff(Section, "LanguageSelection", FName, 0);
1907    
1908     /* Maximum scroll buffer size -- special option */
1909     WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
1910    
1911     /* Max com port number -- special option */
1912     WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
1913    
1914     /* Non-blinking cursor -- special option */
1915     WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
1916    
1917     WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
1918    
1919     /* Delay for pass-thru printing activation */
1920     /* -- special option */
1921     WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
1922    
1923     /* Printer port for pass-thru printing */
1924     /* -- special option */
1925     WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
1926    
1927     /* Printer Font --- special option */
1928     WriteFont(Section, "PrnFont", FName,
1929     ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
1930     ts->PrnFontCharSet);
1931    
1932     // Page margins (left, right, top, bottom) for printing
1933     // -- special option
1934     WriteInt4(Section, "PrnMargin", FName,
1935     ts->PrnMargin[0], ts->PrnMargin[1],
1936     ts->PrnMargin[2], ts->PrnMargin[3]);
1937    
1938     /* Quick-VAN log -- special option */
1939     WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
1940    
1941     /* Quick-VAN window size -- special */
1942     WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
1943    
1944     /* Russian character set (print) -- special option */
1945     id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
1946     WritePrivateProfileString(Section, "RussPrint", Temp, FName);
1947    
1948     /* Scroll threshold -- special option */
1949     WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
1950    
1951     WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
1952    
1953     // Select on activate -- special option
1954     WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
1955    
1956     /* Send 8bit control sequence -- special option */
1957     WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
1958    
1959     /* Startup macro -- special option */
1960     WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
1961    
1962     /* TEK GIN Mouse keycode -- special option */
1963     WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
1964    
1965     /* Telnet Auto Detect -- special option */
1966     WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
1967    
1968     /* Telnet binary flag -- special option */
1969     WriteOnOff(Section, "TelBin", FName, ts->TelBin);
1970    
1971     /* Telnet Echo flag -- special option */
1972     WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
1973    
1974     /* Telnet log -- special option */
1975     WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
1976    
1977     /* TCP port num for telnet -- special option */
1978     WriteUint(Section, "TelPort", FName, ts->TelPort);
1979    
1980     /* Telnet keep-alive packet(NOP command) interval -- special option */
1981     WriteUint(Section, "TelKeepAliveInterval", FName,
1982     ts->TelKeepAliveInterval);
1983    
1984     /* Max number of broadcast commad history */
1985     WriteUint(Section, "MaxBroadcatHistory", FName,
1986     ts->MaxBroadcatHistory);
1987    
1988     /* Local echo for non-telnet */
1989     WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
1990    
1991     /* "new-line (transmit)" option for non-telnet -- special option */
1992     if (ts->TCPCRSend == IdCRLF)
1993     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1994     else if (ts->TCPCRSend == IdCR)
1995     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1996     else
1997     Temp[0] = 0;
1998     WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
1999    
2000     /* Use text (background) color for "white (black)"
2001     --- special option */
2002     WriteOnOff(Section, "UseTextColor", FName,
2003     (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2004    
2005     /* Title format -- special option */
2006     WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2007    
2008     /* VT Compatible Tab -- special option */
2009     WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2010    
2011     /* VT Font space --- special option */
2012     WriteInt4(Section, "VTFontSpace", FName,
2013     ts->FontDX, ts->FontDW - ts->FontDX,
2014     ts->FontDY, ts->FontDH - ts->FontDY);
2015    
2016     // VT-print scaling factors (pixels per inch) --- special option
2017     WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2018    
2019     // TEK-print scaling factors (pixels per inch) --- special option
2020     WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2021    
2022     // Show "Window" menu -- special option
2023     WriteOnOff(Section, "WindowMenu", FName,
2024     (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2025    
2026     /* XMODEM log -- special option */
2027     WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2028    
2029 yutakapon 2539 /* YMODEM log -- special option */
2030     WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2031    
2032 maya 2476 /* Auto ZMODEM activation -- special option */
2033     WriteOnOff(Section, "ZmodemAuto", FName,
2034     (WORD) (ts->FTFlag & FT_ZAUTO));
2035    
2036     /* ZMODEM data subpacket length for sending -- special */
2037     WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2038     /* ZMODEM window size for sending -- special */
2039     WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2040    
2041     /* ZMODEM ESCCTL flag -- special option */
2042     WriteOnOff(Section, "ZmodemEscCtl", FName,
2043     (WORD) (ts->FTFlag & FT_ZESCCTL));
2044    
2045     /* ZMODEM log -- special option */
2046     WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2047    
2048     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2049     WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
2050    
2051     /* update file */
2052     WritePrivateProfileString(NULL, NULL, NULL, FName);
2053    
2054     // Eterm lookfeel alphablend (2005.4.24 yutaka)
2055     #define ETERM_SECTION "BG"
2056     WriteOnOff(ETERM_SECTION, "BGEnable", FName,
2057     ts->EtermLookfeel.BGEnable);
2058     WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
2059     ts->EtermLookfeel.BGUseAlphaBlendAPI);
2060     WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
2061     ts->EtermLookfeel.BGSPIPath, FName);
2062     WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
2063     ts->EtermLookfeel.BGFastSizeMove);
2064     WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
2065     ts->EtermLookfeel.BGNoCopyBits);
2066     WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
2067     ts->EtermLookfeel.BGNoFrame);
2068     WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2069     ts->EtermLookfeel.BGThemeFile, FName);
2070    
2071     #ifdef USE_NORMAL_BGCOLOR
2072     // UseNormalBGColor
2073     WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2074     #endif
2075    
2076     // UI language message file
2077     WritePrivateProfileString(Section, "UILanguageFile",
2078     ts->UILanguageFile_ini, FName);
2079    
2080     // Broadcast Command History (2007.3.3 maya)
2081     WriteOnOff(Section, "BroadcastCommandHistory", FName,
2082     ts->BroadcastCommandHistory);
2083    
2084     // 337: 2007/03/20 Accept Broadcast
2085     WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2086    
2087     // Confirm send a file when drag and drop (2007.12.28 maya)
2088     WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2089     ts->ConfirmFileDragAndDrop);
2090    
2091     // Translate mouse wheel to cursor key when application cursor mode
2092     WriteOnOff(Section, "TranslateWheelToCursor", FName,
2093     ts->TranslateWheelToCursor);
2094    
2095     // Display "New Connection" dialog on startup (2008.1.18 maya)
2096     WriteOnOff(Section, "HostDialogOnStartup", FName,
2097     ts->HostDialogOnStartup);
2098    
2099     // Mouse event tracking
2100     WriteOnOff(Section, "MouseEventTracking", FName,
2101     ts->MouseEventTracking);
2102    
2103     // Maximized bug tweak
2104 doda 2496 WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2105    
2106 doda 2535 // Convert Unicode symbol characters to DEC Special characters
2107     WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2108 doda 2497
2109     // VT Window Icon
2110     IconId2IconName(Temp, sizeof(Temp), ts->VTIcon);
2111     WritePrivateProfileString(Section, "VTIcon", Temp, FName);
2112    
2113     // Tek Window Icon
2114 doda 2506 IconId2IconName(Temp, sizeof(Temp), ts->TEKIcon);
2115     WritePrivateProfileString(Section, "TEKIcon", Temp, FName);
2116 yutakapon 2499
2117     // AutoScrollOnlyInBottomLine
2118     WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2119     ts->AutoScrollOnlyInBottomLine);
2120 doda 2510
2121     // Unknown Unicode Character
2122     WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2123     ts->UnknownUnicodeCharaAsWide);
2124 doda 2558
2125     // Accept remote-controlled window title changing
2126 maya 2603 if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2127     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2128     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2129     strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2130 maya 2608 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2131     strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2132     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2133     strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2134 maya 2603 else
2135     Temp[0] = 0;
2136     WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2137 maya 2565
2138     // Size of paste confirm dialog
2139     WriteInt2(Section, "PasteDialogSize", FName,
2140     ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2141 doda 2628
2142     // Disable mouse event tracking when Control-Key is pressed.
2143     WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2144     ts->DisableMouseTrackingByCtrl);
2145 doda 2631
2146     // Disable TranslateWHeelToCursor when Control-Key is pressed.
2147     WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2148     ts->DisableWheelToCursorByCtrl);
2149 doda 2643
2150     // Strict Key Mapping.
2151     WriteOnOff(Section, "StrictKeyMapping", FName,
2152     ts->StrictKeyMapping);
2153 maya 2476 }
2154    
2155     #define VTEditor "VT editor keypad"
2156     #define VTNumeric "VT numeric keypad"
2157     #define VTFunction "VT function keys"
2158     #define XFunction "X function keys"
2159     #define ShortCut "Shortcut keys"
2160    
2161     void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2162     {
2163     char Temp[11];
2164     WORD Num;
2165    
2166     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2167     if (Temp[0] == 0)
2168     Num = 0xFFFF;
2169     else if (_stricmp(Temp, "off") == 0)
2170     Num = 0xFFFF;
2171     else if (sscanf(Temp, "%d", &Num) != 1)
2172     Num = 0xFFFF;
2173    
2174     KeyMap->Map[KeyId - 1] = Num;
2175     }
2176    
2177     void FAR PASCAL ReadKeyboardCnf
2178     (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2179     int i, j, Ptr;
2180     char EntName[7];
2181     char TempStr[221];
2182     char KStr[201];
2183    
2184     // clear key map
2185     for (i = 0; i <= IdKeyMax - 1; i++)
2186     KeyMap->Map[i] = 0xFFFF;
2187     for (i = 0; i <= NumOfUserKey - 1; i++) {
2188     KeyMap->UserKeyPtr[i] = 0;
2189     KeyMap->UserKeyLen[i] = 0;
2190     }
2191    
2192     // VT editor keypad
2193     GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2194    
2195     GetInt(KeyMap, IdDown, VTEditor, "Down", FName);
2196    
2197     GetInt(KeyMap, IdRight, VTEditor, "Right", FName);
2198    
2199     GetInt(KeyMap, IdLeft, VTEditor, "Left", FName);
2200    
2201     GetInt(KeyMap, IdFind, VTEditor, "Find", FName);
2202    
2203     GetInt(KeyMap, IdInsert, VTEditor, "Insert", FName);
2204    
2205     GetInt(KeyMap, IdRemove, VTEditor, "Remove", FName);
2206    
2207     GetInt(KeyMap, IdSelect, VTEditor, "Select", FName);
2208    
2209     GetInt(KeyMap, IdPrev, VTEditor, "Prev", FName);
2210    
2211     GetInt(KeyMap, IdNext, VTEditor, "Next", FName);
2212    
2213     // VT numeric keypad
2214     GetInt(KeyMap, Id0, VTNumeric, "Num0", FName);
2215    
2216     GetInt(KeyMap, Id1, VTNumeric, "Num1", FName);
2217    
2218     GetInt(KeyMap, Id2, VTNumeric, "Num2", FName);
2219    
2220     GetInt(KeyMap, Id3, VTNumeric, "Num3", FName);
2221    
2222     GetInt(KeyMap, Id4, VTNumeric, "Num4", FName);
2223    
2224     GetInt(KeyMap, Id5, VTNumeric, "Num5", FName);
2225    
2226     GetInt(KeyMap, Id6, VTNumeric, "Num6", FName);
2227    
2228     GetInt(KeyMap, Id7, VTNumeric, "Num7", FName);
2229    
2230     GetInt(KeyMap, Id8, VTNumeric, "Num8", FName);
2231    
2232     GetInt(KeyMap, Id9, VTNumeric, "Num9", FName);
2233    
2234     GetInt(KeyMap, IdMinus, VTNumeric, "NumMinus", FName);
2235    
2236     GetInt(KeyMap, IdComma, VTNumeric, "NumComma", FName);
2237    
2238     GetInt(KeyMap, IdPeriod, VTNumeric, "NumPeriod", FName);
2239    
2240     GetInt(KeyMap, IdEnter, VTNumeric, "NumEnter", FName);
2241    
2242     GetInt(KeyMap, IdSlash, VTNumeric, "NumSlash", FName);
2243    
2244     GetInt(KeyMap, IdAsterisk, VTNumeric, "NumAsterisk", FName);
2245