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 4480 - (hide annotations) (download) (as text)
Mon Jun 6 00:55:49 2011 UTC (12 years, 10 months ago) by doda
File MIME type: text/x-csrc
File size: 106175 byte(s)
ジャンプリスのの(不)使用の設定を、ホスト履歴の設定から分離。

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 doda 4480 // Jump List
1419     ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE);
1420    
1421 doda 4281 // Use invalid DECRPSS (for testing)
1422     if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE))
1423     ts->TermFlag |= TF_INVALIDDECRPSS;
1424 maya 3227 }
1425    
1426     void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
1427     {
1428     int i;
1429 maya 4031 char Temp[MAX_PATH];
1430 maya 3227 char buf[20];
1431    
1432     /* version */
1433     WritePrivateProfileString(Section, "Version", "2.3", FName);
1434    
1435     /* Language */
1436 doda 3359 switch (ts->Language) {
1437     case IdJapanese:
1438 maya 3227 strncpy_s(Temp, sizeof(Temp), "Japanese", _TRUNCATE);
1439 doda 3359 break;
1440     case IdKorean:
1441     strncpy_s(Temp, sizeof(Temp), "Korean", _TRUNCATE);
1442     break;
1443     case IdRussian:
1444     strncpy_s(Temp, sizeof(Temp), "Russian", _TRUNCATE);
1445     break;
1446 maya 3401 case IdUtf8:
1447     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1448     break;
1449 doda 3359 default:
1450     strncpy_s(Temp, sizeof(Temp), "English", _TRUNCATE);
1451     }
1452    
1453 maya 3227 WritePrivateProfileString(Section, "Language", Temp, FName);
1454    
1455     /* Port type */
1456     if (ts->PortType == IdSerial)
1457     strncpy_s(Temp, sizeof(Temp), "serial", _TRUNCATE);
1458     else /* IdFile -> IdTCPIP */
1459     strncpy_s(Temp, sizeof(Temp), "tcpip", _TRUNCATE);
1460    
1461     WritePrivateProfileString(Section, "Port", Temp, FName);
1462    
1463     /* Save win position */
1464     if (ts->SaveVTWinPos) {
1465     /* VT win position */
1466     WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y);
1467     }
1468    
1469     /* VT terminal size */
1470     WriteInt2(Section, "TerminalSize", FName,
1471     ts->TerminalWidth, ts->TerminalHeight);
1472    
1473     /* Terminal size = Window size */
1474     WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin);
1475    
1476     /* Auto window resize flag */
1477     WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize);
1478    
1479     /* CR Receive */
1480     if (ts->CRReceive == IdCRLF) {
1481     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1482     }
1483     else if (ts->CRReceive == IdLF) {
1484     strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE);
1485     }
1486     else {
1487     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1488     }
1489     WritePrivateProfileString(Section, "CRReceive", Temp, FName);
1490    
1491     /* CR Send */
1492     if (ts->CRSend == IdCRLF)
1493     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
1494     else
1495     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
1496     WritePrivateProfileString(Section, "CRSend", Temp, FName);
1497    
1498     /* Local echo */
1499     WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho);
1500    
1501     /* Answerback */
1502     if ((ts->FTFlag & FT_BPAUTO) == 0) {
1503     Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen,
1504     sizeof(Temp) - 1, TRUE);
1505     WritePrivateProfileString(Section, "Answerback", Temp, FName);
1506     }
1507    
1508     /* Kanji Code (receive) */
1509     switch (ts->KanjiCode) {
1510     case IdEUC:
1511     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1512     break;
1513     case IdJIS:
1514     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1515     break;
1516     case IdUTF8:
1517     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1518     break;
1519     case IdUTF8m:
1520     strncpy_s(Temp, sizeof(Temp), "UTF-8m", _TRUNCATE);
1521     break;
1522     default:
1523 doda 3420 switch (ts->Language) {
1524     case IdJapanese:
1525     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1526     break;
1527     case IdKorean:
1528     strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1529     break;
1530     default:
1531     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1532     }
1533 maya 3227 }
1534     WritePrivateProfileString(Section, "KanjiReceive", Temp, FName);
1535    
1536     /* Katakana (receive) */
1537     if (ts->JIS7Katakana == 1)
1538     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1539     else
1540     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1541    
1542     WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName);
1543    
1544     /* Kanji Code (transmit) */
1545     switch (ts->KanjiCodeSend) {
1546     case IdEUC:
1547     strncpy_s(Temp, sizeof(Temp), "EUC", _TRUNCATE);
1548     break;
1549     case IdJIS:
1550     strncpy_s(Temp, sizeof(Temp), "JIS", _TRUNCATE);
1551     break;
1552     case IdUTF8:
1553     strncpy_s(Temp, sizeof(Temp), "UTF-8", _TRUNCATE);
1554     break;
1555     default:
1556 doda 3420 switch (ts->Language) {
1557     case IdJapanese:
1558     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1559     break;
1560     case IdKorean:
1561     strncpy_s(Temp, sizeof(Temp), "KS5601", _TRUNCATE);
1562     break;
1563     default:
1564     strncpy_s(Temp, sizeof(Temp), "SJIS", _TRUNCATE);
1565     }
1566 maya 3227 }
1567     WritePrivateProfileString(Section, "KanjiSend", Temp, FName);
1568    
1569     /* Katakana (transmit) */
1570     if (ts->JIS7KatakanaSend == 1)
1571     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1572     else
1573     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1574    
1575     WritePrivateProfileString(Section, "KatakanaSend", Temp, FName);
1576    
1577     /* KanjiIn */
1578     if (ts->KanjiIn == IdKanjiInA)
1579     strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE);
1580     else
1581     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1582    
1583     WritePrivateProfileString(Section, "KanjiIn", Temp, FName);
1584    
1585     /* KanjiOut */
1586     switch (ts->KanjiOut) {
1587     case IdKanjiOutB:
1588     strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE);
1589     break;
1590     case IdKanjiOutH:
1591     strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE);
1592     break;
1593     default:
1594     strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE);
1595     }
1596     WritePrivateProfileString(Section, "KanjiOut", Temp, FName);
1597    
1598     // new configuration
1599     WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout);
1600    
1601     WriteOnOff(Section, "DisablePasteMouseRButton", FName,
1602     ts->DisablePasteMouseRButton);
1603    
1604     // added DisablePasteMouseMButton (2008.3.2 maya)
1605     WriteOnOff(Section, "DisablePasteMouseMButton", FName,
1606     ts->DisablePasteMouseMButton);
1607    
1608     // added ConfirmPasteMouseRButton (2007.3.17 maya)
1609     WriteOnOff(Section, "ConfirmPasteMouseRButton", FName,
1610     ts->ConfirmPasteMouseRButton);
1611    
1612     // added ConfirmChangePaste
1613     WriteOnOff(Section, "ConfirmChangePaste", FName,
1614     ts->ConfirmChangePaste);
1615 yutakapon 3535 WritePrivateProfileString(Section, "ConfirmChangePasteStringFile",
1616     ts->ConfirmChangePasteStringFile, FName);
1617 maya 3227
1618     // added ScrollWindowClearScreen
1619     WriteOnOff(Section, "ScrollWindowClearScreen", FName,
1620     ts->ScrollWindowClearScreen);
1621    
1622     // added SelectOnlyByLButton (2007.11.20 maya)
1623     WriteOnOff(Section, "SelectOnlyByLButton", FName,
1624     ts->SelectOnlyByLButton);
1625     // added DisableAcceleratorSendBreak (2007.3.17 maya)
1626     WriteOnOff(Section, "DisableAcceleratorSendBreak", FName,
1627     ts->DisableAcceleratorSendBreak);
1628     WriteOnOff(Section, "EnableContinuedLineCopy", FName,
1629     ts->EnableContinuedLineCopy);
1630     WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName,
1631     FName);
1632     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlend);
1633     WritePrivateProfileString(Section, "AlphaBlend", Temp, FName);
1634     WritePrivateProfileString(Section, "CygwinDirectory",
1635     ts->CygwinDirectory, FName);
1636     WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor,
1637     FName);
1638     WritePrivateProfileString(Section, "Locale", ts->Locale, FName);
1639     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->CodePage);
1640     WritePrivateProfileString(Section, "CodePage", Temp, FName);
1641    
1642     // ANSI color(2004.9.5 yutaka)
1643     Temp[0] = '\0';
1644     for (i = 0; i < 15; i++) {
1645     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ",
1646     i,
1647     GetRValue(ts->ANSIColor[i]),
1648     GetGValue(ts->ANSIColor[i]),
1649     GetBValue(ts->ANSIColor[i])
1650     );
1651     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1652     }
1653     i = 15;
1654     _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d",
1655     i,
1656     GetRValue(ts->ANSIColor[i]),
1657     GetGValue(ts->ANSIColor[i]),
1658     GetBValue(ts->ANSIColor[i])
1659     );
1660     strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE);
1661     WritePrivateProfileString(Section, "ANSIColor", Temp, FName);
1662    
1663     /* AutoWinChange VT<->TEK */
1664     WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch);
1665    
1666     /* Terminal ID */
1667     id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp));
1668     WritePrivateProfileString(Section, "TerminalID", Temp, FName);
1669    
1670     /* Russian character set (host) */
1671     id2str(RussList, ts->RussHost, IdKOI8, Temp, sizeof(Temp));
1672     WritePrivateProfileString(Section, "RussHost", Temp, FName);
1673    
1674     /* Russian character set (client) */
1675     id2str(RussList, ts->RussClient, IdWindows, Temp, sizeof(Temp));
1676     WritePrivateProfileString(Section, "RussClient", Temp, FName);
1677    
1678     /* Title text */
1679     WritePrivateProfileString(Section, "Title", ts->Title, FName);
1680    
1681     /* Cursor shape */
1682     switch (ts->CursorShape) {
1683     case IdVCur:
1684     strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE);
1685     break;
1686     case IdHCur:
1687     strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE);
1688     break;
1689     default:
1690     strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE);
1691     }
1692     WritePrivateProfileString(Section, "CursorShape", Temp, FName);
1693    
1694     /* Hide title */
1695     WriteOnOff(Section, "HideTitle", FName, ts->HideTitle);
1696    
1697     /* Popup menu */
1698     WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu);
1699    
1700     /* PC-Style bold color mapping */
1701     WriteOnOff(Section, "PcBoldColor", FName,
1702     (WORD) (ts->ColorFlag & CF_PCBOLD16));
1703    
1704     /* aixterm 16 colors mode */
1705     WriteOnOff(Section, "Aixterm16Color", FName,
1706     (WORD) (ts->ColorFlag & CF_AIXTERM16));
1707    
1708     /* xterm 256 colors mode */
1709     WriteOnOff(Section, "Xterm256Color", FName,
1710     (WORD) (ts->ColorFlag & CF_XTERM256));
1711    
1712     /* Enable scroll buffer */
1713     WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff);
1714    
1715     /* Scroll buffer size */
1716     WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize);
1717    
1718     /* VT Color */
1719     for (i = 0; i <= 1; i++) {
1720     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1721     if (ts->ColorFlag & CF_REVERSECOLOR) {
1722     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1723     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1724     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1725     }
1726     else {
1727     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[!i]);
1728     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[!i]);
1729     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[!i]);
1730     }
1731     }
1732     else {
1733     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1734     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1735     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1736     }
1737     }
1738     WriteInt6(Section, "VTColor", FName,
1739     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1740     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1741    
1742     /* VT Bold Color */
1743     for (i = 0; i <= 1; i++) {
1744     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1745     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[!i]);
1746     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[!i]);
1747     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[!i]);
1748     }
1749     else {
1750     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]);
1751     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]);
1752     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]);
1753     }
1754     }
1755     WriteInt6(Section, "VTBoldColor", FName,
1756     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1757     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1758    
1759     /* VT Blink Color */
1760     for (i = 0; i <= 1; i++) {
1761     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1762     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[!i]);
1763     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[!i]);
1764     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[!i]);
1765     }
1766     else {
1767     ts->TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]);
1768     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]);
1769     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]);
1770     }
1771     }
1772     WriteInt6(Section, "VTBlinkColor", FName,
1773     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1774     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1775    
1776     /* VT Reverse Color */
1777     for (i = 0; i <= 1; i++) {
1778     if (ts->ColorFlag & CF_REVERSEVIDEO && ts->ColorFlag & CF_REVERSECOLOR) {
1779     ts->TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]);
1780     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]);
1781     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]);
1782     }
1783     else {
1784     ts->TmpColor[0][i * 3] = GetRValue(ts->VTReverseColor[i]);
1785     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->VTReverseColor[i]);
1786     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->VTReverseColor[i]);
1787     }
1788     }
1789     WriteInt6(Section, "VTReverseColor", FName,
1790     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1791     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1792    
1793     WriteOnOff(Section, "EnableClickableUrl", FName,
1794     ts->EnableClickableUrl);
1795    
1796     /* URL color */
1797     for (i = 0; i <= 1; i++) {
1798     if (ts->ColorFlag & CF_REVERSEVIDEO) {
1799     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[!i]);
1800     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[!i]);
1801     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[!i]);
1802     }
1803     else {
1804     ts->TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]);
1805     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]);
1806     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]);
1807     }
1808     }
1809     WriteInt6(Section, "URLColor", FName,
1810     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1811     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1812    
1813     WriteOnOff(Section, "EnableBoldAttrColor", FName,
1814     (WORD) (ts->ColorFlag & CF_BOLDCOLOR));
1815    
1816     WriteOnOff(Section, "EnableBlinkAttrColor", FName,
1817     (WORD) (ts->ColorFlag & CF_BLINKCOLOR));
1818    
1819     WriteOnOff(Section, "EnableReverseAttrColor", FName,
1820     (WORD) (ts->ColorFlag & CF_REVERSECOLOR));
1821    
1822     WriteOnOff(Section, "EnableURLColor", FName,
1823     (WORD) (ts->ColorFlag & CF_URLCOLOR));
1824    
1825 doda 3660 WriteOnOff(Section, "URLUnderline", FName,
1826 doda 3666 (WORD) (ts->FontFlag & FF_URLUNDERLINE));
1827 doda 3660
1828 maya 3227 WriteOnOff(Section, "EnableANSIColor", FName,
1829     (WORD) (ts->ColorFlag & CF_ANSICOLOR));
1830    
1831     /* TEK Color */
1832     for (i = 0; i <= 1; i++) {
1833     ts->TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]);
1834     ts->TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]);
1835     ts->TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]);
1836     }
1837     WriteInt6(Section, "TEKColor", FName,
1838     ts->TmpColor[0][0], ts->TmpColor[0][1], ts->TmpColor[0][2],
1839     ts->TmpColor[0][3], ts->TmpColor[0][4], ts->TmpColor[0][5]);
1840    
1841     /* TEK color emulation */
1842     WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu);
1843    
1844     /* VT Font */
1845     WriteFont(Section, "VTFont", FName,
1846     ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y,
1847     ts->VTFontCharSet);
1848    
1849     /* Enable bold font flag */
1850 doda 3666 WriteOnOff(Section, "EnableBold", FName,
1851     (WORD) (ts->FontFlag & FF_BOLD));
1852 maya 3227
1853     /* Russian character set (font) */
1854     id2str(RussList, ts->RussFont, IdWindows, Temp, sizeof(Temp));
1855     WritePrivateProfileString(Section, "RussFont", Temp, FName);
1856    
1857     /* TEK Font */
1858     WriteFont(Section, "TEKFont", FName,
1859     ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y,
1860     ts->TEKFontCharSet);
1861    
1862     /* BS key */
1863     if (ts->BSKey == IdDEL)
1864     strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE);
1865     else
1866     strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE);
1867     WritePrivateProfileString(Section, "BSKey", Temp, FName);
1868    
1869     /* Delete key */
1870     WriteOnOff(Section, "DeleteKey", FName, ts->DelKey);
1871    
1872     /* Meta key */
1873 doda 4414 switch (ts->MetaKey) {
1874     case 1:
1875     strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
1876     break;
1877     case 2:
1878     strncpy_s(Temp, sizeof(Temp), "left", _TRUNCATE);
1879     break;
1880     case 3:
1881     strncpy_s(Temp, sizeof(Temp), "right", _TRUNCATE);
1882     break;
1883     default:
1884     strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
1885     }
1886     WritePrivateProfileString(Section, "Metakey", Temp, FName);
1887 maya 3227
1888     /* Application Keypad */
1889     WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad);
1890    
1891     /* Application Cursor */
1892     WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor);
1893    
1894     /* Russian keyboard type */
1895     id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp));
1896     WritePrivateProfileString(Section, "RussKeyb", Temp, FName);
1897    
1898     /* Serial port ID */
1899     _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort);
1900     WritePrivateProfileString(Section, "ComPort", Temp, FName);
1901    
1902     /* Baud rate */
1903 maya 3874 _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->Baud);
1904 maya 3227 WritePrivateProfileString(Section, "BaudRate", Temp, FName);
1905    
1906     /* Parity */
1907     switch (ts->Parity) {
1908     case IdParityEven:
1909     strncpy_s(Temp, sizeof(Temp), "even", _TRUNCATE);
1910     break;
1911     case IdParityOdd:
1912     strncpy_s(Temp, sizeof(Temp), "odd", _TRUNCATE);
1913     break;
1914     default:
1915     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1916     }
1917     WritePrivateProfileString(Section, "Parity", Temp, FName);
1918    
1919     /* Data bit */
1920     if (ts->DataBit == IdDataBit7)
1921     strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE);
1922     else
1923     strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE);
1924    
1925     WritePrivateProfileString(Section, "DataBit", Temp, FName);
1926    
1927     /* Stop bit */
1928     if (ts->StopBit == IdStopBit2)
1929     strncpy_s(Temp, sizeof(Temp), "2", _TRUNCATE);
1930     else
1931     strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE);
1932    
1933     WritePrivateProfileString(Section, "StopBit", Temp, FName);
1934    
1935     /* Flow control */
1936     switch (ts->Flow) {
1937     case IdFlowX:
1938     strncpy_s(Temp, sizeof(Temp), "x", _TRUNCATE);
1939     break;
1940     case IdFlowHard:
1941     strncpy_s(Temp, sizeof(Temp), "hard", _TRUNCATE);
1942     break;
1943     default:
1944     strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE);
1945     }
1946     WritePrivateProfileString(Section, "FlowCtrl", Temp, FName);
1947    
1948     /* Delay per character */
1949     WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar);
1950    
1951     /* Delay per line */
1952     WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine);
1953    
1954     /* Telnet flag */
1955     WriteOnOff(Section, "Telnet", FName, ts->Telnet);
1956    
1957     /* Telnet terminal type */
1958     WritePrivateProfileString(Section, "TermType", ts->TermType, FName);
1959    
1960     /* TCP port num for non-telnet */
1961     WriteUint(Section, "TCPPort", FName, ts->TCPPort);
1962    
1963     /* Auto close flag */
1964     WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose);
1965    
1966     /* History list */
1967     WriteOnOff(Section, "Historylist", FName, ts->HistoryList);
1968    
1969     /* File transfer binary flag */
1970     WriteOnOff(Section, "TransBin", FName, ts->TransBin);
1971    
1972 doda 3887 /* Log binary flag */
1973     WriteOnOff(Section, "LogBinary", FName, ts->LogBinary);
1974    
1975 maya 3227 /* Log append */
1976     WriteOnOff(Section, "LogAppend", FName, ts->Append);
1977    
1978 doda 3887 /* Log plain text flag */
1979 maya 3227 WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText);
1980    
1981     /* Log with timestamp (2006.7.23 maya) */
1982     WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp);
1983    
1984     /* Log without transfer dialog */
1985     WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog);
1986    
1987     /* Default Log file name (2006.8.28 maya) */
1988     WritePrivateProfileString(Section, "LogDefaultName",
1989     ts->LogDefaultName, FName);
1990    
1991     /* Default Log file path (2007.5.30 maya) */
1992     WritePrivateProfileString(Section, "LogDefaultPath",
1993     ts->LogDefaultPath, FName);
1994    
1995     /* Auto start logging (2007.5.31 maya) */
1996     WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart);
1997    
1998     /* XMODEM option */
1999     switch (ts->XmodemOpt) {
2000     case XoptCRC:
2001     strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE);
2002     break;
2003     case Xopt1K:
2004     strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE);
2005     break;
2006     default:
2007     strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE);
2008     }
2009     WritePrivateProfileString(Section, "XmodemOpt", Temp, FName);
2010    
2011     /* XMODEM binary flag */
2012     WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin);
2013    
2014     /* XMODEM ���M�R�}���h (2007.12.21 yutaka) */
2015     WritePrivateProfileString(Section, "XmodemRcvCommand",
2016     ts->XModemRcvCommand, FName);
2017    
2018     /* Default directory for file transfer */
2019     WritePrivateProfileString(Section, "FileDir", ts->FileDir, FName);
2020    
2021     /* filter on file send (2007.6.5 maya) */
2022     WritePrivateProfileString(Section, "FileSendFilter",
2023     ts->FileSendFilter, FName);
2024    
2025     /*------------------------------------------------------------------*/
2026     /* 8 bit control code flag -- special option */
2027     WriteOnOff(Section, "Accept8BitCtrl", FName,
2028     (WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL));
2029    
2030     /* Wrong sequence flag -- special option */
2031     WriteOnOff(Section, "AllowWrongSequence", FName,
2032     (WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE));
2033    
2034     /* Auto file renaming --- special option */
2035     WriteOnOff(Section, "AutoFileRename", FName,
2036     (WORD) (ts->FTFlag & FT_RENAME));
2037    
2038     /* Auto text copy --- special option */
2039     WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy);
2040    
2041     /* Back wrap -- special option */
2042     WriteOnOff(Section, "BackWrap", FName,
2043     (WORD) (ts->TermFlag & TF_BACKWRAP));
2044    
2045     /* Beep type -- special option */
2046     WriteOnOff(Section, "Beep", FName, ts->Beep);
2047     switch (ts->Beep) {
2048     case IdBeepOff:
2049 doda 3278 WritePrivateProfileString(Section, "Beep", "off", FName);
2050 maya 3227 break;
2051     case IdBeepOn:
2052 doda 3278 WritePrivateProfileString(Section, "Beep", "on", FName);
2053 maya 3227 break;
2054     case IdBeepVisual:
2055 doda 3278 WritePrivateProfileString(Section, "Beep", "visual", FName);
2056 maya 3227 break;
2057     }
2058    
2059     /* Beep on connection & disconnection -- special option */
2060     WriteOnOff(Section, "BeepOnConnect", FName,
2061     (WORD) (ts->PortFlag & PF_BEEPONCONNECT));
2062    
2063     /* Auto B-Plus activation -- special option */
2064     WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO));
2065    
2066     /* B-Plus ESCCTL flag -- special option */
2067     WriteOnOff(Section, "BPEscCtl", FName,
2068     (WORD) (ts->FTFlag & FT_BPESCCTL));
2069    
2070     /* B-Plus log -- special option */
2071     WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP));
2072    
2073     /* Clear serial port buffer when port opening -- special option */
2074     WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen);
2075    
2076     /* Confirm disconnection -- special option */
2077     WriteOnOff(Section, "ConfirmDisconnect", FName,
2078     (WORD) (ts->PortFlag & PF_CONFIRMDISCONN));
2079    
2080     /* Ctrl code in Kanji -- special option */
2081     WriteOnOff(Section, "CtrlInKanji", FName,
2082     (WORD) (ts->TermFlag & TF_CTRLINKANJI));
2083    
2084     /* Debug flag -- special option */
2085     WriteOnOff(Section, "Debug", FName, ts->Debug);
2086    
2087     /* Delimiter list -- special option */
2088     Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList),
2089     sizeof(Temp) - 1, TRUE);
2090     WritePrivateProfileString(Section, "DelimList", Temp, FName);
2091    
2092     /* regard DBCS characters as delimiters -- special option */
2093     WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS);
2094    
2095     // Enable popup menu -- special option
2096     if ((ts->MenuFlag & MF_NOPOPUP) == 0)
2097     WriteOnOff(Section, "EnablePopupMenu", FName, 1);
2098     else
2099     WriteOnOff(Section, "EnablePopupMenu", FName, 0);
2100    
2101     // Enable "Show menu" -- special option
2102     if ((ts->MenuFlag & MF_NOSHOWMENU) == 0)
2103     WriteOnOff(Section, "EnableShowMenu", FName, 1);
2104     else
2105     WriteOnOff(Section, "EnableShowMenu", FName, 0);
2106    
2107     /* Enable the status line -- special option */
2108     WriteOnOff(Section, "EnableStatusLine", FName,
2109     (WORD) (ts->TermFlag & TF_ENABLESLINE));
2110    
2111     /* IME Flag -- special option */
2112     WriteOnOff(Section, "IME", FName, ts->UseIME);
2113    
2114     /* IME-inline Flag -- special option */
2115     WriteOnOff(Section, "IMEInline", FName, ts->IMEInline);
2116    
2117     /* Kermit log -- special option */
2118     WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT));
2119    
2120     // Enable language selection -- special option
2121     if ((ts->MenuFlag & MF_NOLANGUAGE) == 0)
2122     WriteOnOff(Section, "LanguageSelection", FName, 1);
2123     else
2124     WriteOnOff(Section, "LanguageSelection", FName, 0);
2125    
2126     /* Maximum scroll buffer size -- special option */
2127     WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax);
2128    
2129     /* Max com port number -- special option */
2130     WriteInt(Section, "MaxComPort", FName, ts->MaxComPort);
2131    
2132     /* Non-blinking cursor -- special option */
2133     WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor);
2134    
2135     WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor);
2136    
2137     /* Delay for pass-thru printing activation */
2138     /* -- special option */
2139     WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay);
2140    
2141     /* Printer port for pass-thru printing */
2142     /* -- special option */
2143     WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName);
2144    
2145 doda 4397 /* �v�����^�p�����R�[�h�������t������ */
2146     WriteOnOff(Section, "PrinterCtrlSequence", FName,
2147     ts->TermFlag & TF_PRINTERCTRL);
2148 yutakapon 4393
2149 maya 3227 /* Printer Font --- special option */
2150     WriteFont(Section, "PrnFont", FName,
2151     ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y,
2152     ts->PrnFontCharSet);
2153    
2154     // Page margins (left, right, top, bottom) for printing
2155     // -- special option
2156     WriteInt4(Section, "PrnMargin", FName,
2157     ts->PrnMargin[0], ts->PrnMargin[1],
2158     ts->PrnMargin[2], ts->PrnMargin[3]);
2159    
2160     /* Quick-VAN log -- special option */
2161     WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV));
2162    
2163     /* Quick-VAN window size -- special */
2164     WriteInt(Section, "QVWinSize", FName, ts->QVWinSize);
2165    
2166     /* Russian character set (print) -- special option */
2167     id2str(RussList, ts->RussPrint, IdWindows, Temp, sizeof(Temp));
2168     WritePrivateProfileString(Section, "RussPrint", Temp, FName);
2169    
2170     /* Scroll threshold -- special option */
2171     WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold);
2172    
2173     WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine);
2174    
2175     // Select on activate -- special option
2176     WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive);
2177    
2178     /* Send 8bit control sequence -- special option */
2179     WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl);
2180    
2181     /* Startup macro -- special option */
2182     WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName);
2183    
2184     /* TEK GIN Mouse keycode -- special option */
2185     WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode);
2186    
2187     /* Telnet Auto Detect -- special option */
2188     WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect);
2189    
2190     /* Telnet binary flag -- special option */
2191     WriteOnOff(Section, "TelBin", FName, ts->TelBin);
2192    
2193     /* Telnet Echo flag -- special option */
2194     WriteOnOff(Section, "TelEcho", FName, ts->TelEcho);
2195    
2196     /* Telnet log -- special option */
2197     WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL));
2198    
2199     /* TCP port num for telnet -- special option */
2200     WriteUint(Section, "TelPort", FName, ts->TelPort);
2201    
2202     /* Telnet keep-alive packet(NOP command) interval -- special option */
2203     WriteUint(Section, "TelKeepAliveInterval", FName,
2204     ts->TelKeepAliveInterval);
2205    
2206     /* Max number of broadcast commad history */
2207     WriteUint(Section, "MaxBroadcatHistory", FName,
2208     ts->MaxBroadcatHistory);
2209    
2210     /* Local echo for non-telnet */
2211     WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho);
2212    
2213     /* "new-line (transmit)" option for non-telnet -- special option */
2214     if (ts->TCPCRSend == IdCRLF)
2215     strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE);
2216     else if (ts->TCPCRSend == IdCR)
2217     strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE);
2218     else
2219     Temp[0] = 0;
2220     WritePrivateProfileString(Section, "TCPCRSend", Temp, FName);
2221    
2222     /* Use text (background) color for "white (black)"
2223     --- special option */
2224     WriteOnOff(Section, "UseTextColor", FName,
2225     (WORD) (ts->ColorFlag & CF_USETEXTCOLOR));
2226    
2227     /* Title format -- special option */
2228     WriteUint(Section, "TitleFormat", FName, ts->TitleFormat);
2229    
2230     /* VT Compatible Tab -- special option */
2231     WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab);
2232    
2233     /* VT Font space --- special option */
2234     WriteInt4(Section, "VTFontSpace", FName,
2235     ts->FontDX, ts->FontDW - ts->FontDX,
2236     ts->FontDY, ts->FontDH - ts->FontDY);
2237    
2238     // VT-print scaling factors (pixels per inch) --- special option
2239     WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y);
2240    
2241     // TEK-print scaling factors (pixels per inch) --- special option
2242     WriteInt2(