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 2628 - (hide annotations) (download) (as text)
Wed Dec 24 09:38:42 2008 UTC (15 years, 3 months ago) by doda
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 88440 byte(s)
Controlを押している間はMouse Event Trackingを無効に出来るようにした。
http://sourceforge.jp/tracker/index.php?func=detail&aid=14342&group_id=1412&atid=5336

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