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 2671 - (hide annotations) (download) (as text)
Tue Mar 3 10:02:51 2009 UTC (15 years, 1 month ago) by doda
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 90817 byte(s)
DisableMouseTrackingByCtrl, DisableWheelToCursorByCtrl のデフォルトをonに変更。

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