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 2640 - (hide annotations) (download) (as text)
Sun Jan 25 14:44:37 2009 UTC (15 years, 2 months ago) by doda
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 89665 byte(s)
反転属性の色を指定出来るようにした。

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