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 3660 - (hide annotations) (download) (as text)
Sun Oct 25 16:22:26 2009 UTC (14 years, 5 months ago) by doda
File MIME type: text/x-csrc
File size: 100945 byte(s)
URLの下線の有無を設定できるようにした。
デフォルト: URLUnderline=on

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