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 3501 - (hide annotations) (download) (as text)
Tue Jun 16 07:43:31 2009 UTC (14 years, 9 months ago) by doda
File MIME type: text/x-csrc
File size: 99889 byte(s)
Line at a timeモードを無効に設定できるようにした。
  EnableLineMode=off

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