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 4414 - (hide annotations) (download) (as text)
Wed Apr 6 03:38:07 2011 UTC (13 years ago) by doda
File MIME type: text/x-csrc
File size: 106018 byte(s)
MetaKey 設定で、左右の片方だけを指定できるようにした。[ttssh2-devel 1804]
http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=23821

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