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 2661 - (hide annotations) (download) (as text)
Wed Feb 18 12:11:47 2009 UTC (15 years, 1 month ago) by yutakapon
Original Path: teraterm/trunk/ttpset/ttset.c
File MIME type: text/x-csrc
File size: 91426 byte(s)
#if 0
/* C言語では以下のコードは、コンパイルエラーとなるので、いったん外す。*/
EXTERN_C int s_DoCover_IsDebuggerPresent
    = (int) (DoCover_IsDebuggerPresent(), 0);
#endif

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