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 2712 - (hide annotations) (download) (as text)
Mon Mar 23 14:31:00 2009 UTC (15 years ago) by yutakapon
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 92611 byte(s)
wait4allマクロコマンドを enable/disable できるように、teraterm.ini にエントリを追加した。
ただし、当該機能はうまく動かない場合もあるようなので、デフォルトでは off とする。
今後、動作に進展がないようであれば、4.63リリース時には、マニュアルからリンクを外しておく必要あり。

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 yutakapon 2712
1256     // added Wait4allMacroCommand (2009.3.23 yutaka)
1257     ts->Wait4allMacroCommand =
1258     GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE);
1259 maya 2476 }
1260    
1261     void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1262     {
1263     int i;
1264     char Temp[MAXPATHLEN];
1265     char buf[20];
1266    
1267     /* version */
1268     WritePrivateProfileString(Section, "Version", "2.3", FName);
1269    
1270     /* Language */
1271     if (ts->Language == IdJapanese)
1272     strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1273     else if (ts->Language == IdRussian)
1274     strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1275 yutakapon 2556 else if (ts->Language == IdKorean) //HKS
1276     strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1277 maya 2476 else
1278     strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1279     WritePrivateProfileString(Section, "Language", Temp, FName);
1280    
1281     /* Port type */
1282     if (ts->PortType == IdSerial)
1283     strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1284     else /* IdFile -> IdTCPIP */
1285     strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1286    
1287     WritePrivateProfileString(Section, "Port", Temp, FName);
1288    
1289     /* Save win position */
1290     if (ts->SaveVTWinPos) {
1291     /* VT win position */
1292     WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1293     }
1294    
1295     /* VT terminal size */
1296     WriteInt2(Section, "TerminalSize", FName,
1297     ts->TerminalWidth, ts->TerminalHeight);
1298    
1299     /* Terminal size = Window size */
1300     WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1301    
1302     /* Auto window resize flag */
1303     WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1304    
1305     /* CR Receive */
1306     if (ts->CRReceive == IdCRLF) {
1307     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1308     }
1309     else if (ts->CRReceive == IdLF) {
1310     strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1311     }
1312     else {
1313     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1314     }
1315     WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1316    
1317     /* CR Send */
1318     if (ts->CRSend == IdCRLF)
1319     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1320     else
1321     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1322     WritePrivateProfileString(Section, "CRSend", Temp, FName);
1323    
1324     /* Local echo */
1325     WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1326    
1327     /* Answerback */
1328     if ((ts->FTFlag & FT_BPAUTO) == 0) {
1329     Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1330     sizeof(Temp) - 1, TRUE);
1331     WritePrivateProfileString(Section, "Answerback", Temp, FName);
1332     }
1333    
1334     /* Kanji Code (receive) */
1335     switch (ts->KanjiCode) {
1336     case IdEUC:
1337     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1338     break;
1339     case IdJIS:
1340     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1341     break;
1342     case IdUTF8:
1343     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1344     break;
1345     case IdUTF8m:
1346     strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1347     break;
1348     default:
1349     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1350     }
1351     WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1352    
1353     /* Katakana (receive) */
1354     if (ts->JIS7Katakana == 1)
1355     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1356     else
1357     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1358    
1359     WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1360    
1361     /* Kanji Code (transmit) */
1362     switch (ts->KanjiCodeSend) {
1363     case IdEUC:
1364     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1365     break;
1366     case IdJIS:
1367     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1368     break;
1369     case IdUTF8:
1370     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1371     break;
1372     default:
1373     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1374     }
1375     WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1376    
1377     /* Katakana (transmit) */
1378     if (ts->JIS7KatakanaSend == 1)
1379     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1380     else
1381     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1382    
1383     WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1384    
1385     /* KanjiIn */
1386     if (ts->KanjiIn == IdKanjiInA)
1387     strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1388     else
1389     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1390    
1391     WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1392    
1393     /* KanjiOut */
1394     switch (ts->KanjiOut) {
1395     case IdKanjiOutB:
1396     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1397     break;
1398     case IdKanjiOutH:
1399     strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1400     break;
1401     default:
1402     strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1403     }
1404     WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1405    
1406     // new configuration
1407     WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1408    
1409     WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1410     ts->DisablePasteMouseRButton);
1411    
1412     // added DisablePasteMouseMButton (2008.3.2 maya)
1413     WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1414     ts->DisablePasteMouseMButton);
1415    
1416     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1417     WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1418     ts->ConfirmPasteMouseRButton);
1419    
1420     // added ConfirmChangePaste
1421     WriteOnOff(Section, "ConfirmChangePaste", FName,
1422 doda 2496 ts->ConfirmChangePaste);
1423 maya 2476
1424 yutakapon 2498 // added ScrollWindowClearScreen
1425     WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1426     ts->ScrollWindowClearScreen);
1427    
1428 maya 2476 // added SelectOnlyByLButton (2007.11.20 maya)
1429     WriteOnOff(Section, "SelectOnlyByLButton", FName,
1430     ts->SelectOnlyByLButton);
1431     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1432     WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1433     ts->DisableAcceleratorSendBreak);
1434     WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1435     ts->EnableContinuedLineCopy);
1436     WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1437     FName);
1438     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1439     WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1440     WritePrivateProfileString(Section, "CygwinDirectory",
1441     ts->CygwinDirectory, FName);
1442     WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1443     FName);
1444     WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1445     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1446     WritePrivateProfileString(Section, "CodePage", Temp, FName);
1447    
1448     // ANSI color(2004.9.5 yutaka)
1449     Temp[0] = '\0';
1450     for (i = 0; i < 15; i++) {
1451     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1452     i,
1453     GetRValue(ts->ANSIColor[i]),
1454     GetGValue(ts->ANSIColor[i]),
1455     GetBValue(ts->ANSIColor[i])
1456     );
1457     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1458     }
1459     i = 15;
1460     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1461     i,
1462     GetRValue(ts->ANSIColor[i]),
1463     GetGValue(ts->ANSIColor[i]),
1464     GetBValue(ts->ANSIColor[i])
1465     );
1466     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1467     WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1468    
1469     /* AutoWinChange VT<->TEK */
1470     WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1471    
1472     /* Terminal ID */
1473     id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1474     WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1475    
1476     /* Russian character set (host) */
1477     id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1478     WritePrivateProfileString(Section, "RussHost", Temp, FName);
1479    
1480     /* Russian character set (client) */
1481     id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1482     WritePrivateProfileString(Section, "RussClient", Temp, FName);
1483    
1484     /* Title text */
1485     WritePrivateProfileString(Section, "Title", ts->Title, FName);
1486    
1487     /* Cursor shape */
1488     switch (ts->CursorShape) {
1489     case IdVCur:
1490     strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1491     break;
1492     case IdHCur:
1493     strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1494     break;
1495     default:
1496     strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1497     }
1498     WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1499    
1500     /* Hide title */
1501     WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1502    
1503     /* Popup menu */
1504     WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1505    
1506     /* PC-Style bold color mapping */
1507     WriteOnOff(Section, "PcBoldColor", FName,
1508     (WORD) (ts->ColorFlag & CF_PCBOLD16));
1509    
1510     /* aixterm 16 colors mode */
1511     WriteOnOff(Section, "Aixterm16Color", FName,
1512     (WORD) (ts->ColorFlag & CF_AIXTERM16));
1513    
1514     /* xterm 256 colors mode */
1515     WriteOnOff(Section, "Xterm256Color", FName,
1516     (WORD) (ts->ColorFlag & CF_XTERM256));
1517    
1518     /* Enable scroll buffer */
1519     WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1520    
1521     /* Scroll buffer size */
1522     WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1523    
1524     /* VT Color */
1525     for (i = 0; i <= 1; i++) {
1526 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1527     if (ts->ColorFlag & CF_REVERSECOLOR) {
1528     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1529     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1530     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1531     }
1532     else {
1533     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1534     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1535     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1536     }
1537     }
1538     else {
1539     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1540     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1541     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1542     }
1543 maya 2476 }
1544     WriteInt6(Section, "VTColor", FName,
1545 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1546     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1547 maya 2476
1548 doda 2640 /* VT Bold Color */
1549 maya 2476 for (i = 0; i <= 1; i++) {
1550 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1551     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1552     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1553     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1554     }
1555     else {
1556     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1557     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1558     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1559     }
1560 maya 2476 }
1561     WriteInt6(Section, "VTBoldColor", FName,
1562 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1563     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1564 maya 2476
1565 doda 2640 /* VT Blink Color */
1566 maya 2476 for (i = 0; i <= 1; i++) {
1567 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1568     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1569     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1570     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1571     }
1572     else {
1573     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1574     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1575     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1576     }
1577 maya 2476 }
1578     WriteInt6(Section, "VTBlinkColor", FName,
1579 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1580     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1581 maya 2476
1582 doda 2640 /* VT Reverse Color */
1583     for (i = 0; i <= 1; i++) {
1584 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1585     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1586     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1587     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1588     }
1589     else {
1590     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1591     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1592     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1593     }
1594 doda 2640 }
1595 maya 2656 WriteInt6(Section, "VTReverseColor", FName,
1596 doda 2640 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1597     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1598    
1599 maya 2476 WriteOnOff(Section, "EnableClickableUrl", FName,
1600 doda 2496 ts->EnableClickableUrl);
1601 maya 2476
1602     /* URL color */
1603     for (i = 0; i <= 1; i++) {
1604 doda 2680 if (ts->ColorFlag & CF_REVERSEVIDEO) {
1605     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1606     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1607     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1608     }
1609     else {
1610     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1611     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1612     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1613     }
1614 maya 2476 }
1615     WriteInt6(Section, "URLColor", FName,
1616 doda 2496 ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1617     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1618 maya 2476
1619 doda 2666 WriteOnOff(Section, "EnableBoldAttrColor", FName,
1620     (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1621    
1622     WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1623     (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1624    
1625     WriteOnOff(Section, "EnableReverseAttrColor", FName,
1626     (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1627    
1628     WriteOnOff(Section, "EnableURLColor", FName,
1629     (WORD) (ts->ColorFlag & CF_URLCOLOR));
1630    
1631     WriteOnOff(Section, "EnableANSIColor", FName,
1632     (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1633    
1634 maya 2476 /* TEK Color */
1635     for (i = 0; i <= 1; i++) {
1636     ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1637     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1638     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1639     }
1640     WriteInt6(Section, "TEKColor", FName,
1641     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1642 doda 2496 ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1643 maya 2476
1644     /* TEK color emulation */
1645     WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1646    
1647     /* VT Font */
1648     WriteFont(Section, "VTFont", FName,
1649     ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1650     ts->VTFontCharSet);
1651    
1652     /* Enable bold font flag */
1653     WriteOnOff(Section, "EnableBold", FName, ts->EnableBold);
1654    
1655     /* Russian character set (font) */
1656     id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1657     WritePrivateProfileString(Section, "RussFont", Temp, FName);
1658    
1659     /* TEK Font */
1660     WriteFont(Section, "TEKFont", FName,
1661     ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1662     ts->TEKFontCharSet);
1663    
1664     /* BS key */
1665     if (ts->BSKey == IdDEL)
1666     strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1667     else
1668     strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1669     WritePrivateProfileString(Section, "BSKey", Temp, FName);
1670    
1671     /* Delete key */
1672     WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1673    
1674     /* Meta key */
1675     WriteOnOff(Section, "MetaKey", FName, ts->MetaKey);
1676    
1677     /* Application Keypad */
1678     WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1679    
1680     /* Application Cursor */
1681     WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1682    
1683     /* Russian keyboard type */
1684     id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1685     WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1686    
1687     /* Serial port ID */
1688     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1689     WritePrivateProfileString(Section, "ComPort", Temp, FName);
1690    
1691     /* Baud rate */
1692     id2str(BaudList, ts->Baud, IdBaud9600, Temp, sizeof(Temp));
1693     WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1694    
1695     /* Parity */
1696     switch (ts->Parity) {
1697     case IdParityEven:
1698     strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1699     break;
1700     case IdParityOdd:
1701     strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1702     break;
1703     default:
1704     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1705     }
1706     WritePrivateProfileString(Section, "Parity", Temp, FName);
1707    
1708     /* Data bit */
1709     if (ts->DataBit == IdDataBit7)
1710     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1711     else
1712     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1713    
1714     WritePrivateProfileString(Section, "DataBit", Temp, FName);
1715    
1716     /* Stop bit */
1717     if (ts->StopBit == IdStopBit2)
1718     strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1719     else
1720     strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1721    
1722     WritePrivateProfileString(Section, "StopBit", Temp, FName);
1723    
1724     /* Flow control */
1725     switch (ts->Flow) {
1726     case IdFlowX:
1727     strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1728     break;
1729     case IdFlowHard:
1730     strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1731     break;
1732     default:
1733     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1734     }
1735     WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1736    
1737     /* Delay per character */
1738     WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1739    
1740     /* Delay per line */
1741     WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1742    
1743     /* Telnet flag */
1744     WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1745    
1746     /* Telnet terminal type */
1747     WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
1748    
1749     /* TCP port num for non-telnet */
1750     WriteUint(Section, "TCPPort", FName, ts->TCPPort);
1751    
1752     /* Auto close flag */
1753     WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
1754    
1755     /* History list */
1756     WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
1757    
1758     /* File transfer binary flag */
1759     WriteOnOff(Section, "TransBin", FName, ts->TransBin);
1760    
1761     /* Log append */
1762     WriteOnOff(Section, "LogAppend", FName, ts->Append);
1763    
1764     /* File transfer binary flag */
1765     WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
1766    
1767     /* Log with timestamp (2006.7.23 maya) */
1768     WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
1769    
1770     /* Log without transfer dialog */
1771     WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
1772    
1773     /* Default Log file name (2006.8.28 maya) */
1774     WritePrivateProfileString(Section, "LogDefaultName",
1775 doda 2496 ts->LogDefaultName, FName);
1776 maya 2476
1777     /* Default Log file path (2007.5.30 maya) */
1778     WritePrivateProfileString(Section, "LogDefaultPath",
1779 doda 2496 ts->LogDefaultPath, FName);
1780 maya 2476
1781     /* Auto start logging (2007.5.31 maya) */
1782     WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
1783    
1784     /* XMODEM option */
1785     switch (ts->XmodemOpt) {
1786     case XoptCRC:
1787     strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
1788     break;
1789     case Xopt1K:
1790     strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
1791     break;
1792     default:
1793     strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
1794     }
1795     WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
1796    
1797     /* XMODEM binary flag */
1798     WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
1799    
1800     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
1801 doda 2496 WritePrivateProfileString(Section, "XmodemRcvCommand",
1802     ts->XModemRcvCommand, FName);
1803 maya 2476
1804     /* Default directory for file transfer */
1805     WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
1806    
1807     /* filter on file send (2007.6.5 maya) */
1808     WritePrivateProfileString(Section, "FileSendFilter",
1809 doda 2496 ts->FileSendFilter, FName);
1810 maya 2476
1811     /*------------------------------------------------------------------*/
1812     /* 8 bit control code flag -- special option */
1813     WriteOnOff(Section, "Accept8BitCtrl", FName,
1814 doda 2496 (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
1815 maya 2476
1816     /* Wrong sequence flag -- special option */
1817     WriteOnOff(Section, "AllowWrongSequence", FName,
1818 doda 2496 (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
1819 maya 2476
1820     /* Auto file renaming --- special option */
1821     WriteOnOff(Section, "AutoFileRename", FName,
1822 doda 2496 (WORD) (ts->FTFlag & FT_RENAME));
1823 maya 2476
1824     /* Auto text copy --- special option */
1825     WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
1826    
1827     /* Back wrap -- special option */
1828     WriteOnOff(Section, "BackWrap", FName,
1829     (WORD) (ts->TermFlag & TF_BACKWRAP));
1830    
1831     /* Beep type -- special option */
1832     WriteOnOff(Section, "Beep", FName, ts->Beep);
1833 doda 2554 switch (ts->Beep) {
1834     case IdBeepOff:
1835     WritePrivateProfileString(Section, "Beep", "Off", FName);
1836     break;
1837     case IdBeepOn:
1838     WritePrivateProfileString(Section, "Beep", "On", FName);
1839     break;
1840     case IdBeepVisual:
1841     WritePrivateProfileString(Section, "Beep", "Visual", FName);
1842     break;
1843     }
1844 maya 2476
1845     /* Beep on connection & disconnection -- special option */
1846     WriteOnOff(Section, "BeepOnConnect", FName,
1847     (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
1848    
1849     /* Auto B-Plus activation -- special option */
1850     WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
1851    
1852     /* B-Plus ESCCTL flag -- special option */
1853     WriteOnOff(Section, "BPEscCtl", FName,
1854     (WORD) (ts->FTFlag & FT_BPESCCTL));
1855    
1856     /* B-Plus log -- special option */
1857     WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
1858    
1859     /* Clear serial port buffer when port opening -- special option */
1860     WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
1861    
1862     /* Confirm disconnection -- special option */
1863     WriteOnOff(Section, "ConfirmDisconnect", FName,
1864     (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
1865    
1866     /* Ctrl code in Kanji -- special option */
1867     WriteOnOff(Section, "CtrlInKanji", FName,
1868     (WORD) (ts->TermFlag & TF_CTRLINKANJI));
1869    
1870     /* Debug flag -- special option */
1871     WriteOnOff(Section, "Debug", FName, ts->Debug);
1872    
1873     /* Delimiter list -- special option */
1874     Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
1875     sizeof(Temp) - 1, TRUE);
1876     WritePrivateProfileString(Section, "DelimList", Temp, FName);
1877    
1878     /* regard DBCS characters as delimiters -- special option */
1879     WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
1880    
1881     // Enable popup menu -- special option
1882     if ((ts->MenuFlag & MF_NOPOPUP) == 0)
1883     WriteOnOff(Section, "EnablePopupMenu", FName, 1);
1884     else
1885     WriteOnOff(Section, "EnablePopupMenu", FName, 0);
1886    
1887     // Enable "Show menu" -- special option
1888     if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
1889     WriteOnOff(Section, "EnableShowMenu", FName, 1);
1890     else
1891     WriteOnOff(Section, "EnableShowMenu", FName, 0);
1892    
1893     /* Enable the status line -- special option */
1894     WriteOnOff(Section, "EnableStatusLine", FName,
1895     (WORD) (ts->TermFlag & TF_ENABLESLINE));
1896    
1897     /* IME Flag -- special option */
1898     WriteOnOff(Section, "IME", FName, ts->UseIME);
1899    
1900     /* IME-inline Flag -- special option */
1901     WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
1902    
1903     /* Kermit log -- special option */
1904     WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
1905    
1906     // Enable language selection -- special option
1907     if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
1908     WriteOnOff(Section, "LanguageSelection", FName, 1);
1909     else
1910     WriteOnOff(Section, "LanguageSelection", FName, 0);
1911    
1912     /* Maximum scroll buffer size -- special option */
1913     WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
1914    
1915     /* Max com port number -- special option */
1916     WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
1917    
1918     /* Non-blinking cursor -- special option */
1919     WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
1920    
1921     WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
1922    
1923     /* Delay for pass-thru printing activation */
1924     /* -- special option */
1925     WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
1926    
1927     /* Printer port for pass-thru printing */
1928     /* -- special option */
1929     WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
1930    
1931     /* Printer Font --- special option */
1932     WriteFont(Section, "PrnFont", FName,
1933     ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
1934     ts->PrnFontCharSet);
1935    
1936     // Page margins (left, right, top, bottom) for printing
1937     // -- special option
1938     WriteInt4(Section, "PrnMargin", FName,
1939     ts->PrnMargin[0], ts->PrnMargin[1],
1940     ts->PrnMargin[2], ts->PrnMargin[3]);
1941    
1942     /* Quick-VAN log -- special option */
1943     WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
1944    
1945     /* Quick-VAN window size -- special */
1946     WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
1947    
1948     /* Russian character set (print) -- special option */
1949     id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
1950     WritePrivateProfileString(Section, "RussPrint", Temp, FName);
1951    
1952     /* Scroll threshold -- special option */
1953     WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
1954    
1955     WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
1956    
1957     // Select on activate -- special option
1958     WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
1959    
1960     /* Send 8bit control sequence -- special option */
1961     WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
1962    
1963     /* Startup macro -- special option */
1964     WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
1965    
1966     /* TEK GIN Mouse keycode -- special option */
1967     WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
1968    
1969     /* Telnet Auto Detect -- special option */
1970     WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
1971    
1972     /* Telnet binary flag -- special option */
1973     WriteOnOff(Section, "TelBin", FName, ts->TelBin);
1974    
1975     /* Telnet Echo flag -- special option */
1976     WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
1977    
1978     /* Telnet log -- special option */
1979     WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
1980    
1981     /* TCP port num for telnet -- special option */
1982     WriteUint(Section, "TelPort", FName, ts->TelPort);
1983    
1984     /* Telnet keep-alive packet(NOP command) interval -- special option */
1985     WriteUint(Section, "TelKeepAliveInterval", FName,
1986     ts->TelKeepAliveInterval);
1987    
1988     /* Max number of broadcast commad history */
1989     WriteUint(Section, "MaxBroadcatHistory", FName,
1990     ts->MaxBroadcatHistory);
1991    
1992     /* Local echo for non-telnet */
1993     WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
1994    
1995     /* "new-line (transmit)" option for non-telnet -- special option */
1996     if (ts->TCPCRSend == IdCRLF)
1997     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1998     else if (ts->TCPCRSend == IdCR)
1999     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2000     else
2001     Temp[0] = 0;
2002     WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2003    
2004     /* Use text (background) color for "white (black)"
2005     --- special option */
2006     WriteOnOff(Section, "UseTextColor", FName,
2007     (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2008    
2009     /* Title format -- special option */
2010     WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2011    
2012     /* VT Compatible Tab -- special option */
2013     WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2014    
2015     /* VT Font space --- special option */
2016     WriteInt4(Section, "VTFontSpace", FName,
2017     ts->FontDX, ts->FontDW - ts->FontDX,
2018     ts->FontDY, ts->FontDH - ts->FontDY);
2019    
2020     // VT-print scaling factors (pixels per inch) --- special option
2021     WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2022    
2023     // TEK-print scaling factors (pixels per inch) --- special option
2024     WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y);
2025    
2026     // Show "Window" menu -- special option
2027     WriteOnOff(Section, "WindowMenu", FName,
2028     (WORD) (ts->MenuFlag & MF_SHOWWINMENU));
2029    
2030     /* XMODEM log -- special option */
2031     WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X));
2032    
2033 yutakapon 2539 /* YMODEM log -- special option */
2034     WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y));
2035    
2036 maya 2476 /* Auto ZMODEM activation -- special option */
2037     WriteOnOff(Section, "ZmodemAuto", FName,
2038     (WORD) (ts->FTFlag & FT_ZAUTO));
2039    
2040     /* ZMODEM data subpacket length for sending -- special */
2041     WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen);
2042     /* ZMODEM window size for sending -- special */
2043     WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize);
2044    
2045     /* ZMODEM ESCCTL flag -- special option */
2046     WriteOnOff(Section, "ZmodemEscCtl", FName,
2047     (WORD) (ts->FTFlag & FT_ZESCCTL));
2048    
2049     /* ZMODEM log -- special option */
2050     WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z));
2051    
2052     /* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */
2053     WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName);
2054    
2055     /* update file */
2056     WritePrivateProfileString(NULL, NULL, NULL, FName);
2057    
2058     // Eterm lookfeel alphablend (2005.4.24 yutaka)
2059     #define ETERM_SECTION "BG"
2060     WriteOnOff(ETERM_SECTION, "BGEnable", FName,
2061     ts->EtermLookfeel.BGEnable);
2062     WriteOnOff(ETERM_SECTION, "BGUseAlphaBlendAPI", FName,
2063     ts->EtermLookfeel.BGUseAlphaBlendAPI);
2064     WritePrivateProfileString(ETERM_SECTION, "BGSPIPath",
2065     ts->EtermLookfeel.BGSPIPath, FName);
2066     WriteOnOff(ETERM_SECTION, "BGFastSizeMove", FName,
2067     ts->EtermLookfeel.BGFastSizeMove);
2068     WriteOnOff(ETERM_SECTION, "BGFlickerlessMove", FName,
2069     ts->EtermLookfeel.BGNoCopyBits);
2070     WriteOnOff(ETERM_SECTION, "BGNoFrame", FName,
2071     ts->EtermLookfeel.BGNoFrame);
2072     WritePrivateProfileString(ETERM_SECTION, "BGThemeFile",
2073     ts->EtermLookfeel.BGThemeFile, FName);
2074    
2075     #ifdef USE_NORMAL_BGCOLOR
2076     // UseNormalBGColor
2077     WriteOnOff(Section, "UseNormalBGColor", FName, ts->UseNormalBGColor);
2078     #endif
2079    
2080     // UI language message file
2081     WritePrivateProfileString(Section, "UILanguageFile",
2082     ts->UILanguageFile_ini, FName);
2083    
2084     // Broadcast Command History (2007.3.3 maya)
2085     WriteOnOff(Section, "BroadcastCommandHistory", FName,
2086     ts->BroadcastCommandHistory);
2087    
2088     // 337: 2007/03/20 Accept Broadcast
2089     WriteOnOff(Section, "AcceptBroadcast", FName, ts->AcceptBroadcast);
2090    
2091     // Confirm send a file when drag and drop (2007.12.28 maya)
2092     WriteOnOff(Section, "ConfirmFileDragAndDrop", FName,
2093     ts->ConfirmFileDragAndDrop);
2094    
2095     // Translate mouse wheel to cursor key when application cursor mode
2096     WriteOnOff(Section, "TranslateWheelToCursor", FName,
2097     ts->TranslateWheelToCursor);
2098    
2099     // Display "New Connection" dialog on startup (2008.1.18 maya)
2100     WriteOnOff(Section, "HostDialogOnStartup", FName,
2101     ts->HostDialogOnStartup);
2102    
2103     // Mouse event tracking
2104     WriteOnOff(Section, "MouseEventTracking", FName,
2105     ts->MouseEventTracking);
2106    
2107     // Maximized bug tweak
2108 doda 2496 WriteOnOff(Section, "MaximizedBugTweak", FName, ts->MaximizedBugTweak);
2109    
2110 doda 2535 // Convert Unicode symbol characters to DEC Special characters
2111     WriteUint(Section, "UnicodeToDecSpMapping", FName, ts->UnicodeDecSpMapping);
2112 doda 2497
2113     // VT Window Icon
2114     IconId2IconName(Temp, sizeof(Temp), ts->VTIcon);
2115     WritePrivateProfileString(Section, "VTIcon", Temp, FName);
2116    
2117     // Tek Window Icon
2118 doda 2506 IconId2IconName(Temp, sizeof(Temp), ts->TEKIcon);
2119     WritePrivateProfileString(Section, "TEKIcon", Temp, FName);
2120 yutakapon 2499
2121     // AutoScrollOnlyInBottomLine
2122     WriteOnOff(Section, "AutoScrollOnlyInBottomLine", FName,
2123     ts->AutoScrollOnlyInBottomLine);
2124 doda 2510
2125     // Unknown Unicode Character
2126     WriteOnOff(Section, "UnknownUnicodeCharacterAsWide", FName,
2127     ts->UnknownUnicodeCharaAsWide);
2128 doda 2558
2129     // Accept remote-controlled window title changing
2130 maya 2603 if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOff)
2131     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
2132     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestOverwrite)
2133     strncpy_s(Temp, sizeof(Temp), "overwrite", _TRUNCATE);
2134 maya 2608 else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestAhead)
2135     strncpy_s(Temp, sizeof(Temp), "ahead", _TRUNCATE);
2136     else if (ts->AcceptTitleChangeRequest == IdTitleChangeRequestLast)
2137     strncpy_s(Temp, sizeof(Temp), "last", _TRUNCATE);
2138 maya 2603 else
2139     Temp[0] = 0;
2140     WritePrivateProfileString(Section, "AcceptTitleChangeRequest", Temp, FName);
2141 maya 2565
2142     // Size of paste confirm dialog
2143     WriteInt2(Section, "PasteDialogSize", FName,
2144     ts->PasteDialogSize.cx, ts->PasteDialogSize.cy);
2145 doda 2628
2146     // Disable mouse event tracking when Control-Key is pressed.
2147     WriteOnOff(Section, "DisableMouseTrackingByCtrl", FName,
2148     ts->DisableMouseTrackingByCtrl);
2149 doda 2631
2150     // Disable TranslateWHeelToCursor when Control-Key is pressed.
2151     WriteOnOff(Section, "DisableWheelToCursorByCtrl", FName,
2152     ts->DisableWheelToCursorByCtrl);
2153 doda 2643
2154     // Strict Key Mapping.
2155     WriteOnOff(Section, "StrictKeyMapping", FName,
2156     ts->StrictKeyMapping);
2157 yutakapon 2712
2158     // Wait4allMacroCommand
2159     WriteOnOff(Section, "Wait4allMacroCommand", FName,
2160     ts->Wait4allMacroCommand);
2161 maya 2476 }
2162    
2163     #define VTEditor "VT editor keypad"
2164     #define VTNumeric "VT numeric keypad"
2165     #define VTFunction "VT function keys"
2166     #define XFunction "X function keys"
2167     #define ShortCut "Shortcut keys"
2168    
2169     void GetInt(PKeyMap KeyMap, int KeyId, PCHAR Sect, PCHAR Key, PCHAR FName)
2170     {
2171     char Temp[11];
2172     WORD Num;
2173    
2174     GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName);
2175     if (Temp[0] == 0)
2176     Num = 0xFFFF;
2177     else if (_stricmp(Temp, "off") == 0)
2178     Num = 0xFFFF;
2179     else if (sscanf(Temp, "%d", &Num) != 1)
2180     Num = 0xFFFF;
2181    
2182     KeyMap->Map[KeyId - 1] = Num;
2183     }
2184    
2185     void FAR PASCAL ReadKeyboardCnf
2186     (PCHAR FName, PKeyMap KeyMap, BOOL ShowWarning) {
2187     int i, j, Ptr;
2188     char EntName[7];
2189     char TempStr[221];
2190     char KStr[201];
2191    
2192     // clear key map
2193     for (i = 0; i <= IdKeyMax - 1; i++)
2194     KeyMap->Map[i] = 0xFFFF;
2195     for (i = 0; i <= NumOfUserKey - 1; i++) {
2196     KeyMap->UserKeyPtr[i] = 0;
2197     KeyMap->UserKeyLen[i] = 0;
2198     }
2199    
2200     // VT editor keypad
2201     GetInt(KeyMap, IdUp, VTEditor, "Up", FName);
2202    
2203     GetInt(KeyMap, IdDown, VTEditor, "Down", FName);
2204    
2205     GetInt(KeyMap, IdRight, VTEditor, "Right", FName);
2206    
2207     GetInt(KeyMap, IdLeft, VTEditor, "Left", FName);
2208    
2209     GetInt(KeyMap, IdFind, VTEditor, "Find", FName);
2210    
2211     GetInt(KeyMap, IdInsert, VTEditor, "Insert", FName);
2212    
2213     GetInt(KeyMap, IdRemove, VTEditor, "Remove", FName);
2214    
2215     GetInt(KeyMap, IdSelect, VTEditor, "Select", FName);
2216    
2217     GetInt(KeyMap, IdPrev, VTEditor, "Prev", FName);
2218    
2219     GetInt(KeyMap, IdNext, VTEditor, "Next", FName);
2220    
2221     // VT numeric keypad
2222     GetInt(KeyMap, Id0, VTNumeric, "Num0", FName);
2223    
2224     GetInt(KeyMap, Id1, VTNumeric, "Num1", FName);
2225    
2226     GetInt(KeyMap, Id2, VTNumeric, "Num2", FName);
2227    
2228     GetInt(KeyMap, Id3, VTNumeric, "Num3", FName);
2229    
2230     GetInt(KeyMap, Id4, VTNumeric, "Num4", FName);
2231    
2232     GetInt(KeyMap, Id5, VTNumeric, "Num5", FName);
2233    
2234     GetInt(KeyMap, Id6, VTNumeric, "Num6", FName);
2235    
2236     GetInt(KeyMap, Id7, VTNumeric, "Num7", FName);
2237    
2238     GetInt(KeyMap, Id8, VTNumeric, "Num8", FName);
2239    
2240     GetInt(KeyMap, Id9, VTNumeric, "Num9", FName);
2241    
2242     GetInt(KeyMap, IdMinus, VTNumeric, "NumMinus", FName);
2243    
2244     GetInt(KeyMap, IdComma, VTNumeri