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