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 4273 - (hide annotations) (download) (as text)
Tue Jan 11 12:26:17 2011 UTC (13 years, 3 months ago) by doda
File MIME type: text/x-csrc
File size: 104755 byte(s)
・DontConfirmPasteCR -> ConfirmChangePasteCR [ttssh2-devel 1813]
・辞書サーチを行わなくなっていた場合が有ったのを修正

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