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