| 1 |
/* |
| 2 |
* Copyright (C) 1994-1998 T. Teranishi |
| 3 |
* (C) 2004- TeraTerm Project |
| 4 |
* All rights reserved. |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions |
| 8 |
* are met: |
| 9 |
* |
| 10 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
* notice, this list of conditions and the following disclaimer. |
| 12 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
* notice, this list of conditions and the following disclaimer in the |
| 14 |
* documentation and/or other materials provided with the distribution. |
| 15 |
* 3. The name of the author may not be used to endorse or promote products |
| 16 |
* derived from this software without specific prior written permission. |
| 17 |
* |
| 18 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| 19 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 |
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 |
*/ |
| 29 |
/* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */ |
| 30 |
|
| 31 |
/* TTSET.DLL, setup file routines*/ |
| 32 |
#include <winsock2.h> |
| 33 |
#include <ws2tcpip.h> |
| 34 |
#include "teraterm.h" |
| 35 |
#include "tttypes.h" |
| 36 |
#include <stdio.h> |
| 37 |
#include <string.h> |
| 38 |
#include <direct.h> |
| 39 |
#include <ctype.h> |
| 40 |
#include <errno.h> |
| 41 |
#define _CRTDBG_MAP_ALLOC |
| 42 |
#include <stdlib.h> |
| 43 |
#include <crtdbg.h> |
| 44 |
|
| 45 |
#include "ttlib.h" |
| 46 |
#include "tt_res.h" |
| 47 |
#include "servicenames.h" |
| 48 |
#include "codeconv.h" |
| 49 |
#include "win32helper.h" |
| 50 |
#include "inifile_com.h" |
| 51 |
#include "ttlib_charset.h" |
| 52 |
#include "asprintf.h" |
| 53 |
|
| 54 |
#define DllExport __declspec(dllexport) |
| 55 |
#include "ttset.h" |
| 56 |
|
| 57 |
#define Section "Tera Term" |
| 58 |
#define SectionW L"Tera Term" |
| 59 |
|
| 60 |
#define MaxStrLen (LONG)512 |
| 61 |
|
| 62 |
static const PCHAR TermList[] = |
| 63 |
{ "VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282", |
| 64 |
"VT320", "VT382", "VT420", "VT520", "VT525", NULL }; |
| 65 |
|
| 66 |
static const PCHAR RussList2[] = { "Windows", "KOI8-R", NULL }; |
| 67 |
|
| 68 |
|
| 69 |
/* |
| 70 |
* �V���A���|�[�g���A���������` |
| 71 |
*/ |
| 72 |
#define IDENDMARK 0xFFFF |
| 73 |
|
| 74 |
typedef struct id_str_pair { |
| 75 |
WORD id; |
| 76 |
const char *str; |
| 77 |
} id_str_pair_t; |
| 78 |
|
| 79 |
static const id_str_pair_t serial_conf_databit[] = { |
| 80 |
{IdDataBit7, "7"}, |
| 81 |
{IdDataBit8, "8"}, |
| 82 |
{IDENDMARK, NULL}, |
| 83 |
}; |
| 84 |
|
| 85 |
static const id_str_pair_t serial_conf_parity[] = { |
| 86 |
{IdParityNone, "none"}, |
| 87 |
{IdParityOdd, "odd"}, |
| 88 |
{IdParityEven, "even"}, |
| 89 |
{IdParityMark, "mark"}, |
| 90 |
{IdParitySpace, "space"}, |
| 91 |
{IDENDMARK, NULL}, |
| 92 |
}; |
| 93 |
|
| 94 |
static const id_str_pair_t serial_conf_stopbit[] = { |
| 95 |
{IdStopBit1, "1"}, |
| 96 |
{IdStopBit2, "2"}, |
| 97 |
{IDENDMARK, NULL}, |
| 98 |
}; |
| 99 |
|
| 100 |
static id_str_pair_t serial_conf_flowctrl[] = { |
| 101 |
{IdFlowX, "x"}, |
| 102 |
{IdFlowHard, "hard"}, |
| 103 |
{IdFlowHard, "rtscts"}, |
| 104 |
{IdFlowNone, "none"}, |
| 105 |
{IdFlowHardDsrDtr, "dsrdtr"}, |
| 106 |
{IDENDMARK, NULL}, |
| 107 |
}; |
| 108 |
|
| 109 |
|
| 110 |
/* |
| 111 |
* �V���A���|�[�g���A������ |
| 112 |
* Id���������������������B |
| 113 |
* |
| 114 |
* return |
| 115 |
* TRUE: �������� |
| 116 |
* FALSE: �������s |
| 117 |
*/ |
| 118 |
int SerialPortConfconvertId2Str(enum serial_port_conf type, WORD id, PCHAR str, int strlen) |
| 119 |
{ |
| 120 |
const id_str_pair_t *conf; |
| 121 |
int ret = FALSE; |
| 122 |
int i; |
| 123 |
|
| 124 |
switch (type) { |
| 125 |
case COM_DATABIT: |
| 126 |
conf = serial_conf_databit; |
| 127 |
break; |
| 128 |
case COM_PARITY: |
| 129 |
conf = serial_conf_parity; |
| 130 |
break; |
| 131 |
case COM_STOPBIT: |
| 132 |
conf = serial_conf_stopbit; |
| 133 |
break; |
| 134 |
case COM_FLOWCTRL: |
| 135 |
conf = serial_conf_flowctrl; |
| 136 |
break; |
| 137 |
default: |
| 138 |
conf = NULL; |
| 139 |
break; |
| 140 |
} |
| 141 |
if (conf == NULL) |
| 142 |
goto error; |
| 143 |
|
| 144 |
for (i = 0 ; ; i++) { |
| 145 |
if (conf[i].id == IDENDMARK) |
| 146 |
goto error; |
| 147 |
if (conf[i].id == id) { |
| 148 |
strncpy_s(str, strlen, conf[i].str, _TRUNCATE); |
| 149 |
break; |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
ret = TRUE; |
| 154 |
|
| 155 |
error: |
| 156 |
return (ret); |
| 157 |
} |
| 158 |
|
| 159 |
#undef GetPrivateProfileInt |
| 160 |
#undef GetPrivateProfileString |
| 161 |
#define GetPrivateProfileInt(p1, p2, p3, p4) GetPrivateProfileIntAFileW(p1, p2, p3, p4) |
| 162 |
#define GetPrivateProfileString(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
| 163 |
#define GetPrivateProfileStringA(p1, p2, p3, p4, p5, p6) GetPrivateProfileStringAFileW(p1, p2, p3, p4, p5, p6) |
| 164 |
#define WritePrivateProfileStringA(p1, p2, p3, p4) WritePrivateProfileStringAFileW(p1, p2, p3, p4) |
| 165 |
|
| 166 |
/* |
| 167 |
* �V���A���|�[�g���A������ |
| 168 |
* ����������Id�����������B |
| 169 |
* |
| 170 |
* return |
| 171 |
* TRUE: �������� |
| 172 |
* FALSE: �������s |
| 173 |
*/ |
| 174 |
static int SerialPortConfconvertStr2Id(enum serial_port_conf type, const wchar_t *str, WORD *id) |
| 175 |
{ |
| 176 |
const id_str_pair_t *conf; |
| 177 |
int ret = FALSE; |
| 178 |
int i; |
| 179 |
char *strA; |
| 180 |
|
| 181 |
switch (type) { |
| 182 |
case COM_DATABIT: |
| 183 |
conf = serial_conf_databit; |
| 184 |
break; |
| 185 |
case COM_PARITY: |
| 186 |
conf = serial_conf_parity; |
| 187 |
break; |
| 188 |
case COM_STOPBIT: |
| 189 |
conf = serial_conf_stopbit; |
| 190 |
break; |
| 191 |
case COM_FLOWCTRL: |
| 192 |
conf = serial_conf_flowctrl; |
| 193 |
break; |
| 194 |
default: |
| 195 |
conf = NULL; |
| 196 |
break; |
| 197 |
} |
| 198 |
if (conf == NULL) { |
| 199 |
return FALSE; |
| 200 |
} |
| 201 |
|
| 202 |
strA = ToCharW(str); |
| 203 |
for (i = 0 ; ; i++) { |
| 204 |
if (conf[i].id == IDENDMARK) { |
| 205 |
ret = FALSE; |
| 206 |
break; |
| 207 |
} |
| 208 |
if (_stricmp(conf[i].str, strA) == 0) { |
| 209 |
*id = conf[i].id; |
| 210 |
ret = TRUE; |
| 211 |
break; |
| 212 |
} |
| 213 |
} |
| 214 |
free(strA); |
| 215 |
return ret; |
| 216 |
} |
| 217 |
|
| 218 |
static WORD str2id(const PCHAR *List, PCHAR str, WORD DefId) |
| 219 |
{ |
| 220 |
WORD i; |
| 221 |
i = 0; |
| 222 |
while ((List[i] != NULL) && (_stricmp(List[i], str) != 0)) |
| 223 |
i++; |
| 224 |
if (List[i] == NULL) |
| 225 |
i = DefId; |
| 226 |
else |
| 227 |
i++; |
| 228 |
|
| 229 |
return i; |
| 230 |
} |
| 231 |
|
| 232 |
static void id2str(const PCHAR *List, WORD Id, WORD DefId, PCHAR str, int destlen) |
| 233 |
{ |
| 234 |
int i; |
| 235 |
|
| 236 |
if (Id == 0) |
| 237 |
i = DefId - 1; |
| 238 |
else { |
| 239 |
i = 0; |
| 240 |
while ((List[i] != NULL) && (i < Id - 1)) |
| 241 |
i++; |
| 242 |
if (List[i] == NULL) |
| 243 |
i = DefId - 1; |
| 244 |
} |
| 245 |
strncpy_s(str, destlen, List[i], _TRUNCATE); |
| 246 |
} |
| 247 |
|
| 248 |
static int IconName2IconId(const wchar_t *name) |
| 249 |
{ |
| 250 |
int id; |
| 251 |
|
| 252 |
if (_wcsicmp(name, L"tterm") == 0) { |
| 253 |
id = IDI_TTERM; |
| 254 |
} |
| 255 |
else if (_wcsicmp(name, L"vt") == 0) { |
| 256 |
id = IDI_VT; |
| 257 |
} |
| 258 |
else if (_wcsicmp(name, L"tek") == 0) { |
| 259 |
id = IDI_TEK; |
| 260 |
} |
| 261 |
else if (_wcsicmp(name, L"tterm_classic") == 0) { |
| 262 |
id = IDI_TTERM_CLASSIC; |
| 263 |
} |
| 264 |
else if (_wcsicmp(name, L"vt_classic") == 0) { |
| 265 |
id = IDI_VT_CLASSIC; |
| 266 |
} |
| 267 |
else if (_wcsicmp(name, L"tterm_3d") == 0) { |
| 268 |
id = IDI_TTERM_3D; |
| 269 |
} |
| 270 |
else if (_wcsicmp(name, L"vt_3d") == 0) { |
| 271 |
id = IDI_VT_3D; |
| 272 |
} |
| 273 |
else if (_wcsicmp(name, L"tterm_flat") == 0) { |
| 274 |
id = IDI_TTERM_FLAT; |
| 275 |
} |
| 276 |
else if (_wcsicmp(name, L"vt_flat") == 0) { |
| 277 |
id = IDI_VT_FLAT; |
| 278 |
} |
| 279 |
else if (_wcsicmp(name, L"cygterm") == 0) { |
| 280 |
id = IDI_CYGTERM; |
| 281 |
} |
| 282 |
else { |
| 283 |
id = IdIconDefault; |
| 284 |
} |
| 285 |
return id; |
| 286 |
} |
| 287 |
|
| 288 |
static int IconName2IconIdA(const char *name) |
| 289 |
{ |
| 290 |
wchar_t *nameW = ToWcharA(name); |
| 291 |
int id = IconName2IconId(nameW); |
| 292 |
free(nameW); |
| 293 |
return id; |
| 294 |
} |
| 295 |
|
| 296 |
|
| 297 |
void IconId2IconName(char *name, int len, int id) { |
| 298 |
char *icon; |
| 299 |
switch (id) { |
| 300 |
case IDI_TTERM: |
| 301 |
icon = "tterm"; |
| 302 |
break; |
| 303 |
case IDI_VT: |
| 304 |
icon = "vt"; |
| 305 |
break; |
| 306 |
case IDI_TEK: |
| 307 |
icon = "tek"; |
| 308 |
break; |
| 309 |
case IDI_TTERM_CLASSIC: |
| 310 |
icon = "tterm_classic"; |
| 311 |
break; |
| 312 |
case IDI_VT_CLASSIC: |
| 313 |
icon = "vt_classic"; |
| 314 |
break; |
| 315 |
case IDI_TTERM_3D: |
| 316 |
icon = "tterm_3d"; |
| 317 |
break; |
| 318 |
case IDI_VT_3D: |
| 319 |
icon = "vt_3d"; |
| 320 |
break; |
| 321 |
case IDI_TTERM_FLAT: |
| 322 |
icon = "tterm_flat"; |
| 323 |
break; |
| 324 |
case IDI_VT_FLAT: |
| 325 |
icon = "vt_flat"; |
| 326 |
break; |
| 327 |
case IDI_CYGTERM: |
| 328 |
icon = "cygterm"; |
| 329 |
break; |
| 330 |
default: |
| 331 |
icon = "Default"; |
| 332 |
} |
| 333 |
strncpy_s(name, len, icon, _TRUNCATE); |
| 334 |
} |
| 335 |
|
| 336 |
static WORD GetOnOff(PCHAR Sect, PCHAR Key, const wchar_t *FName, BOOL Default) |
| 337 |
{ |
| 338 |
char Temp[4]; |
| 339 |
GetPrivateProfileString(Sect, Key, "", Temp, sizeof(Temp), FName); |
| 340 |
if (Default) { |
| 341 |
if (_stricmp(Temp, "off") == 0) |
| 342 |
return 0; |
| 343 |
else |
| 344 |
return 1; |
| 345 |
} |
| 346 |
else { |
| 347 |
if (_stricmp(Temp, "on") == 0) |
| 348 |
return 1; |
| 349 |
else |
| 350 |
return 0; |
| 351 |
} |
| 352 |
} |
| 353 |
|
| 354 |
void WriteOnOff(PCHAR Sect, PCHAR Key, const wchar_t *FName, WORD Flag) |
| 355 |
{ |
| 356 |
const char *on_off = (Flag != 0) ? "on" : "off"; |
| 357 |
WritePrivateProfileStringA(Sect, Key, on_off, FName); |
| 358 |
} |
| 359 |
|
| 360 |
void WriteInt(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i) |
| 361 |
{ |
| 362 |
char Temp[15]; |
| 363 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", i); |
| 364 |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 365 |
} |
| 366 |
|
| 367 |
void WriteUint(PCHAR Sect, PCHAR Key, const wchar_t *FName, UINT i) |
| 368 |
{ |
| 369 |
char Temp[15]; |
| 370 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%u", i); |
| 371 |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 372 |
} |
| 373 |
|
| 374 |
void WriteInt2(PCHAR Sect, PCHAR Key, const wchar_t *FName, int i1, int i2) |
| 375 |
{ |
| 376 |
char Temp[32]; |
| 377 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d", i1, i2); |
| 378 |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 379 |
} |
| 380 |
|
| 381 |
void WriteInt4(PCHAR Sect, PCHAR Key, const wchar_t *FName, |
| 382 |
int i1, int i2, int i3, int i4) |
| 383 |
{ |
| 384 |
char Temp[64]; |
| 385 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d", |
| 386 |
i1, i2, i3, i4); |
| 387 |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 388 |
} |
| 389 |
|
| 390 |
void WriteInt6(PCHAR Sect, PCHAR Key, const wchar_t *FName, |
| 391 |
int i1, int i2, int i3, int i4, int i5, int i6) |
| 392 |
{ |
| 393 |
char Temp[96]; |
| 394 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d,%d", |
| 395 |
i1, i2,i3, i4, i5, i6); |
| 396 |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 397 |
} |
| 398 |
|
| 399 |
// �t�H���g�������������A4�p�����[�^�� |
| 400 |
static void WriteFont(PCHAR Sect, PCHAR Key, const wchar_t *FName, |
| 401 |
PCHAR Name, int x, int y, int charset) |
| 402 |
{ |
| 403 |
char Temp[80]; |
| 404 |
if (Name[0] != 0) |
| 405 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d,%d", |
| 406 |
Name, x, y, charset); |
| 407 |
else |
| 408 |
Temp[0] = 0; |
| 409 |
WritePrivateProfileStringA(Sect, Key, Temp, FName); |
| 410 |
} |
| 411 |
|
| 412 |
// �t�H���g�������������A4�p�����[�^�� |
| 413 |
static void ReadFont( |
| 414 |
const char *Sect, const char *Key, const char *Default, const wchar_t *FName, |
| 415 |
char *FontName, size_t FontNameLen, POINT *FontSize, int *FontCharSet) |
| 416 |
{ |
| 417 |
char Temp[MAX_PATH]; |
| 418 |
GetPrivateProfileString(Sect, Key, Default, |
| 419 |
Temp, _countof(Temp), FName); |
| 420 |
if (Temp[0] == 0) { |
| 421 |
// �f�t�H���g���Z�b�g������������ & ini���G���g���[���������� |
| 422 |
FontName[0] = 0; |
| 423 |
FontSize->x = 0; |
| 424 |
FontSize->y = 0; |
| 425 |
*FontCharSet = 0; |
| 426 |
} else { |
| 427 |
GetNthString(Temp, 1, FontNameLen, FontName); |
| 428 |
GetNthNum(Temp, 2, &(FontSize->x)); |
| 429 |
GetNthNum(Temp, 3, &(FontSize->y)); |
| 430 |
GetNthNum(Temp, 4, FontCharSet); |
| 431 |
// TODO ���������p�[�X���� |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
// �t�H���g�������������A3�p�����[�^�� |
| 436 |
static void ReadFont3( |
| 437 |
const wchar_t *Sect, const wchar_t *Key, const wchar_t *Default, const wchar_t *FName, |
| 438 |
wchar_t *FontName, size_t FontNameLen, int *FontPoint, int *FontCharSet) |
| 439 |
{ |
| 440 |
wchar_t *Temp; |
| 441 |
hGetPrivateProfileStringW(Sect, Key, Default, FName, & Temp); |
| 442 |
if (Temp[0] == 0) { |
| 443 |
// �f�t�H���g���Z�b�g������������ & ini���G���g���[���������� |
| 444 |
FontName[0] = 0; |
| 445 |
*FontPoint = 0; |
| 446 |
*FontCharSet = 0; |
| 447 |
} else { |
| 448 |
GetNthStringW(Temp, 1, FontNameLen, FontName); |
| 449 |
GetNthNumW(Temp, 2, FontPoint); |
| 450 |
GetNthNumW(Temp, 3, FontCharSet); |
| 451 |
// TODO ���������p�[�X���� |
| 452 |
} |
| 453 |
free(Temp); |
| 454 |
} |
| 455 |
|
| 456 |
/** |
| 457 |
* BG�Z�N�V�������������� |
| 458 |
* �e�[�}���O���A�C�e�� |
| 459 |
*/ |
| 460 |
static void DispReadIni(const wchar_t *FName, PTTSet ts) |
| 461 |
{ |
| 462 |
wchar_t *base; |
| 463 |
ts->EtermLookfeel.BGEnable = GetPrivateProfileInt(BG_SECTION, "BGEnable", 0, FName); |
| 464 |
ts->EtermLookfeel.BGUseAlphaBlendAPI = GetOnOff(BG_SECTION, "BGUseAlphaBlendAPI", FName, TRUE); |
| 465 |
ts->EtermLookfeel.BGNoFrame = GetOnOff(BG_SECTION, "BGNoFrame", FName, FALSE); |
| 466 |
ts->EtermLookfeel.BGFastSizeMove = GetOnOff(BG_SECTION, "BGFastSizeMove", FName, TRUE); |
| 467 |
ts->EtermLookfeel.BGNoCopyBits = GetOnOff(BG_SECTION, "BGFlickerlessMove", FName, TRUE); |
| 468 |
if (ts->EtermLookfeel.BGSPIPathW != NULL) { |
| 469 |
free(ts->EtermLookfeel.BGSPIPathW); |
| 470 |
} |
| 471 |
hGetPrivateProfileStringW(BG_SECTIONW, L"BGSPIPath", L"plugin", FName, &base); |
| 472 |
if (base[0] == 0) { |
| 473 |
free(base); |
| 474 |
ts->EtermLookfeel.BGSPIPathW = NULL; |
| 475 |
} |
| 476 |
else { |
| 477 |
wchar_t *full; |
| 478 |
if (IsRelativePathW(base)) { |
| 479 |
aswprintf(&full, L"%s\\%s", ts->HomeDirW, base); |
| 480 |
ts->EtermLookfeel.BGSPIPathW = full; |
| 481 |
free(base); |
| 482 |
} |
| 483 |
else { |
| 484 |
ts->EtermLookfeel.BGSPIPathW = base; |
| 485 |
} |
| 486 |
} |
| 487 |
hGetPrivateProfileStringW(BG_SECTIONW, L"BGThemeFile", L"", FName, &base); |
| 488 |
if (base[0] == 0) { |
| 489 |
free(base); |
| 490 |
ts->EtermLookfeel.BGThemeFileW = NULL; |
| 491 |
} |
| 492 |
else { |
| 493 |
if (IsRelativePathW(base)) { |
| 494 |
wchar_t *full; |
| 495 |
aswprintf(&full, L"%s\\%s", ts->HomeDirW, base); |
| 496 |
ts->EtermLookfeel.BGThemeFileW = full; |
| 497 |
free(base); |
| 498 |
} |
| 499 |
else { |
| 500 |
ts->EtermLookfeel.BGThemeFileW = base; |
| 501 |
} |
| 502 |
} |
| 503 |
} |
| 504 |
|
| 505 |
/** |
| 506 |
* BG�Z�N�V�������������� |
| 507 |
* �e�[�}���O���A�C�e�� |
| 508 |
*/ |
| 509 |
static void DispWriteIni(const wchar_t *FName, PTTSet ts) |
| 510 |
{ |
| 511 |
// Eterm lookfeel alphablend (theme file) |
| 512 |
WriteInt(BG_SECTION, "BGEnable", FName, ts->EtermLookfeel.BGEnable); |
| 513 |
WritePrivateProfileStringW(BG_SECTIONW, L"BGThemeFile", |
| 514 |
ts->EtermLookfeel.BGThemeFileW, FName); |
| 515 |
WriteOnOff(BG_SECTION, "BGUseAlphaBlendAPI", FName, |
| 516 |
ts->EtermLookfeel.BGUseAlphaBlendAPI); |
| 517 |
WritePrivateProfileStringW(BG_SECTIONW, L"BGSPIPath", |
| 518 |
ts->EtermLookfeel.BGSPIPathW, FName); |
| 519 |
WriteOnOff(BG_SECTION, "BGFastSizeMove", FName, |
| 520 |
ts->EtermLookfeel.BGFastSizeMove); |
| 521 |
WriteOnOff(BG_SECTION, "BGFlickerlessMove", FName, |
| 522 |
ts->EtermLookfeel.BGNoCopyBits); |
| 523 |
WriteOnOff(BG_SECTION, "BGNoFrame", FName, |
| 524 |
ts->EtermLookfeel.BGNoFrame); |
| 525 |
} |
| 526 |
|
| 527 |
/** |
| 528 |
* Unicode Ambiguous,Emoji ���f�t�H���g�� |
| 529 |
*/ |
| 530 |
static int GetDefaultUnicodeWidth(void) |
| 531 |
{ |
| 532 |
int ret_val = 1; |
| 533 |
const int langcode = GetUserDefaultUILanguage(); |
| 534 |
if (langcode == 0x0411 || // Japanese |
| 535 |
langcode == 0x0412 || // Korean |
| 536 |
langcode == 0x0404 || // Chinese (Traditional) |
| 537 |
langcode == 0x0804 ) // Chinese (Simplified) |
| 538 |
{ |
| 539 |
ret_val = 2; |
| 540 |
} |
| 541 |
return ret_val; |
| 542 |
} |
| 543 |
|
| 544 |
void PASCAL _ReadIniFile(const wchar_t *FName, PTTSet ts) |
| 545 |
{ |
| 546 |
int i; |
| 547 |
HDC TmpDC; |
| 548 |
char Temp[MAX_PATH], Temp2[MAX_PATH], *p; |
| 549 |
wchar_t TempW[MAX_PATH]; |
| 550 |
WORD TmpColor[12][6]; |
| 551 |
|
| 552 |
ts->Minimize = 0; |
| 553 |
ts->HideWindow = 0; |
| 554 |
ts->LogFlag = 0; // Log flags |
| 555 |
ts->FTFlag = 0; // File transfer flags |
| 556 |
ts->MenuFlag = 0; // Menu flags |
| 557 |
ts->TermFlag = 0; // Terminal flag |
| 558 |
ts->ColorFlag = 0; // ANSI/Attribute color flags |
| 559 |
ts->FontFlag = 0; // Font flag |
| 560 |
ts->PortFlag = 0; // Port flags |
| 561 |
ts->WindowFlag = 0; // Window flags |
| 562 |
ts->CtrlFlag = 0; // Control sequence flags |
| 563 |
ts->PasteFlag = 0; // Clipboard Paste flags |
| 564 |
ts->TelPort = 23; |
| 565 |
|
| 566 |
ts->DisableTCPEchoCR = FALSE; |
| 567 |
|
| 568 |
/* |
| 569 |
* Version number |
| 570 |
* �����t�@�C���������o�[�W������ Tera Term �����������������\�� |
| 571 |
* �����t�@�C�����������������l���������A������ Tera Term ���o�[�W�������g������ |
| 572 |
*/ |
| 573 |
GetPrivateProfileString(Section, "Version", TT_VERSION_STR("."), Temp, sizeof(Temp), FName); |
| 574 |
p = strchr(Temp, '.'); |
| 575 |
if (p) { |
| 576 |
*p++ = 0; |
| 577 |
ts->ConfigVersion = atoi(Temp) * 10000 + atoi(p); |
| 578 |
} |
| 579 |
else { |
| 580 |
ts->ConfigVersion = 0; |
| 581 |
} |
| 582 |
|
| 583 |
// TTX �� �m�F�����������ATera Term ���o�[�W�������i�[�������� |
| 584 |
ts->RunningVersion = TT_VERSION_MAJOR * 10000 + TT_VERSION_MINOR; |
| 585 |
|
| 586 |
/* Language */ |
| 587 |
GetPrivateProfileString(Section, "Language", "", |
| 588 |
Temp, sizeof(Temp), FName); |
| 589 |
if (Temp[0] != 0) { |
| 590 |
ts->Language = GetLanguageFromStr(Temp); |
| 591 |
} |
| 592 |
else { |
| 593 |
switch (PRIMARYLANGID(GetSystemDefaultLangID())) { |
| 594 |
case LANG_JAPANESE: |
| 595 |
ts->Language = IdJapanese; |
| 596 |
break; |
| 597 |
case LANG_RUSSIAN: |
| 598 |
ts->Language = IdRussian; |
| 599 |
break; |
| 600 |
case LANG_KOREAN: // HKS |
| 601 |
ts->Language = IdKorean; |
| 602 |
break; |
| 603 |
default: |
| 604 |
ts->Language = IdEnglish; |
| 605 |
} |
| 606 |
} |
| 607 |
|
| 608 |
/* Port type */ |
| 609 |
GetPrivateProfileString(Section, "Port", "", |
| 610 |
Temp, sizeof(Temp), FName); |
| 611 |
if (_stricmp(Temp, "serial") == 0) |
| 612 |
ts->PortType = IdSerial; |
| 613 |
else { |
| 614 |
ts->PortType = IdTCPIP; |
| 615 |
} |
| 616 |
|
| 617 |
/* VT win position */ |
| 618 |
GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */ |
| 619 |
GetNthNum(Temp, 1, (int *) (&ts->VTPos.x)); |
| 620 |
GetNthNum(Temp, 2, (int *) (&ts->VTPos.y)); |
| 621 |
|
| 622 |
/* TEK win position */ |
| 623 |
GetPrivateProfileString(Section, "TEKPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */ |
| 624 |
GetNthNum(Temp, 1, (int *) &(ts->TEKPos.x)); |
| 625 |
GetNthNum(Temp, 2, (int *) &(ts->TEKPos.y)); |
| 626 |
|
| 627 |
/* Save VT Window position */ |
| 628 |
ts->SaveVTWinPos = GetOnOff(Section, "SaveVTWinPos", FName, FALSE); |
| 629 |
|
| 630 |
/* VT terminal size */ |
| 631 |
GetPrivateProfileString(Section, "TerminalSize", "80,24", |
| 632 |
Temp, sizeof(Temp), FName); |
| 633 |
GetNthNum(Temp, 1, &ts->TerminalWidth); |
| 634 |
GetNthNum(Temp, 2, &ts->TerminalHeight); |
| 635 |
if (ts->TerminalWidth <= 0) |
| 636 |
ts->TerminalWidth = 80; |
| 637 |
else if (ts->TerminalWidth > TermWidthMax) |
| 638 |
ts->TerminalWidth = TermWidthMax; |
| 639 |
if (ts->TerminalHeight <= 0) |
| 640 |
ts->TerminalHeight = 24; |
| 641 |
else if (ts->TerminalHeight > TermHeightMax) |
| 642 |
ts->TerminalHeight = TermHeightMax; |
| 643 |
|
| 644 |
/* Terminal size = Window size */ |
| 645 |
ts->TermIsWin = GetOnOff(Section, "TermIsWin", FName, FALSE); |
| 646 |
|
| 647 |
/* Auto window resize flag */ |
| 648 |
ts->AutoWinResize = GetOnOff(Section, "AutoWinResize", FName, FALSE); |
| 649 |
|
| 650 |
/* CR Receive */ |
| 651 |
GetPrivateProfileString(Section, "CRReceive", "", |
| 652 |
Temp, sizeof(Temp), FName); |
| 653 |
if (_stricmp(Temp, "CRLF") == 0) { |
| 654 |
ts->CRReceive = IdCRLF; |
| 655 |
} |
| 656 |
else if (_stricmp(Temp, "LF") == 0) { |
| 657 |
ts->CRReceive = IdLF; |
| 658 |
} |
| 659 |
else if (_stricmp(Temp, "AUTO") == 0) { |
| 660 |
ts->CRReceive = IdAUTO; |
| 661 |
} |
| 662 |
else { |
| 663 |
ts->CRReceive = IdCR; |
| 664 |
} |
| 665 |
/* CR Send */ |
| 666 |
GetPrivateProfileString(Section, "CRSend", "", |
| 667 |
Temp, sizeof(Temp), FName); |
| 668 |
if (_stricmp(Temp, "CRLF") == 0) { |
| 669 |
ts->CRSend = IdCRLF; |
| 670 |
} |
| 671 |
else if (_stricmp(Temp, "LF") == 0) { |
| 672 |
ts->CRSend = IdLF; |
| 673 |
} |
| 674 |
else { |
| 675 |
ts->CRSend = IdCR; |
| 676 |
} |
| 677 |
ts->CRSend_ini = ts->CRSend; |
| 678 |
|
| 679 |
/* Local echo */ |
| 680 |
ts->LocalEcho = GetOnOff(Section, "LocalEcho", FName, FALSE); |
| 681 |
ts->LocalEcho_ini = ts->LocalEcho; |
| 682 |
|
| 683 |
/* Answerback */ |
| 684 |
GetPrivateProfileString(Section, "Answerback", "", Temp, |
| 685 |
sizeof(Temp), FName); |
| 686 |
ts->AnswerbackLen = |
| 687 |
Hex2Str(Temp, ts->Answerback, sizeof(ts->Answerback)); |
| 688 |
|
| 689 |
/* Kanji Code (receive) */ |
| 690 |
GetPrivateProfileString(Section, "KanjiReceive", "", |
| 691 |
Temp, sizeof(Temp), FName); |
| 692 |
ts->KanjiCode = GetKanjiCodeFromStr(ts->Language, Temp); |
| 693 |
|
| 694 |
/* Katakana (receive) */ |
| 695 |
GetPrivateProfileString(Section, "KatakanaReceive", "", |
| 696 |
Temp, sizeof(Temp), FName); |
| 697 |
if (_stricmp(Temp, "7") == 0) |
| 698 |
ts->JIS7Katakana = 1; |
| 699 |
else |
| 700 |
ts->JIS7Katakana = 0; |
| 701 |
|
| 702 |
/* Kanji Code (transmit) */ |
| 703 |
GetPrivateProfileString(Section, "KanjiSend", "", |
| 704 |
Temp, sizeof(Temp), FName); |
| 705 |
ts->KanjiCodeSend = GetKanjiCodeFromStr(ts->Language, Temp); |
| 706 |
|
| 707 |
/* Katakana (receive) */ |
| 708 |
GetPrivateProfileString(Section, "KatakanaSend", "", |
| 709 |
Temp, sizeof(Temp), FName); |
| 710 |
if (_stricmp(Temp, "7") == 0) |
| 711 |
ts->JIS7KatakanaSend = 1; |
| 712 |
else |
| 713 |
ts->JIS7KatakanaSend = 0; |
| 714 |
|
| 715 |
/* KanjiIn */ |
| 716 |
GetPrivateProfileString(Section, "KanjiIn", "", |
| 717 |
Temp, sizeof(Temp), FName); |
| 718 |
if (_stricmp(Temp, "@") == 0) |
| 719 |
ts->KanjiIn = IdKanjiInA; |
| 720 |
else |
| 721 |
ts->KanjiIn = IdKanjiInB; |
| 722 |
|
| 723 |
/* KanjiOut */ |
| 724 |
GetPrivateProfileString(Section, "KanjiOut", "", |
| 725 |
Temp, sizeof(Temp), FName); |
| 726 |
if (_stricmp(Temp, "B") == 0) |
| 727 |
ts->KanjiOut = IdKanjiOutB; |
| 728 |
else if (_stricmp(Temp, "H") == 0) |
| 729 |
ts->KanjiOut = IdKanjiOutH; |
| 730 |
else |
| 731 |
ts->KanjiOut = IdKanjiOutJ; |
| 732 |
|
| 733 |
/* Auto Win Switch VT<->TEK */ |
| 734 |
ts->AutoWinSwitch = GetOnOff(Section, "AutoWinSwitch", FName, FALSE); |
| 735 |
|
| 736 |
/* Terminal ID */ |
| 737 |
GetPrivateProfileString(Section, "TerminalID", "", |
| 738 |
Temp, sizeof(Temp), FName); |
| 739 |
ts->TerminalID = str2id(TermList, Temp, IdVT100); |
| 740 |
|
| 741 |
/* Title String */ |
| 742 |
GetPrivateProfileString(Section, "Title", "Tera Term", |
| 743 |
ts->Title, sizeof(ts->Title), FName); |
| 744 |
|
| 745 |
/* Cursor shape */ |
| 746 |
GetPrivateProfileString(Section, "CursorShape", "", |
| 747 |
Temp, sizeof(Temp), FName); |
| 748 |
if (_stricmp(Temp, "vertical") == 0) |
| 749 |
ts->CursorShape = IdVCur; |
| 750 |
else if (_stricmp(Temp, "horizontal") == 0) |
| 751 |
ts->CursorShape = IdHCur; |
| 752 |
else |
| 753 |
ts->CursorShape = IdBlkCur; |
| 754 |
|
| 755 |
/* Hide title */ |
| 756 |
ts->HideTitle = GetOnOff(Section, "HideTitle", FName, FALSE); |
| 757 |
|
| 758 |
/* Popup menu */ |
| 759 |
ts->PopupMenu = GetOnOff(Section, "PopupMenu", FName, FALSE); |
| 760 |
|
| 761 |
/* PC-Style bold color mapping */ |
| 762 |
if (GetOnOff(Section, "PcBoldColor", FName, FALSE)) |
| 763 |
ts->ColorFlag |= CF_PCBOLD16; |
| 764 |
|
| 765 |
/* aixterm style 16 colors mode */ |
| 766 |
if (GetOnOff(Section, "Aixterm16Color", FName, FALSE)) |
| 767 |
ts->ColorFlag |= CF_AIXTERM16; |
| 768 |
|
| 769 |
/* xterm style 256 colors mode */ |
| 770 |
if (GetOnOff(Section, "Xterm256Color", FName, TRUE)) |
| 771 |
ts->ColorFlag |= CF_XTERM256; |
| 772 |
|
| 773 |
/* Enable scroll buffer */ |
| 774 |
ts->EnableScrollBuff = |
| 775 |
GetOnOff(Section, "EnableScrollBuff", FName, TRUE); |
| 776 |
|
| 777 |
/* Scroll buffer size */ |
| 778 |
ts->ScrollBuffSize = |
| 779 |
GetPrivateProfileInt(Section, "ScrollBuffSize", 100, FName); |
| 780 |
|
| 781 |
/* VT Color */ |
| 782 |
GetPrivateProfileString(Section, "VTColor", "0,0,0,255,255,255", |
| 783 |
Temp, sizeof(Temp), FName); |
| 784 |
for (i = 0; i <= 5; i++) |
| 785 |
GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); |
| 786 |
for (i = 0; i <= 1; i++) |
| 787 |
ts->VTColor[i] = RGB((BYTE) TmpColor[0][i * 3], |
| 788 |
(BYTE) TmpColor[0][i * 3 + 1], |
| 789 |
(BYTE) TmpColor[0][i * 3 + 2]); |
| 790 |
|
| 791 |
/* VT Bold Color */ |
| 792 |
GetPrivateProfileString(Section, "VTBoldColor", "0,0,255,255,255,255", |
| 793 |
Temp, sizeof(Temp), FName); |
| 794 |
for (i = 0; i <= 5; i++) |
| 795 |
GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); |
| 796 |
for (i = 0; i <= 1; i++) |
| 797 |
ts->VTBoldColor[i] = RGB((BYTE) TmpColor[0][i * 3], |
| 798 |
(BYTE) TmpColor[0][i * 3 + 1], |
| 799 |
(BYTE) TmpColor[0][i * 3 + 2]); |
| 800 |
if (GetOnOff(Section, "EnableBoldAttrColor", FName, TRUE)) |
| 801 |
ts->ColorFlag |= CF_BOLDCOLOR; |
| 802 |
|
| 803 |
/* VT Blink Color */ |
| 804 |
GetPrivateProfileString(Section, "VTBlinkColor", "255,0,0,255,255,255", |
| 805 |
Temp, sizeof(Temp), FName); |
| 806 |
for (i = 0; i <= 5; i++) |
| 807 |
GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); |
| 808 |
for (i = 0; i <= 1; i++) |
| 809 |
ts->VTBlinkColor[i] = RGB((BYTE) TmpColor[0][i * 3], |
| 810 |
(BYTE) TmpColor[0][i * 3 + 1], |
| 811 |
(BYTE) TmpColor[0][i * 3 + 2]); |
| 812 |
if (GetOnOff(Section, "EnableBlinkAttrColor", FName, TRUE)) |
| 813 |
ts->ColorFlag |= CF_BLINKCOLOR; |
| 814 |
|
| 815 |
/* VT Reverse Color */ |
| 816 |
GetPrivateProfileString(Section, "VTReverseColor", "255,255,255,0,0,0", |
| 817 |
Temp, sizeof(Temp), FName); |
| 818 |
for (i = 0; i <= 5; i++) |
| 819 |
GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); |
| 820 |
for (i = 0; i <= 1; i++) |
| 821 |
ts->VTReverseColor[i] = RGB((BYTE) TmpColor[0][i * 3], |
| 822 |
(BYTE) TmpColor[0][i * 3 + 1], |
| 823 |
(BYTE) TmpColor[0][i * 3 + 2]); |
| 824 |
if (GetOnOff(Section, "EnableReverseAttrColor", FName, FALSE)) |
| 825 |
ts->ColorFlag |= CF_REVERSECOLOR; |
| 826 |
|
| 827 |
ts->EnableClickableUrl = |
| 828 |
GetOnOff(Section, "EnableClickableUrl", FName, FALSE); |
| 829 |
|
| 830 |
/* URL Color */ |
| 831 |
GetPrivateProfileString(Section, "URLColor", "0,255,0,255,255,255", |
| 832 |
Temp, sizeof(Temp), FName); |
| 833 |
for (i = 0; i <= 5; i++) |
| 834 |
GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); |
| 835 |
for (i = 0; i <= 1; i++) |
| 836 |
ts->URLColor[i] = RGB((BYTE) TmpColor[0][i * 3], |
| 837 |
(BYTE) TmpColor[0][i * 3 + 1], |
| 838 |
(BYTE) TmpColor[0][i * 3 + 2]); |
| 839 |
if (GetOnOff(Section, "EnableURLColor", FName, TRUE)) |
| 840 |
ts->ColorFlag |= CF_URLCOLOR; |
| 841 |
|
| 842 |
if (GetOnOff(Section, "URLUnderline", FName, TRUE)) |
| 843 |
ts->FontFlag |= FF_URLUNDERLINE; |
| 844 |
|
| 845 |
/* TEK Color */ |
| 846 |
GetPrivateProfileString(Section, "TEKColor", "0,0,0,255,255,255", |
| 847 |
Temp, sizeof(Temp), FName); |
| 848 |
for (i = 0; i <= 5; i++) |
| 849 |
GetNthNum(Temp, i + 1, (int *) &(TmpColor[0][i])); |
| 850 |
for (i = 0; i <= 1; i++) |
| 851 |
ts->TEKColor[i] = RGB((BYTE) TmpColor[0][i * 3], |
| 852 |
(BYTE) TmpColor[0][i * 3 + 1], |
| 853 |
(BYTE) TmpColor[0][i * 3 + 2]); |
| 854 |
|
| 855 |
/* ANSI color definition (in the case FullColor=on) -- special option |
| 856 |
o UseTextColor should be off, or the background and foreground color of |
| 857 |
VTColor are assigned to color-number 0 and 7 respectively, even if |
| 858 |
they are specified in ANSIColor. |
| 859 |
o ANSIColor is a set of 4 values that are color-number(0--15), |
| 860 |
red-value(0--255), green-value(0--255) and blue-value(0--255). */ |
| 861 |
GetPrivateProfileString(Section, "ANSIColor", |
| 862 |
" 0, 0, 0, 0," |
| 863 |
" 1,255, 0, 0," |
| 864 |
" 2, 0,255, 0," |
| 865 |
" 3,255,255, 0," |
| 866 |
" 4, 0, 0,255," |
| 867 |
" 5,255, 0,255," |
| 868 |
" 6, 0,255,255," |
| 869 |
" 7,255,255,255," |
| 870 |
" 8,128,128,128," |
| 871 |
" 9,128, 0, 0," |
| 872 |
"10, 0,128, 0," |
| 873 |
"11,128,128, 0," |
| 874 |
"12, 0, 0,128," |
| 875 |
"13,128, 0,128," |
| 876 |
"14, 0,128,128," |
| 877 |
"15,192,192,192", Temp, sizeof(Temp), FName); |
| 878 |
{ |
| 879 |
char *t; |
| 880 |
int n = 1; |
| 881 |
for (t = Temp; *t; t++) |
| 882 |
if (*t == ',') |
| 883 |
n++; |
| 884 |
n /= 4; |
| 885 |
for (i = 0; i < n; i++) { |
| 886 |
int colorid, r, g, b; |
| 887 |
GetNthNum(Temp, i * 4 + 1, (int *) &colorid); |
| 888 |
GetNthNum(Temp, i * 4 + 2, (int *) &r); |
| 889 |
GetNthNum(Temp, i * 4 + 3, (int *) &g); |
| 890 |
GetNthNum(Temp, i * 4 + 4, (int *) &b); |
| 891 |
ts->ANSIColor[colorid & 15] = |
| 892 |
RGB((BYTE) r, (BYTE) g, (BYTE) b); |
| 893 |
} |
| 894 |
} |
| 895 |
|
| 896 |
TmpDC = GetDC(0); /* Get screen device context */ |
| 897 |
for (i = 0; i <= 1; i++) |
| 898 |
ts->VTColor[i] = GetNearestColor(TmpDC, ts->VTColor[i]); |
| 899 |
for (i = 0; i <= 1; i++) |
| 900 |
ts->VTBoldColor[i] = GetNearestColor(TmpDC, ts->VTBoldColor[i]); |
| 901 |
for (i = 0; i <= 1; i++) |
| 902 |
ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]); |
| 903 |
for (i = 0; i <= 1; i++) |
| 904 |
ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]); |
| 905 |
/* begin - ishizaki */ |
| 906 |
for (i = 0; i <= 1; i++) |
| 907 |
ts->URLColor[i] = GetNearestColor(TmpDC, ts->URLColor[i]); |
| 908 |
/* end - ishizaki */ |
| 909 |
for (i = 0; i < 16; i++) |
| 910 |
ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]); |
| 911 |
ReleaseDC(0, TmpDC); |
| 912 |
if (GetOnOff(Section, "EnableANSIColor", FName, TRUE)) |
| 913 |
ts->ColorFlag |= CF_ANSICOLOR; |
| 914 |
|
| 915 |
/* TEK color emulation */ |
| 916 |
ts->TEKColorEmu = GetOnOff(Section, "TEKColorEmulation", FName, FALSE); |
| 917 |
|
| 918 |
/* VT Font */ |
| 919 |
ReadFont(Section, "VTFont", "Terminal,0,-13,1", FName, |
| 920 |
ts->VTFont, _countof(ts->VTFont), |
| 921 |
&ts->VTFontSize, &(ts->VTFontCharSet)); |
| 922 |
|
| 923 |
/* Bold font flag */ |
| 924 |
if (GetOnOff(Section, "EnableBold", FName, TRUE)) |
| 925 |
ts->FontFlag |= FF_BOLD; |
| 926 |
|
| 927 |
/* TEK Font */ |
| 928 |
ReadFont(Section, "TEKFont", "Courier,0,-13,0", FName, |
| 929 |
ts->TEKFont, _countof(ts->TEKFont), |
| 930 |
&ts->TEKFontSize, &(ts->TEKFontCharSet)); |
| 931 |
|
| 932 |
/* BS key */ |
| 933 |
GetPrivateProfileString(Section, "BSKey", "", |
| 934 |
Temp, sizeof(Temp), FName); |
| 935 |
if (_stricmp(Temp, "DEL") == 0) |
| 936 |
ts->BSKey = IdDEL; |
| 937 |
else |
| 938 |
ts->BSKey = IdBS; |
| 939 |
/* Delete key */ |
| 940 |
ts->DelKey = GetOnOff(Section, "DeleteKey", FName, FALSE); |
| 941 |
|
| 942 |
/* Meta Key */ |
| 943 |
GetPrivateProfileString(Section, "MetaKey", "off", Temp, sizeof(Temp), FName); |
| 944 |
if (_stricmp(Temp, "on") == 0) |
| 945 |
ts->MetaKey = IdMetaOn; |
| 946 |
else if (_stricmp(Temp, "left") == 0) |
| 947 |
ts->MetaKey = IdMetaLeft; |
| 948 |
else if (_stricmp(Temp, "right") == 0) |
| 949 |
ts->MetaKey = IdMetaRight; |
| 950 |
else |
| 951 |
ts->MetaKey = IdMetaOff; |
| 952 |
|
| 953 |
// Windows95 �n�����E�� Alt �������������� |
| 954 |
if (!IsWindowsNTKernel() && ts->MetaKey != IdMetaOff) { |
| 955 |
ts->MetaKey = IdMetaOn; |
| 956 |
} |
| 957 |
|
| 958 |
/* Application Keypad */ |
| 959 |
ts->DisableAppKeypad = |
| 960 |
GetOnOff(Section, "DisableAppKeypad", FName, FALSE); |
| 961 |
|
| 962 |
/* Application Cursor */ |
| 963 |
ts->DisableAppCursor = |
| 964 |
GetOnOff(Section, "DisableAppCursor", FName, FALSE); |
| 965 |
|
| 966 |
/* Russian keyboard type */ |
| 967 |
GetPrivateProfileString(Section, "RussKeyb", "", |
| 968 |
Temp, sizeof(Temp), FName); |
| 969 |
ts->RussKeyb = str2id(RussList2, Temp, IdWindows); |
| 970 |
|
| 971 |
/* Serial port ID */ |
| 972 |
ts->ComPort = GetPrivateProfileInt(Section, "ComPort", 1, FName); |
| 973 |
|
| 974 |
/* Baud rate */ |
| 975 |
ts->Baud = GetPrivateProfileInt(Section, "BaudRate", 9600, FName); |
| 976 |
|
| 977 |
/* Parity */ |
| 978 |
GetPrivateProfileStringW(SectionW, L"Parity", L"", |
| 979 |
TempW, _countof(TempW), FName); |
| 980 |
if (!SerialPortConfconvertStr2Id(COM_PARITY, TempW, &ts->Parity)) { |
| 981 |
ts->Parity = IdParityNone; |
| 982 |
} |
| 983 |
|
| 984 |
/* Data bit */ |
| 985 |
GetPrivateProfileStringW(SectionW, L"DataBit", L"", |
| 986 |
TempW, _countof(TempW), FName); |
| 987 |
if (!SerialPortConfconvertStr2Id(COM_DATABIT, TempW, &ts->DataBit)) { |
| 988 |
ts->DataBit = IdDataBit8; |
| 989 |
} |
| 990 |
|
| 991 |
/* Stop bit */ |
| 992 |
GetPrivateProfileStringW(SectionW, L"StopBit", L"", |
| 993 |
TempW, _countof(TempW), FName); |
| 994 |
if (!SerialPortConfconvertStr2Id(COM_STOPBIT, TempW, &ts->StopBit)) { |
| 995 |
ts->StopBit = IdStopBit1; |
| 996 |
} |
| 997 |
|
| 998 |
/* Flow control */ |
| 999 |
GetPrivateProfileStringW(SectionW, L"FlowCtrl", L"", |
| 1000 |
TempW, _countof(TempW), FName); |
| 1001 |
if (!SerialPortConfconvertStr2Id(COM_FLOWCTRL, TempW, &ts->Flow)) { |
| 1002 |
ts->Flow = IdFlowNone; |
| 1003 |
} |
| 1004 |
|
| 1005 |
/* Delay per character */ |
| 1006 |
ts->DelayPerChar = |
| 1007 |
GetPrivateProfileInt(Section, "DelayPerChar", 0, FName); |
| 1008 |
|
| 1009 |
/* Delay per line */ |
| 1010 |
ts->DelayPerLine = |
| 1011 |
GetPrivateProfileInt(Section, "DelayPerLine", 0, FName); |
| 1012 |
|
| 1013 |
/* Telnet flag */ |
| 1014 |
ts->Telnet = GetOnOff(Section, "Telnet", FName, TRUE); |
| 1015 |
|
| 1016 |
/* Telnet terminal type */ |
| 1017 |
GetPrivateProfileString(Section, "TermType", "xterm", ts->TermType, |
| 1018 |
sizeof(ts->TermType), FName); |
| 1019 |
|
| 1020 |
/* TCP port num */ |
| 1021 |
ts->TCPPort = |
| 1022 |
GetPrivateProfileInt(Section, "TCPPort", ts->TelPort, FName); |
| 1023 |
|
| 1024 |
/* Auto window close flag */ |
| 1025 |
ts->AutoWinClose = GetOnOff(Section, "AutoWinClose", FName, TRUE); |
| 1026 |
|
| 1027 |
/* History list */ |
| 1028 |
ts->HistoryList = GetOnOff(Section, "HistoryList", FName, FALSE); |
| 1029 |
|
| 1030 |
/* File transfer binary flag */ |
| 1031 |
ts->TransBin = GetOnOff(Section, "TransBin", FName, FALSE); |
| 1032 |
|
| 1033 |
/* Log binary flag */ |
| 1034 |
ts->LogBinary = GetOnOff(Section, "LogBinary", FName, FALSE); |
| 1035 |
|
| 1036 |
/* Log append */ |
| 1037 |
ts->Append = GetOnOff(Section, "LogAppend", FName, FALSE); |
| 1038 |
|
| 1039 |
/* Log plain text (2005.5.7 yutaka) */ |
| 1040 |
ts->LogTypePlainText = |
| 1041 |
GetOnOff(Section, "LogTypePlainText", FName, FALSE); |
| 1042 |
|
| 1043 |
/* Log with timestamp (2006.7.23 maya) */ |
| 1044 |
ts->LogTimestamp = GetOnOff(Section, "LogTimestamp", FName, FALSE); |
| 1045 |
|
| 1046 |
/* Log without transfer dialog */ |
| 1047 |
ts->LogHideDialog = GetOnOff(Section, "LogHideDialog", FName, FALSE); |
| 1048 |
|
| 1049 |
ts->LogAllBuffIncludedInFirst = GetOnOff(Section, "LogIncludeScreenBuffer", FName, FALSE); |
| 1050 |
|
| 1051 |
/* Timestamp format of Log each line */ |
| 1052 |
GetPrivateProfileString(Section, "LogTimestampFormat", "%Y-%m-%d %H:%M:%S.%N", |
| 1053 |
ts->LogTimestampFormat, sizeof(ts->LogTimestampFormat), |
| 1054 |
FName); |
| 1055 |
|
| 1056 |
/* Timestamp type */ |
| 1057 |
GetPrivateProfileString(Section, "LogTimestampType", "", Temp, sizeof(Temp), FName); |
| 1058 |
if (_stricmp(Temp, "UTC") == 0) |
| 1059 |
ts->LogTimestampType = TIMESTAMP_UTC; |
| 1060 |
else if (_stricmp(Temp, "LoggingElapsed") == 0) |
| 1061 |
ts->LogTimestampType = TIMESTAMP_ELAPSED_LOGSTART; |
| 1062 |
else if (_stricmp(Temp, "ConnectionElapsed") == 0) |
| 1063 |
ts->LogTimestampType = TIMESTAMP_ELAPSED_CONNECTED; |
| 1064 |
else if (_stricmp(Temp, "") == 0 && GetOnOff(Section, "LogTimestampUTC", FName, FALSE)) |
| 1065 |
// LogTimestampType ���������������� LogTimestampUTC ���l���Q������ |
| 1066 |
ts->LogTimestampType = TIMESTAMP_UTC; |
| 1067 |
else |
| 1068 |
ts->LogTimestampType = TIMESTAMP_LOCAL; |
| 1069 |
|
| 1070 |
/* File Transfer dialog visibility */ |
| 1071 |
ts->FTHideDialog = GetOnOff(Section, "FTHideDialog", FName, FALSE); |
| 1072 |
|
| 1073 |
/* Default Log file name (2006.8.28 maya) */ |
| 1074 |
GetPrivateProfileString(Section, "LogDefaultName", "teraterm.log", |
| 1075 |
ts->LogDefaultName, sizeof(ts->LogDefaultName), |
| 1076 |
FName); |
| 1077 |
|
| 1078 |
/* Default Log file path */ |
| 1079 |
hGetPrivateProfileStringW(SectionW, L"LogDefaultPath", ts->LogDirW, FName, &ts->LogDefaultPathW); |
| 1080 |
if (ts->LogDefaultPathW[0] == 0) { |
| 1081 |
// ���w��("LogDefaultPath=")�������A�f�t�H���g�l������������ |
| 1082 |
free(ts->LogDefaultPathW); |
| 1083 |
ts->LogDefaultPathW = _wcsdup(ts->LogDirW); |
| 1084 |
} |
| 1085 |
|
| 1086 |
/* Auto start logging (2007.5.31 maya) */ |
| 1087 |
ts->LogAutoStart = GetOnOff(Section, "LogAutoStart", FName, FALSE); |
| 1088 |
|
| 1089 |
/* Log Rotate (2013.3.24 yutaka) */ |
| 1090 |
ts->LogRotate = GetPrivateProfileInt(Section, "LogRotate", 0, FName); |
| 1091 |
ts->LogRotateSize = GetPrivateProfileInt(Section, "LogRotateSize", 0, FName); |
| 1092 |
ts->LogRotateSizeType = GetPrivateProfileInt(Section, "LogRotateSizeType", 0, FName); |
| 1093 |
ts->LogRotateStep = GetPrivateProfileInt(Section, "LogRotateStep", 0, FName); |
| 1094 |
|
| 1095 |
/* Deferred Log Write Mode (2013.4.20 yutaka) */ |
| 1096 |
ts->DeferredLogWriteMode = GetOnOff(Section, "DeferredLogWriteMode", FName, TRUE); |
| 1097 |
|
| 1098 |
|
| 1099 |
/* XMODEM option */ |
| 1100 |
GetPrivateProfileString(Section, "XmodemOpt", "", |
| 1101 |
Temp, sizeof(Temp), FName); |
| 1102 |
if (_stricmp(Temp, "crc") == 0) |
| 1103 |
ts->XmodemOpt = XoptCRC; |
| 1104 |
else if (_stricmp(Temp, "1k") == 0) |
| 1105 |
ts->XmodemOpt = Xopt1kCRC; |
| 1106 |
else if (_stricmp(Temp, "1ksum") == 0) |
| 1107 |
ts->XmodemOpt = Xopt1kCksum; |
| 1108 |
else |
| 1109 |
ts->XmodemOpt = XoptCheck; |
| 1110 |
|
| 1111 |
/* XMODEM binary file */ |
| 1112 |
ts->XmodemBin = GetOnOff(Section, "XmodemBin", FName, TRUE); |
| 1113 |
|
| 1114 |
/* XMODEM ���M�R�}���h (2007.12.21 yutaka) */ |
| 1115 |
GetPrivateProfileString(Section, "XModemRcvCommand", "", |
| 1116 |
ts->XModemRcvCommand, |
| 1117 |
sizeof(ts->XModemRcvCommand), FName); |
| 1118 |
|
| 1119 |
/* Default directory for file transfer */ |
| 1120 |
hGetPrivateProfileStringW(SectionW, L"FileDir", L"", FName, &ts->FileDirW); |
| 1121 |
if (ts->FileDirW != NULL && ts->FileDirW[0] != 0) { |
| 1122 |
wchar_t *FileDirExpanded; |
| 1123 |
hExpandEnvironmentStringsW(ts->FileDirW, &FileDirExpanded); |
| 1124 |
if (!DoesFolderExistW(FileDirExpanded)) { |
| 1125 |
free(ts->FileDirW); |
| 1126 |
ts->FileDirW = NULL; |
| 1127 |
} |
| 1128 |
free(FileDirExpanded); |
| 1129 |
} |
| 1130 |
if (ts->FileDirW == NULL || ts->FileDirW[0] == 0) { |
| 1131 |
// �f�t�H���g�t�H���_���Z�b�g���� |
| 1132 |
free(ts->FileDirW); |
| 1133 |
ts->FileDirW = GetDownloadFolderW(); |
| 1134 |
} |
| 1135 |
WideCharToACP_t(ts->FileDirW, ts->FileDir, sizeof(ts->FileDir)); |
| 1136 |
|
| 1137 |
/* filter on file send (2007.6.5 maya) */ |
| 1138 |
GetPrivateProfileString(Section, "FileSendFilter", "", |
| 1139 |
ts->FileSendFilter, sizeof(ts->FileSendFilter), |
| 1140 |
FName); |
| 1141 |
|
| 1142 |
/* SCP���M���p�X (2012.4.6 yutaka) */ |
| 1143 |
GetPrivateProfileString(Section, "ScpSendDir", "", |
| 1144 |
ts->ScpSendDir, sizeof(ts->ScpSendDir), FName); |
| 1145 |
|
| 1146 |
|
| 1147 |
/*--------------------------------------------------*/ |
| 1148 |
/* 8 bit control code flag -- special option */ |
| 1149 |
if (GetOnOff(Section, "Accept8BitCtrl", FName, TRUE)) |
| 1150 |
ts->TermFlag |= TF_ACCEPT8BITCTRL; |
| 1151 |
|
| 1152 |
/* Wrong sequence flag -- special option */ |
| 1153 |
if (GetOnOff(Section, "AllowWrongSequence", FName, FALSE)) |
| 1154 |
ts->TermFlag |= TF_ALLOWWRONGSEQUENCE; |
| 1155 |
|
| 1156 |
if (((ts->TermFlag & TF_ALLOWWRONGSEQUENCE) == 0) && |
| 1157 |
(ts->KanjiOut == IdKanjiOutH)) |
| 1158 |
ts->KanjiOut = IdKanjiOutJ; |
| 1159 |
|
| 1160 |
// Detect disconnect/reconnect of serial port --- special option |
| 1161 |
ts->AutoComPortReconnect = GetOnOff(Section, "AutoComPortReconnect", FName, TRUE); |
| 1162 |
|
| 1163 |
// Auto file renaming --- special option |
| 1164 |
if (GetOnOff(Section, "AutoFileRename", FName, FALSE)) |
| 1165 |
ts->FTFlag |= FT_RENAME; |
| 1166 |
|
| 1167 |
// Auto invoking (character set->G0->GL) --- special option |
| 1168 |
if (GetOnOff(Section, "AutoInvoke", FName, FALSE)) |
| 1169 |
ts->TermFlag |= TF_AUTOINVOKE; |
| 1170 |
|
| 1171 |
// Auto text copy --- special option |
| 1172 |
ts->AutoTextCopy = GetOnOff(Section, "AutoTextCopy", FName, TRUE); |
| 1173 |
|
| 1174 |
/* Back wrap -- special option */ |
| 1175 |
if (GetOnOff(Section, "BackWrap", FName, FALSE)) |
| 1176 |
ts->TermFlag |= TF_BACKWRAP; |
| 1177 |
|
| 1178 |
/* Beep type -- special option */ |
| 1179 |
GetPrivateProfileString(Section, "Beep", "", Temp, sizeof(Temp), FName); |
| 1180 |
if (_stricmp(Temp, "off") == 0) |
| 1181 |
ts->Beep = IdBeepOff; |
| 1182 |
else if (_stricmp(Temp, "visual") == 0) |
| 1183 |
ts->Beep = IdBeepVisual; |
| 1184 |
else |
| 1185 |
ts->Beep = IdBeepOn; |
| 1186 |
|
| 1187 |
/* Beep on connection & disconnection -- special option */ |
| 1188 |
if (GetOnOff(Section, "BeepOnConnect", FName, FALSE)) |
| 1189 |
ts->PortFlag |= PF_BEEPONCONNECT; |
| 1190 |
|
| 1191 |
/* Auto B-Plus activation -- special option */ |
| 1192 |
if (GetOnOff(Section, "BPAuto", FName, FALSE)) |
| 1193 |
ts->FTFlag |= FT_BPAUTO; |
| 1194 |
if ((ts->FTFlag & FT_BPAUTO) != 0) { /* Answerback */ |
| 1195 |
strncpy_s(ts->Answerback, sizeof(ts->Answerback), "\020++\0200", |
| 1196 |
_TRUNCATE); |
| 1197 |
ts->AnswerbackLen = 5; |
| 1198 |
} |
| 1199 |
|
| 1200 |
/* B-Plus ESCCTL flag -- special option */ |
| 1201 |
if (GetOnOff(Section, "BPEscCtl", FName, FALSE)) |
| 1202 |
ts->FTFlag |= FT_BPESCCTL; |
| 1203 |
|
| 1204 |
/* B-Plus log -- special option */ |
| 1205 |
if (GetOnOff(Section, "BPLog", FName, FALSE)) |
| 1206 |
ts->LogFlag |= LOG_BP; |
| 1207 |
|
| 1208 |
/* Clear serial port buffer when port opening -- special option */ |
| 1209 |
ts->ClearComBuffOnOpen = |
| 1210 |
GetOnOff(Section, "ClearComBuffOnOpen", FName, TRUE); |
| 1211 |
|
| 1212 |
/* When serial port is specified with with /C= option and the port does not exist, Tera Term will wait for port connection. */ |
| 1213 |
ts->WaitCom = GetOnOff(Section, "WaitCom", FName, FALSE); |
| 1214 |
|
| 1215 |
/* Confirm disconnection -- special option */ |
| 1216 |
if (GetOnOff(Section, "ConfirmDisconnect", FName, TRUE)) |
| 1217 |
ts->PortFlag |= PF_CONFIRMDISCONN; |
| 1218 |
|
| 1219 |
/* Ctrl code in Kanji -- special option */ |
| 1220 |
if (GetOnOff(Section, "CtrlInKanji", FName, TRUE)) |
| 1221 |
ts->TermFlag |= TF_CTRLINKANJI; |
| 1222 |
|
| 1223 |
/* Debug flag -- special option */ |
| 1224 |
ts->Debug = GetOnOff(Section, "Debug", FName, FALSE); |
| 1225 |
|
| 1226 |
/* Delimiter list -- special option */ |
| 1227 |
GetPrivateProfileString(Section, "DelimList", |
| 1228 |
"$20!\"#$24%&\'()*+,-./:;<=>?@[\\]^`{|}~", |
| 1229 |
Temp, sizeof(Temp), FName); |
| 1230 |
Hex2Str(Temp, ts->DelimList, sizeof(ts->DelimList)); |
| 1231 |
|
| 1232 |
/* regard DBCS characters as delimiters -- special option */ |
| 1233 |
ts->DelimDBCS = GetOnOff(Section, "DelimDBCS", FName, TRUE); |
| 1234 |
|
| 1235 |
// Enable popup menu -- special option |
| 1236 |
if (!GetOnOff(Section, "EnablePopupMenu", FName, TRUE)) |
| 1237 |
ts->MenuFlag |= MF_NOPOPUP; |
| 1238 |
|
| 1239 |
// Enable "Show menu" -- special option |
| 1240 |
if (!GetOnOff(Section, "EnableShowMenu", FName, TRUE)) |
| 1241 |
ts->MenuFlag |= MF_NOSHOWMENU; |
| 1242 |
|
| 1243 |
// Enable the status line -- special option |
| 1244 |
if (GetOnOff(Section, "EnableStatusLine", FName, TRUE)) |
| 1245 |
ts->TermFlag |= TF_ENABLESLINE; |
| 1246 |
|
| 1247 |
// Enable multiple bytes send -- special option |
| 1248 |
ts->FileSendHighSpeedMode = GetOnOff(Section, "FileSendHighSpeedMode", FName, TRUE); |
| 1249 |
|
| 1250 |
// fixed JIS --- special |
| 1251 |
if (GetOnOff(Section, "FixedJIS", FName, FALSE)) |
| 1252 |
ts->TermFlag |= TF_FIXEDJIS; |
| 1253 |
|
| 1254 |
/* IME Flag -- special option */ |
| 1255 |
ts->UseIME = GetOnOff(Section, "IME", FName, TRUE); |
| 1256 |
|
| 1257 |
/* IME-inline Flag -- special option */ |
| 1258 |
ts->IMEInline = GetOnOff(Section, "IMEInline", FName, TRUE); |
| 1259 |
|
| 1260 |
/* Kermit log -- special option */ |
| 1261 |
if (GetOnOff(Section, "KmtLog", FName, FALSE)) |
| 1262 |
ts->LogFlag |= LOG_KMT; |
| 1263 |
if (GetOnOff(Section, "KmtLongPacket", FName, FALSE)) |
| 1264 |
ts->KermitOpt |= KmtOptLongPacket; |
| 1265 |
if (GetOnOff(Section, "KmtFileAttr", FName, FALSE)) |
| 1266 |
ts->KermitOpt |= KmtOptFileAttr; |
| 1267 |
|
| 1268 |
// Enable language selection -- special option |
| 1269 |
if (!GetOnOff(Section, "LanguageSelection", FName, TRUE)) |
| 1270 |
ts->MenuFlag |= MF_NOLANGUAGE; |
| 1271 |
|
| 1272 |
/* Maximum scroll buffer size -- special option */ |
| 1273 |
ts->ScrollBuffMax = |
| 1274 |
GetPrivateProfileInt(Section, "MaxBuffSize", 10000, FName); |
| 1275 |
if (ts->ScrollBuffMax < 24) |
| 1276 |
ts->ScrollBuffMax = 10000; |
| 1277 |
|
| 1278 |
/* Max com port number -- special option */ |
| 1279 |
ts->MaxComPort = GetPrivateProfileInt(Section, "MaxComPort", 256, FName); |
| 1280 |
if (ts->MaxComPort < 4) |
| 1281 |
ts->MaxComPort = 4; |
| 1282 |
if (ts->MaxComPort > MAXCOMPORT) |
| 1283 |
ts->MaxComPort = MAXCOMPORT; |
| 1284 |
if ((ts->ComPort < 1) || (ts->ComPort > ts->MaxComPort)) |
| 1285 |
ts->ComPort = 1; |
| 1286 |
|
| 1287 |
/* Non-blinking cursor -- special option */ |
| 1288 |
ts->NonblinkingCursor = |
| 1289 |
GetOnOff(Section, "NonblinkingCursor", FName, FALSE); |
| 1290 |
|
| 1291 |
// �t�H�[�J�X���������|���S���J�[�\�� (2008.1.24 yutaka) |
| 1292 |
ts->KillFocusCursor = |
| 1293 |
GetOnOff(Section, "KillFocusCursor", FName, TRUE); |
| 1294 |
|
| 1295 |
/* Delay for pass-thru printing activation */ |
| 1296 |
/* -- special option */ |
| 1297 |
ts->PassThruDelay = |
| 1298 |
GetPrivateProfileInt(Section, "PassThruDelay", 3, FName); |
| 1299 |
|
| 1300 |
/* Printer port for pass-thru printing */ |
| 1301 |
/* -- special option */ |
| 1302 |
GetPrivateProfileString(Section, "PassThruPort", "", |
| 1303 |
ts->PrnDev, sizeof(ts->PrnDev), FName); |
| 1304 |
|
| 1305 |
/* �v�����^�p�����R�[�h�������t������ */ |
| 1306 |
if (GetOnOff(Section, "PrinterCtrlSequence", FName, TRUE)) |
| 1307 |
ts->TermFlag |= TF_PRINTERCTRL; |
| 1308 |
|
| 1309 |
/* Printer Font --- special option */ |
| 1310 |
ReadFont(Section, "PrnFont", NULL, FName, |
| 1311 |
ts->PrnFont, _countof(ts->PrnFont), |
| 1312 |
&ts->PrnFontSize, &(ts->PrnFontCharSet)); |
| 1313 |
|
| 1314 |
// Page margins (left, right, top, bottom) for printing |
| 1315 |
// -- special option |
| 1316 |
GetPrivateProfileString(Section, "PrnMargin", "50,50,50,50", |
| 1317 |
Temp, sizeof(Temp), FName); |
| 1318 |
for (i = 0; i <= 3; i++) |
| 1319 |
GetNthNum(Temp, 1 + i, &ts->PrnMargin[i]); |
| 1320 |
|
| 1321 |
/* Disable (convert to NL) Form Feed when printing */ |
| 1322 |
/* --- special option */ |
| 1323 |
ts->PrnConvFF = |
| 1324 |
GetOnOff(Section, "PrnConvFF", FName, FALSE); |
| 1325 |
|
| 1326 |
/* Quick-VAN log -- special option */ |
| 1327 |
if (GetOnOff(Section, "QVLog", FName, FALSE)) |
| 1328 |
ts->LogFlag |= LOG_QV; |
| 1329 |
|
| 1330 |
/* Quick-VAN window size -- special */ |
| 1331 |
ts->QVWinSize = GetPrivateProfileInt(Section, "QVWinSize", 8, FName); |
| 1332 |
|
| 1333 |
/* Scroll threshold -- special option */ |
| 1334 |
ts->ScrollThreshold = |
| 1335 |
GetPrivateProfileInt(Section, "ScrollThreshold", 12, FName); |
| 1336 |
|
| 1337 |
ts->MouseWheelScrollLine = |
| 1338 |
GetPrivateProfileInt(Section, "MouseWheelScrollLine", 3, FName); |
| 1339 |
|
| 1340 |
// Select on activate -- special option |
| 1341 |
ts->SelOnActive = GetOnOff(Section, "SelectOnActivate", FName, TRUE); |
| 1342 |
|
| 1343 |
/* Send 8bit control sequence -- special option */ |
| 1344 |
ts->Send8BitCtrl = GetOnOff(Section, "Send8BitCtrl", FName, FALSE); |
| 1345 |
|
| 1346 |
/* SendBreak time (in msec) -- special option */ |
| 1347 |
ts->SendBreakTime = |
| 1348 |
GetPrivateProfileInt(Section, "SendBreakTime", 1000, FName); |
| 1349 |
|
| 1350 |
/* Startup macro -- special option */ |
| 1351 |
hGetPrivateProfileStringW(SectionW, L"StartupMacro", L"", FName, &ts->MacroFNW); |
| 1352 |
WideCharToACP_t(ts->MacroFNW, ts->MacroFN, sizeof(ts->MacroFN)); |
| 1353 |
|
| 1354 |
/* TEK GIN Mouse keycode -- special option */ |
| 1355 |
ts->GINMouseCode = |
| 1356 |
GetPrivateProfileInt(Section, "TEKGINMouseCode", 32, FName); |
| 1357 |
|
| 1358 |
/* Telnet Auto Detect -- special option */ |
| 1359 |
ts->TelAutoDetect = GetOnOff(Section, "TelAutoDetect", FName, TRUE); |
| 1360 |
|
| 1361 |
/* Telnet binary flag -- special option */ |
| 1362 |
ts->TelBin = GetOnOff(Section, "TelBin", FName, FALSE); |
| 1363 |
|
| 1364 |
/* Telnet Echo flag -- special option */ |
| 1365 |
ts->TelEcho = GetOnOff(Section, "TelEcho", FName, FALSE); |
| 1366 |
|
| 1367 |
/* Telnet log -- special option */ |
| 1368 |
if (GetOnOff(Section, "TelLog", FName, FALSE)) |
| 1369 |
ts->LogFlag |= LOG_TEL; |
| 1370 |
|
| 1371 |
/* TCP port num for telnet -- special option */ |
| 1372 |
ts->TelPort = GetPrivateProfileInt(Section, "TelPort", 23, FName); |
| 1373 |
|
| 1374 |
/* Telnet keep-alive packet(NOP command) interval -- special option */ |
| 1375 |
ts->TelKeepAliveInterval = |
| 1376 |
GetPrivateProfileInt(Section, "TelKeepAliveInterval", 300, FName); |
| 1377 |
|
| 1378 |
/* Max number of broadcast commad history */ |
| 1379 |
ts->MaxBroadcatHistory = |
| 1380 |
GetPrivateProfileInt(Section, "MaxBroadcatHistory", 99, FName); |
| 1381 |
|
| 1382 |
/* Local echo for non-telnet */ |
| 1383 |
ts->TCPLocalEcho = GetOnOff(Section, "TCPLocalEcho", FName, FALSE); |
| 1384 |
|
| 1385 |
/* "new-line (transmit)" option for non-telnet -- special option */ |
| 1386 |
GetPrivateProfileString(Section, "TCPCRSend", "", |
| 1387 |
Temp, sizeof(Temp), FName); |
| 1388 |
if (_stricmp(Temp, "CR") == 0) |
| 1389 |
ts->TCPCRSend = IdCR; |
| 1390 |
else if (_stricmp(Temp, "CRLF") == 0) |
| 1391 |
ts->TCPCRSend = IdCRLF; |
| 1392 |
else |
| 1393 |
ts->TCPCRSend = 0; // disabled |
| 1394 |
|
| 1395 |
/* Use text (background) color for "white (black)" --- special option */ |
| 1396 |
if (GetOnOff(Section, "UseTextColor", FName, FALSE)) |
| 1397 |
ts->ColorFlag |= CF_USETEXTCOLOR; |
| 1398 |
|
| 1399 |
/* Title format -- special option */ |
| 1400 |
ts->TitleFormat = |
| 1401 |
GetPrivateProfileInt(Section, "TitleFormat", 13, FName); |
| 1402 |
|
| 1403 |
/* VT Compatible Tab -- special option */ |
| 1404 |
ts->VTCompatTab = GetOnOff(Section, "VTCompatTab", FName, FALSE); |
| 1405 |
|
| 1406 |
/* VT Font space --- special option */ |
| 1407 |
GetPrivateProfileString(Section, "VTFontSpace", "0,0,0,0", |
| 1408 |
Temp, sizeof(Temp), FName); |
| 1409 |
GetNthNum(Temp, 1, &ts->FontDX); |
| 1410 |
GetNthNum(Temp, 2, &ts->FontDW); |
| 1411 |
GetNthNum(Temp, 3, &ts->FontDY); |
| 1412 |
GetNthNum(Temp, 4, &ts->FontDH); |
| 1413 |
if (ts->FontDX < 0) |
| 1414 |
ts->FontDX = 0; |
| 1415 |
if (ts->FontDW < 0) |
| 1416 |
ts->FontDW = 0; |
| 1417 |
ts->FontDW = ts->FontDW + ts->FontDX; |
| 1418 |
if (ts->FontDY < 0) |
| 1419 |
ts->FontDY = 0; |
| 1420 |
if (ts->FontDH < 0) |
| 1421 |
ts->FontDH = 0; |
| 1422 |
ts->FontDH = ts->FontDH + ts->FontDY; |
| 1423 |
|
| 1424 |
// VT-print scaling factors (pixels per inch) --- special option |
| 1425 |
GetPrivateProfileString(Section, "VTPPI", "0,0", |
| 1426 |
Temp, sizeof(Temp), FName); |
| 1427 |
GetNthNum(Temp, 1, (int *) &ts->VTPPI.x); |
| 1428 |
GetNthNum(Temp, 2, (int *) &ts->VTPPI.y); |
| 1429 |
|
| 1430 |
// TEK-print scaling factors (pixels per inch) --- special option |
| 1431 |
GetPrivateProfileString(Section, "TEKPPI", "0,0", |
| 1432 |
Temp, sizeof(Temp), FName); |
| 1433 |
GetNthNum(Temp, 1, (int *) &ts->TEKPPI.x); |
| 1434 |
GetNthNum(Temp, 2, (int *) &ts->TEKPPI.y); |
| 1435 |
|
| 1436 |
// Show "Window" menu -- special option |
| 1437 |
if (GetOnOff(Section, "WindowMenu", FName, TRUE)) |
| 1438 |
ts->MenuFlag |= MF_SHOWWINMENU; |
| 1439 |
|
| 1440 |
/* XMODEM log -- special option */ |
| 1441 |
if (GetOnOff(Section, "XmodemLog", FName, FALSE)) |
| 1442 |
ts->LogFlag |= LOG_X; |
| 1443 |
|
| 1444 |
/* YMODEM log -- special option */ |
| 1445 |
if (GetOnOff(Section, "YmodemLog", FName, FALSE)) |
| 1446 |
ts->LogFlag |= LOG_Y; |
| 1447 |
|
| 1448 |
/* YMODEM ���M�R�}���h (2010.3.23 yutaka) */ |
| 1449 |
GetPrivateProfileString(Section, "YModemRcvCommand", "rb", |
| 1450 |
ts->YModemRcvCommand, sizeof(ts->YModemRcvCommand), FName); |
| 1451 |
|
| 1452 |
/* Auto ZMODEM activation -- special option */ |
| 1453 |
if (GetOnOff(Section, "ZmodemAuto", FName, FALSE)) |
| 1454 |
ts->FTFlag |= FT_ZAUTO; |
| 1455 |
|
| 1456 |
/* ZMODEM data subpacket length for sending -- special */ |
| 1457 |
ts->ZmodemDataLen = |
| 1458 |
GetPrivateProfileInt(Section, "ZmodemDataLen", 1024, FName); |
| 1459 |
/* ZMODEM window size for sending -- special */ |
| 1460 |
ts->ZmodemWinSize = |
| 1461 |
GetPrivateProfileInt(Section, "ZmodemWinSize", 32767, FName); |
| 1462 |
|
| 1463 |
/* ZMODEM ESCCTL flag -- special option */ |
| 1464 |
if (GetOnOff(Section, "ZmodemEscCtl", FName, FALSE)) |
| 1465 |
ts->FTFlag |= FT_ZESCCTL; |
| 1466 |
|
| 1467 |
/* ZMODEM log -- special option */ |
| 1468 |
if (GetOnOff(Section, "ZmodemLog", FName, FALSE)) |
| 1469 |
ts->LogFlag |= LOG_Z; |
| 1470 |
|
| 1471 |
/* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */ |
| 1472 |
GetPrivateProfileString(Section, "ZModemRcvCommand", "rz", |
| 1473 |
ts->ZModemRcvCommand, sizeof(ts->ZModemRcvCommand), FName); |
| 1474 |
|
| 1475 |
/* Enable continued-line copy -- special option */ |
| 1476 |
ts->EnableContinuedLineCopy = |
| 1477 |
GetOnOff(Section, "EnableContinuedLineCopy", FName, FALSE); |
| 1478 |
|
| 1479 |
if (GetOnOff(Section, "DisablePasteMouseRButton", FName, FALSE)) |
| 1480 |
ts->PasteFlag |= CPF_DISABLE_RBUTTON; |
| 1481 |
|
| 1482 |
if (GetOnOff(Section, "DisablePasteMouseMButton", FName, TRUE)) |
| 1483 |
ts->PasteFlag |= CPF_DISABLE_MBUTTON; |
| 1484 |
|
| 1485 |
if (GetOnOff(Section, "ConfirmPasteMouseRButton", FName, FALSE)) |
| 1486 |
ts->PasteFlag |= CPF_CONFIRM_RBUTTON; |
| 1487 |
|
| 1488 |
if (GetOnOff(Section, "ConfirmChangePaste", FName, TRUE)) |
| 1489 |
ts->PasteFlag |= CPF_CONFIRM_CHANGEPASTE; |
| 1490 |
|
| 1491 |
if (GetOnOff(Section, "ConfirmChangePasteCR", FName, TRUE)) |
| 1492 |
ts->PasteFlag |= CPF_CONFIRM_CHANGEPASTE_CR; |
| 1493 |
|
| 1494 |
GetPrivateProfileString(Section, "ConfirmChangePasteStringFile", "", |
| 1495 |
Temp, sizeof(Temp), FName); |
| 1496 |
|
| 1497 |
strncpy_s(ts->ConfirmChangePasteStringFile, sizeof(ts->ConfirmChangePasteStringFile), Temp, |
| 1498 |
_TRUNCATE); |
| 1499 |
|
| 1500 |
// added ScrollWindowClearScreen (2008.5.3 yutaka) |
| 1501 |
ts->ScrollWindowClearScreen = |
| 1502 |
GetOnOff(Section, "ScrollWindowClearScreen", FName, TRUE); |
| 1503 |
|
| 1504 |
// added SelectOnlyByLButton (2007.11.20 maya) |
| 1505 |
ts->SelectOnlyByLButton = |
| 1506 |
GetOnOff(Section, "SelectOnlyByLButton", FName, TRUE); |
| 1507 |
|
| 1508 |
// added DisableAcceleratorSendBreak (2007.3.17 maya) |
| 1509 |
ts->DisableAcceleratorSendBreak = |
| 1510 |
GetOnOff(Section, "DisableAcceleratorSendBreak", FName, FALSE); |
| 1511 |
|
| 1512 |
// WinSock connecting timeout value (2007.1.11 yutaka) |
| 1513 |
ts->ConnectingTimeout = |
| 1514 |
GetPrivateProfileInt(Section, "ConnectingTimeout", 0, FName); |
| 1515 |
|
| 1516 |
// mouse cursor |
| 1517 |
GetPrivateProfileString(Section, "MouseCursor", "IBEAM", |
| 1518 |
Temp, sizeof(Temp), FName); |
| 1519 |
strncpy_s(ts->MouseCursorName, sizeof(ts->MouseCursorName), Temp, |
| 1520 |
_TRUNCATE); |
| 1521 |
|
| 1522 |
// Translucent window |
| 1523 |
ts->AlphaBlendInactive = |
| 1524 |
GetPrivateProfileInt(Section, "AlphaBlend", 255, FName); |
| 1525 |
ts->AlphaBlendInactive = max(0, ts->AlphaBlendInactive); |
| 1526 |
ts->AlphaBlendInactive = min(255, ts->AlphaBlendInactive); |
| 1527 |
ts->AlphaBlendActive = |
| 1528 |
GetPrivateProfileInt(Section, "AlphaBlendActive", ts->AlphaBlendInactive, FName); |
| 1529 |
ts->AlphaBlendActive = max(0, ts->AlphaBlendActive); |
| 1530 |
ts->AlphaBlendActive = min(255, ts->AlphaBlendActive); |
| 1531 |
|
| 1532 |
// Cygwin install path |
| 1533 |
GetPrivateProfileString(Section, "CygwinDirectory ", "c:\\cygwin", |
| 1534 |
Temp, sizeof(Temp), FName); |
| 1535 |
strncpy_s(ts->CygwinDirectory, sizeof(ts->CygwinDirectory), Temp, |
| 1536 |
_TRUNCATE); |
| 1537 |
|
| 1538 |
// Viewlog Editor path |
| 1539 |
if (GetWindowsDirectory(Temp, sizeof(Temp)) + 13 < sizeof(Temp)) { // "\\notepad.exe"(12) + NUL(1) |
| 1540 |
strncat_s(Temp, sizeof(Temp), "\\notepad.exe", _TRUNCATE); |
| 1541 |
} |
| 1542 |
else { |
| 1543 |
Temp[0] = '\0'; |
| 1544 |
} |
| 1545 |
GetPrivateProfileString(Section, "ViewlogEditor ", Temp, |
| 1546 |
ts->ViewlogEditor, sizeof(ts->ViewlogEditor), FName); |
| 1547 |
|
| 1548 |
// UI language message file (�����p�X) |
| 1549 |
hGetPrivateProfileStringW(SectionW, L"UILanguageFile", NULL, FName, &ts->UILanguageFileW_ini); |
| 1550 |
if (ts->UILanguageFileW_ini[0] == 0) { |
| 1551 |
free(ts->UILanguageFileW_ini); |
| 1552 |
ts->UILanguageFileW_ini = _wcsdup(L"lang\\Default.lng"); |
| 1553 |
} |
| 1554 |
WideCharToACP_t(ts->UILanguageFileW_ini, ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini)); |
| 1555 |
|
| 1556 |
// UI language message file (full path) |
| 1557 |
ts->UILanguageFileW = GetUILanguageFileFullW(ts->ExeDirW, ts->UILanguageFileW_ini); |
| 1558 |
WideCharToACP_t(ts->UILanguageFileW, ts->UILanguageFile, sizeof(ts->UILanguageFile)); |
| 1559 |
|
| 1560 |
|
| 1561 |
// Broadcast Command History (2007.3.3 maya) |
| 1562 |
ts->BroadcastCommandHistory = |
| 1563 |
GetOnOff(Section, "BroadcastCommandHistory", FName, FALSE); |
| 1564 |
|
| 1565 |
// 337: 2007/03/20 Accept Broadcast |
| 1566 |
ts->AcceptBroadcast = |
| 1567 |
GetOnOff(Section, "AcceptBroadcast", FName, TRUE); |
| 1568 |
|
| 1569 |
// Confirm send a file when drag and drop (2007.12.28 maya) |
| 1570 |
ts->ConfirmFileDragAndDrop = |
| 1571 |
GetOnOff(Section, "ConfirmFileDragAndDrop", FName, TRUE); |
| 1572 |
|
| 1573 |
// Translate mouse wheel to cursor key when application cursor mode |
| 1574 |
ts->TranslateWheelToCursor = |
| 1575 |
GetOnOff(Section, "TranslateWheelToCursor", FName, TRUE); |
| 1576 |
|
| 1577 |
// Display "New Connection" dialog on startup (2008.1.18 maya) |
| 1578 |
ts->HostDialogOnStartup = |
| 1579 |
GetOnOff(Section, "HostDialogOnStartup", FName, TRUE); |
| 1580 |
|
| 1581 |
// Mouse event tracking |
| 1582 |
ts->MouseEventTracking = |
| 1583 |
GetOnOff(Section, "MouseEventTracking", FName, TRUE); |
| 1584 |
|
| 1585 |
// Maximized bug tweak |
| 1586 |
GetPrivateProfileString(Section, "MaximizedBugTweak", "2", Temp, |
| 1587 |
sizeof(Temp), FName); |
| 1588 |
if (_stricmp(Temp, "on") == 0) { |
| 1589 |
ts->MaximizedBugTweak = 2; |
| 1590 |
} |
| 1591 |
else { |
| 1592 |
ts->MaximizedBugTweak = atoi(Temp); |
| 1593 |
} |
| 1594 |
|
| 1595 |
// Convert Unicode symbol characters to DEC Special characters |
| 1596 |
ts->UnicodeDecSpMapping = |
| 1597 |
GetPrivateProfileInt(Section, "UnicodeToDecSpMapping", 3, FName); |
| 1598 |
|
| 1599 |
// VT Window Icon |
| 1600 |
GetPrivateProfileString(Section, "VTIcon", "Default", |
| 1601 |
Temp, sizeof(Temp), FName); |
| 1602 |
ts->VTIcon = IconName2IconIdA(Temp); |
| 1603 |
|
| 1604 |
// Tek Window Icon |
| 1605 |
GetPrivateProfileString(Section, "TEKIcon", "Default", |
| 1606 |
Temp, sizeof(Temp), FName); |
| 1607 |
ts->TEKIcon = IconName2IconIdA(Temp); |
| 1608 |
|
| 1609 |
// Unknown Unicode Character |
| 1610 |
ts->UnknownUnicodeCharaAsWide = |
| 1611 |
GetOnOff(Section, "UnknownUnicodeCharacterAsWide", FName, FALSE); |
| 1612 |
|
| 1613 |
// UseNormalBGColor |
| 1614 |
ts->UseNormalBGColor = |
| 1615 |
GetOnOff(Section, "UseNormalBGColor", FName, FALSE); |
| 1616 |
|
| 1617 |
// AutoScrollOnlyInBottomLine |
| 1618 |
ts->AutoScrollOnlyInBottomLine = |
| 1619 |
GetOnOff(Section, "AutoScrollOnlyInBottomLine", FName, FALSE); |
| 1620 |
|
| 1621 |
// Accept remote-controlled window title changing |
| 1622 |
GetPrivateProfileString(Section, "AcceptTitleChangeRequest", "overwrite", |
| 1623 |
Temp, sizeof(Temp), FName); |
| 1624 |
if (_stricmp(Temp, "overwrite") == 0 || _stricmp(Temp, "on") == 0) |
| 1625 |
ts->AcceptTitleChangeRequest = IdTitleChangeRequestOverwrite; |
| 1626 |
else if (_stricmp(Temp, "ahead") == 0) |
| 1627 |
ts->AcceptTitleChangeRequest = IdTitleChangeRequestAhead; |
| 1628 |
else if (_stricmp(Temp, "last") == 0) |
| 1629 |
ts->AcceptTitleChangeRequest = IdTitleChangeRequestLast; |
| 1630 |
else |
| 1631 |
ts->AcceptTitleChangeRequest = IdTitleChangeRequestOff; |
| 1632 |
|
| 1633 |
// Size of paste confirm dialog |
| 1634 |
GetPrivateProfileString(Section, "PasteDialogSize", "330,220", |
| 1635 |
Temp, sizeof(Temp), FName); |
| 1636 |
GetNthNum(Temp, 1, &ts->PasteDialogSize.cx); |
| 1637 |
GetNthNum(Temp, 2, &ts->PasteDialogSize.cy); |
| 1638 |
if (ts->PasteDialogSize.cx < 0) |
| 1639 |
ts->PasteDialogSize.cx = 330; |
| 1640 |
if (ts->PasteDialogSize.cy < 0) |
| 1641 |
ts->PasteDialogSize.cy = 220; |
| 1642 |
|
| 1643 |
// Disable mouse event tracking when Control-Key is pressed. |
| 1644 |
ts->DisableMouseTrackingByCtrl = |
| 1645 |
GetOnOff(Section, "DisableMouseTrackingByCtrl", FName, TRUE); |
| 1646 |
|
| 1647 |
// Disable TranslateWheelToCursor setting when Control-Key is pressed. |
| 1648 |
ts->DisableWheelToCursorByCtrl = |
| 1649 |
GetOnOff(Section, "DisableWheelToCursorByCtrl", FName, TRUE); |
| 1650 |
|
| 1651 |
// Strict Key Mapping. |
| 1652 |
ts->StrictKeyMapping = |
| 1653 |
GetOnOff(Section, "StrictKeyMapping", FName, FALSE); |
| 1654 |
|
| 1655 |
// added Wait4allMacroCommand (2009.3.23 yutaka) |
| 1656 |
ts->Wait4allMacroCommand = |
| 1657 |
GetOnOff(Section, "Wait4allMacroCommand", FName, FALSE); |
| 1658 |
|
| 1659 |
// added DisableMenuSendBreak (2009.4.6 maya) |
| 1660 |
ts->DisableMenuSendBreak = |
| 1661 |
GetOnOff(Section, "DisableMenuSendBreak", FName, FALSE); |
| 1662 |
|
| 1663 |
// added ClearScreenOnCloseConnection (2009.4.6 maya) |
| 1664 |
ts->ClearScreenOnCloseConnection = |
| 1665 |
GetOnOff(Section, "ClearScreenOnCloseConnection", FName, FALSE); |
| 1666 |
|
| 1667 |
// added DisableAcceleratorDuplicateSession (2009.4.6 maya) |
| 1668 |
ts->DisableAcceleratorDuplicateSession = |
| 1669 |
GetOnOff(Section, "DisableAcceleratorDuplicateSession", FName, FALSE); |
| 1670 |
|
| 1671 |
ts->AcceleratorNewConnection = |
| 1672 |
GetOnOff(Section, "AcceleratorNewConnection", FName, TRUE); |
| 1673 |
|
| 1674 |
ts->AcceleratorCygwinConnection = |
| 1675 |
GetOnOff(Section, "AcceleratorCygwinConnection", FName, TRUE); |
| 1676 |
|
| 1677 |
// added DisableMenuDuplicateSession (2010.8.3 maya) |
| 1678 |
ts->DisableMenuDuplicateSession = |
| 1679 |
GetOnOff(Section, "DisableMenuDuplicateSession", FName, FALSE); |
| 1680 |
|
| 1681 |
// added DisableMenuNewConnection (2010.8.4 maya) |
| 1682 |
ts->DisableMenuNewConnection = |
| 1683 |
GetOnOff(Section, "DisableMenuNewConnection", FName, FALSE); |
| 1684 |
|
| 1685 |
// added PasteDelayPerLine (2009.4.12 maya) |
| 1686 |
ts->PasteDelayPerLine = |
| 1687 |
GetPrivateProfileInt(Section, "PasteDelayPerLine", 10, FName); |
| 1688 |
{ |
| 1689 |
int tmp = min(max(0, ts->PasteDelayPerLine), 5000); |
| 1690 |
ts->PasteDelayPerLine = tmp; |
| 1691 |
} |
| 1692 |
|
| 1693 |
// Font scaling -- test |
| 1694 |
ts->FontScaling = GetOnOff(Section, "FontScaling", FName, FALSE); |
| 1695 |
|
| 1696 |
// Meta sets MSB |
| 1697 |
GetPrivateProfileString(Section, "Meta8Bit", "off", Temp, sizeof(Temp), FName); |
| 1698 |
if (_stricmp(Temp, "raw") == 0 || _stricmp(Temp, "on") == 0) |
| 1699 |
ts->Meta8Bit = IdMeta8BitRaw; |
| 1700 |
else if (_stricmp(Temp, "text") == 0) |
| 1701 |
ts->Meta8Bit = IdMeta8BitText; |
| 1702 |
else |
| 1703 |
ts->Meta8Bit = IdMeta8BitOff; |
| 1704 |
|
| 1705 |
// Window control sequence |
| 1706 |
if (GetOnOff(Section, "WindowCtrlSequence", FName, TRUE)) |
| 1707 |
ts->WindowFlag |= WF_WINDOWCHANGE; |
| 1708 |
|
| 1709 |
// Cursor control sequence |
| 1710 |
if (GetOnOff(Section, "CursorCtrlSequence", FName, FALSE)) |
| 1711 |
ts->WindowFlag |= WF_CURSORCHANGE; |
| 1712 |
|
| 1713 |
// Window report sequence |
| 1714 |
if (GetOnOff(Section, "WindowReportSequence", FName, TRUE)) |
| 1715 |
ts->WindowFlag |= WF_WINDOWREPORT; |
| 1716 |
|
| 1717 |
// Title report sequence |
| 1718 |
GetPrivateProfileString(Section, "TitleReportSequence", "Empty", Temp, sizeof(Temp), FName); |
| 1719 |
if (_stricmp(Temp, "accept") == 0) |
| 1720 |
ts->WindowFlag |= IdTitleReportAccept; |
| 1721 |
else if (_stricmp(Temp, "ignore") == 0 || _stricmp(Temp, "off") == 0) |
| 1722 |
ts->WindowFlag &= ~WF_TITLEREPORT; |
| 1723 |
else // empty |
| 1724 |
ts->WindowFlag |= IdTitleReportEmpty; |
| 1725 |
|
| 1726 |
// Line at a time mode |
| 1727 |
ts->EnableLineMode = GetOnOff(Section, "EnableLineMode", FName, TRUE); |
| 1728 |
|
| 1729 |
// Clear window on resize |
| 1730 |
if (GetOnOff(Section, "ClearOnResize", FName, TRUE)) |
| 1731 |
ts->TermFlag |= TF_CLEARONRESIZE; |
| 1732 |
|
| 1733 |
// Alternate Screen Buffer |
| 1734 |
if (GetOnOff(Section, "AlternateScreenBuffer", FName, TRUE)) |
| 1735 |
ts->TermFlag |= TF_ALTSCR; |
| 1736 |
|
| 1737 |
// IME status related cursor style |
| 1738 |
if (GetOnOff(Section, "IMERelatedCursor", FName, FALSE)) |
| 1739 |
ts->WindowFlag |= WF_IMECURSORCHANGE; |
| 1740 |
|
| 1741 |
// Terminal Unique ID |
| 1742 |
GetPrivateProfileString(Section, "TerminalUID", "FFFFFFFF", Temp, sizeof(Temp), FName); |
| 1743 |
if (strlen(Temp) == 8) { |
| 1744 |
for (i=0; i<8 && isxdigit((unsigned char)Temp[i]); i++) { |
| 1745 |
if (islower(Temp[i])) { |
| 1746 |
ts->TerminalUID[i] = toupper(Temp[i]); |
| 1747 |
} |
| 1748 |
else { |
| 1749 |
ts->TerminalUID[i] = Temp[i]; |
| 1750 |
} |
| 1751 |
} |
| 1752 |
if (i == 8) { |
| 1753 |
ts->TerminalUID[i] = 0; |
| 1754 |
} |
| 1755 |
else { |
| 1756 |
strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE); |
| 1757 |
} |
| 1758 |
} |
| 1759 |
else { |
| 1760 |
strncpy_s(ts->TerminalUID, sizeof(ts->TerminalUID), "FFFFFFFF", _TRUNCATE); |
| 1761 |
} |
| 1762 |
|
| 1763 |
// Lock Terminal UID |
| 1764 |
if (GetOnOff(Section, "LockTUID", FName, TRUE)) |
| 1765 |
ts->TermFlag |= TF_LOCKTUID; |
| 1766 |
|
| 1767 |
// Jump List |
| 1768 |
ts->JumpList = GetOnOff(Section, "JumpList", FName, TRUE); |
| 1769 |
|
| 1770 |
// TabStopModifySequence |
| 1771 |
GetPrivateProfileString(Section, "TabStopModifySequence", "on", Temp, sizeof(Temp), FName); |
| 1772 |
if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0) |
| 1773 |
ts->TabStopFlag = TABF_ALL; |
| 1774 |
else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0) |
| 1775 |
ts->TabStopFlag = TABF_NONE; |
| 1776 |
else { |
| 1777 |
ts->TabStopFlag = TABF_NONE; |
| 1778 |
for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) { |
| 1779 |
if (_stricmp(Temp2, "HTS") == 0) |
| 1780 |
ts->TabStopFlag |= TABF_HTS; |
| 1781 |
else if (_stricmp(Temp2, "HTS7") == 0) |
| 1782 |
ts->TabStopFlag |= TABF_HTS7; |
| 1783 |
else if (_stricmp(Temp2, "HTS8") == 0) |
| 1784 |
ts->TabStopFlag |= TABF_HTS8; |
| 1785 |
else if (_stricmp(Temp2, "TBC") == 0) |
| 1786 |
ts->TabStopFlag |= TABF_TBC; |
| 1787 |
else if (_stricmp(Temp2, "TBC0") == 0) |
| 1788 |
ts->TabStopFlag |= TABF_TBC0; |
| 1789 |
else if (_stricmp(Temp2, "TBC3") == 0) |
| 1790 |
ts->TabStopFlag |= TABF_TBC3; |
| 1791 |
} |
| 1792 |
} |
| 1793 |
|
| 1794 |
// Clipboard Access from Remote |
| 1795 |
ts->CtrlFlag &= ~CSF_CBMASK; |
| 1796 |
GetPrivateProfileString(Section, "ClipboardAccessFromRemote", "off", Temp, sizeof(Temp), FName); |
| 1797 |
if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "readwrite") == 0) |
| 1798 |
ts->CtrlFlag |= CSF_CBRW; |
| 1799 |
else if (_stricmp(Temp, "read") == 0) |
| 1800 |
ts->CtrlFlag |= CSF_CBREAD; |
| 1801 |
else if (_stricmp(Temp, "write") == 0) |
| 1802 |
ts->CtrlFlag |= CSF_CBWRITE; |
| 1803 |
else |
| 1804 |
ts->CtrlFlag |= CSF_CBNONE; // �������������� |
| 1805 |
|
| 1806 |
// Notify Clipboard Access from Remote |
| 1807 |
ts->NotifyClipboardAccess = GetOnOff(Section, "NotifyClipboardAccess", FName, TRUE); |
| 1808 |
|
| 1809 |
// Use invalid DECRPSS (for testing) |
| 1810 |
if (GetOnOff(Section, "UseInvalidDECRQSSResponse", FName, FALSE)) |
| 1811 |
ts->TermFlag |= TF_INVALIDDECRPSS; |
| 1812 |
|
| 1813 |
// ClickableUrlBrowser |
| 1814 |
GetPrivateProfileString(Section, "ClickableUrlBrowser", "", |
| 1815 |
ts->ClickableUrlBrowser, sizeof(ts->ClickableUrlBrowser), FName); |
| 1816 |
GetPrivateProfileString(Section, "ClickableUrlBrowserArg", "", |
| 1817 |
ts->ClickableUrlBrowserArg, sizeof(ts->ClickableUrlBrowserArg), FName); |
| 1818 |
|
| 1819 |
// Exclusive Lock when open the log file |
| 1820 |
ts->LogLockExclusive = GetOnOff(Section, "LogLockExclusive", FName, TRUE); |
| 1821 |
|
| 1822 |
// Font quality |
| 1823 |
GetPrivateProfileString(Section, "FontQuality", "default", |
| 1824 |
Temp, sizeof(Temp), FName); |
| 1825 |
if (_stricmp(Temp, "nonantialiased") == 0) |
| 1826 |
ts->FontQuality = NONANTIALIASED_QUALITY; |
| 1827 |
else if (_stricmp(Temp, "antialiased") == 0) |
| 1828 |
ts->FontQuality = ANTIALIASED_QUALITY; |
| 1829 |
else if (_stricmp(Temp, "cleartype") == 0) |
| 1830 |
ts->FontQuality = CLEARTYPE_QUALITY; |
| 1831 |
else |
| 1832 |
ts->FontQuality = DEFAULT_QUALITY; |
| 1833 |
|
| 1834 |
// Beep Over Used |
| 1835 |
ts->BeepOverUsedCount = |
| 1836 |
GetPrivateProfileInt(Section, "BeepOverUsedCount", 5, FName); |
| 1837 |
ts->BeepOverUsedTime = |
| 1838 |
GetPrivateProfileInt(Section, "BeepOverUsedTime", 2, FName); |
| 1839 |
ts->BeepSuppressTime = |
| 1840 |
GetPrivateProfileInt(Section, "BeepSuppressTime", 5, FName); |
| 1841 |
|
| 1842 |
// Max OSC string buffer size |
| 1843 |
ts->MaxOSCBufferSize = |
| 1844 |
GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName); |
| 1845 |
|
| 1846 |
ts->JoinSplitURL = GetOnOff(Section, "JoinSplitURL", FName, FALSE); |
| 1847 |
|
| 1848 |
GetPrivateProfileString(Section, "JoinSplitURLIgnoreEOLChar", "\\", Temp, sizeof(Temp), FName); |
| 1849 |
ts->JoinSplitURLIgnoreEOLChar = Temp[0]; |
| 1850 |
|
| 1851 |
// Debug modes. |
| 1852 |
GetPrivateProfileString(Section, "DebugModes", "all", Temp, sizeof(Temp), FName); |
| 1853 |
if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0) |
| 1854 |
ts->DebugModes = DBGF_ALL; |
| 1855 |
else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0) { |
| 1856 |
ts->DebugModes = DBGF_NONE; |
| 1857 |
ts->Debug = FALSE; |
| 1858 |
} |
| 1859 |
else { |
| 1860 |
ts->DebugModes = DBGF_NONE; |
| 1861 |
for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) { |
| 1862 |
if (_stricmp(Temp2, "normal") == 0) |
| 1863 |
ts->DebugModes |= DBGF_NORM; |
| 1864 |
else if (_stricmp(Temp2, "hex") == 0) |
| 1865 |
ts->DebugModes |= DBGF_HEXD; |
| 1866 |
else if (_stricmp(Temp2, "noout") == 0) |
| 1867 |
ts->DebugModes |= DBGF_NOUT; |
| 1868 |
} |
| 1869 |
if (ts->DebugModes == DBGF_NONE) |
| 1870 |
ts->Debug = FALSE; |
| 1871 |
} |
| 1872 |
|
| 1873 |
// Xmodem Timeout |
| 1874 |
GetPrivateProfileString(Section, "XmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName); |
| 1875 |
ts->XmodemTimeOutInit = GetNthNum2(Temp, 1, 10); |
| 1876 |
if (ts->XmodemTimeOutInit < 1) |
| 1877 |
ts->XmodemTimeOutInit = 1; |
| 1878 |
ts->XmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3); |
| 1879 |
if (ts->XmodemTimeOutInitCRC < 1) |
| 1880 |
ts->XmodemTimeOutInitCRC = 1; |
| 1881 |
ts->XmodemTimeOutShort = GetNthNum2(Temp, 3, 10); |
| 1882 |
if (ts->XmodemTimeOutShort < 1) |
| 1883 |
ts->XmodemTimeOutShort = 1; |
| 1884 |
ts->XmodemTimeOutLong = GetNthNum2(Temp, 4, 20); |
| 1885 |
if (ts->XmodemTimeOutLong < 1) |
| 1886 |
ts->XmodemTimeOutLong = 1; |
| 1887 |
ts->XmodemTimeOutVLong = GetNthNum2(Temp, 5, 60); |
| 1888 |
if (ts->XmodemTimeOutVLong < 1) |
| 1889 |
ts->XmodemTimeOutVLong = 1; |
| 1890 |
|
| 1891 |
// Ymodem Timeout |
| 1892 |
GetPrivateProfileString(Section, "YmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName); |
| 1893 |
ts->YmodemTimeOutInit = GetNthNum2(Temp, 1, 10); |
| 1894 |
if (ts->YmodemTimeOutInit < 1) |
| 1895 |
ts->YmodemTimeOutInit = 1; |
| 1896 |
ts->YmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3); |
| 1897 |
if (ts->YmodemTimeOutInitCRC < 1) |
| 1898 |
ts->YmodemTimeOutInitCRC = 1; |
| 1899 |
ts->YmodemTimeOutShort = GetNthNum2(Temp, 3, 10); |
| 1900 |
if (ts->YmodemTimeOutShort < 1) |
| 1901 |
ts->YmodemTimeOutShort = 1; |
| 1902 |
ts->YmodemTimeOutLong = GetNthNum2(Temp, 4, 20); |
| 1903 |
if (ts->YmodemTimeOutLong < 1) |
| 1904 |
ts->YmodemTimeOutLong = 1; |
| 1905 |
ts->YmodemTimeOutVLong = GetNthNum2(Temp, 5, 60); |
| 1906 |
if (ts->YmodemTimeOutVLong < 1) |
| 1907 |
ts->YmodemTimeOutVLong = 1; |
| 1908 |
|
| 1909 |
// Zmodem Timeout |
| 1910 |
GetPrivateProfileString(Section, "ZmodemTimeouts", "10,0,10,3", Temp, sizeof(Temp), FName); |
| 1911 |
ts->ZmodemTimeOutNormal = GetNthNum2(Temp, 1, 10); |
| 1912 |
if (ts->ZmodemTimeOutNormal < 1) |
| 1913 |
ts->ZmodemTimeOutNormal = 1; |
| 1914 |
ts->ZmodemTimeOutTCPIP = GetNthNum2(Temp, 2, 0); |
| 1915 |
if (ts->ZmodemTimeOutTCPIP < 0) |
| 1916 |
ts->ZmodemTimeOutTCPIP = 0; |
| 1917 |
ts->ZmodemTimeOutInit = GetNthNum2(Temp, 3, 10); |
| 1918 |
if (ts->ZmodemTimeOutInit < 1) |
| 1919 |
ts->ZmodemTimeOutInit = 1; |
| 1920 |
ts->ZmodemTimeOutFin = GetNthNum2(Temp, 4, 3); |
| 1921 |
if (ts->ZmodemTimeOutFin < 1) |
| 1922 |
ts->ZmodemTimeOutFin = 1; |
| 1923 |
|
| 1924 |
// Trim trailing new line character when pasting |
| 1925 |
if (GetOnOff(Section, "TrimTrailingNLonPaste", FName, FALSE)) |
| 1926 |
ts->PasteFlag |= CPF_TRIM_TRAILING_NL; |
| 1927 |
|
| 1928 |
// List Inactive Font |
| 1929 |
ts->ListHiddenFonts = GetOnOff(Section, "ListHiddenFonts", FName, FALSE); |
| 1930 |
|
| 1931 |
// ISO2022ShiftFunction |
| 1932 |
GetPrivateProfileString(Section, "ISO2022ShiftFunction", "on", Temp, sizeof(Temp), FName); |
| 1933 |
ts->ISO2022Flag = ISO2022_SHIFT_NONE; |
| 1934 |
for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) { |
| 1935 |
BOOL add=TRUE; |
| 1936 |
char *p = Temp2, *p2; |
| 1937 |
int mask = 0; |
| 1938 |
|
| 1939 |
while (*p == ' ' || *p == '\t') { |
| 1940 |
p++; |
| 1941 |
} |
| 1942 |
p2 = p + strlen(p); |
| 1943 |
while (p2 > p) { |
| 1944 |
p2--; |
| 1945 |
if (*p2 != ' ' && *p2 != '\t') { |
| 1946 |
break; |
| 1947 |
} |
| 1948 |
} |
| 1949 |
*++p2 = 0; |
| 1950 |
|
| 1951 |
if (*p == '-') { |
| 1952 |
p++; |
| 1953 |
add=FALSE; |
| 1954 |
} |
| 1955 |
else if (*p == '+') { |
| 1956 |
p++; |
| 1957 |
} |
| 1958 |
|
| 1959 |
if (_stricmp(p, "on") == 0 || _stricmp(p, "all") == 0) |
| 1960 |
ts->ISO2022Flag = ISO2022_SHIFT_ALL; |
| 1961 |
else if (_stricmp(p, "off") == 0 || _stricmp(p, "none") == 0) |
| 1962 |
ts->ISO2022Flag = ISO2022_SHIFT_NONE; |
| 1963 |
else if (_stricmp(p, "SI") == 0 || _stricmp(p, "LS0") == 0) |
| 1964 |
mask = ISO2022_SI; |
| 1965 |
else if (_stricmp(p, "SO") == 0 || _stricmp(p, "LS1") == 0) |
| 1966 |
mask = ISO2022_SO; |
| 1967 |
else if (_stricmp(p, "LS2") == 0) |
| 1968 |
mask = ISO2022_LS2; |
| 1969 |
else if (_stricmp(p, "LS3") == 0) |
| 1970 |
mask = ISO2022_LS3; |
| 1971 |
else if (_stricmp(p, "LS1R") == 0) |
| 1972 |
mask = ISO2022_LS1R; |
| 1973 |
else if (_stricmp(p, "LS2R") == 0) |
| 1974 |
mask = ISO2022_LS2R; |
| 1975 |
else if (_stricmp(p, "LS3R") == 0) |
| 1976 |
mask = ISO2022_LS3R; |
| 1977 |
else if (_stricmp(p, "SS2") == 0) |
| 1978 |
mask = ISO2022_SS2; |
| 1979 |
else if (_stricmp(p, "SS3") == 0) |
| 1980 |
mask = ISO2022_SS3; |
| 1981 |
|
| 1982 |
if (mask) { |
| 1983 |
if (add) { |
| 1984 |
ts->ISO2022Flag |= mask; |
| 1985 |
} |
| 1986 |
else { |
| 1987 |
ts->ISO2022Flag &= ~mask; |
| 1988 |
} |
| 1989 |
} |
| 1990 |
} |
| 1991 |
|
| 1992 |
// Terminal Speed (Used by telnet and ssh) |
| 1993 |
GetPrivateProfileString(Section, "TerminalSpeed", "38400", Temp, sizeof(Temp), FName); |
| 1994 |
GetNthNum(Temp, 1, &i); |
| 1995 |
if (i > 0) |
| 1996 |
ts->TerminalInputSpeed = i; |
| 1997 |
else |
| 1998 |
ts->TerminalInputSpeed = 38400; |
| 1999 |
GetNthNum(Temp, 2, &i); |
| 2000 |
if (i > 0) |
| 2001 |
ts->TerminalOutputSpeed = i; |
| 2002 |
else |
| 2003 |
ts->TerminalOutputSpeed = ts->TerminalInputSpeed; |
| 2004 |
|
| 2005 |
// Clear scroll buffer from remote -- special option |
| 2006 |
if (GetOnOff(Section, "ClearScrollBufferFromRemote", FName, TRUE)) |
| 2007 |
ts->TermFlag |= TF_REMOTECLEARSBUFF; |
| 2008 |
|
| 2009 |
// Delay for start of mouse selection |
| 2010 |
ts->SelectStartDelay = |
| 2011 |
GetPrivateProfileInt(Section, "MouseSelectStartDelay", 0, FName); |
| 2012 |
|
| 2013 |
// Fallback to CP932 (Experimental) |
| 2014 |
ts->FallbackToCP932 = GetOnOff(Section, "FallbackToCP932", FName, FALSE); |
| 2015 |
|
| 2016 |
// dialog font |
| 2017 |
ReadFont3(L"Tera Term", L"DlgFont", NULL, FName, |
| 2018 |
ts->DialogFontNameW, _countof(ts->DialogFontNameW), |
| 2019 |
&ts->DialogFontPoint, &ts->DialogFontCharSet); |
| 2020 |
|
| 2021 |
// Unicode���� |
| 2022 |
ts->UnicodeAmbiguousWidth = GetPrivateProfileInt(Section, "UnicodeAmbiguousWidth", 0, FName); |
| 2023 |
if (ts->UnicodeAmbiguousWidth < 1 || 2 < ts->UnicodeAmbiguousWidth) { |
| 2024 |
ts->UnicodeAmbiguousWidth = GetDefaultUnicodeWidth(); |
| 2025 |
} |
| 2026 |
ts->UnicodeEmojiOverride = (BYTE)GetOnOff(Section, "UnicodeEmojiOverride", FName, FALSE); |
| 2027 |
ts->UnicodeEmojiWidth = GetPrivateProfileInt(Section, "UnicodeEmojiWidth", 0, FName); |
| 2028 |
if (ts->UnicodeEmojiWidth < 1 || 2 < ts->UnicodeEmojiWidth) { |
| 2029 |
ts->UnicodeEmojiWidth = GetDefaultUnicodeWidth(); |
| 2030 |
} |
| 2031 |
|
| 2032 |
DispReadIni(FName, ts); |
| 2033 |
|
| 2034 |
// rounded corner preference for VT/TEK window |
| 2035 |
ts->WindowCornerDontround = GetOnOff(Section, "WindowCornerDontround", FName, FALSE); |
| 2036 |
|
| 2037 |
// Experimental |
| 2038 |
ts->ExperimentalTreeProprtySheetEnable = GetOnOff("Experimental", "TreeProprtySheet", FName, FALSE); |
| 2039 |
ts->ExperimentalDontUseFontDialog = GetOnOff("Experimental", "DontUseFontDialog", FName, FALSE); |
| 2040 |
} |
| 2041 |
|
| 2042 |
void PASCAL _WriteIniFile(const wchar_t *FName, PTTSet ts) |
| 2043 |
{ |
| 2044 |
int i; |
| 2045 |
char Temp[MAX_PATH]; |
| 2046 |
char buf[20]; |
| 2047 |
int ret; |
| 2048 |
char uimsg[MAX_UIMSG], uimsg2[MAX_UIMSG], msg[MAX_UIMSG]; |
| 2049 |
WORD TmpColor[12][6]; |
| 2050 |
wchar_t *TempW; |
| 2051 |
|
| 2052 |
/* version */ |
| 2053 |
ret = WritePrivateProfileString(Section, "Version", TT_VERSION_STR("."), FName); |
| 2054 |
if (ret == 0) { |
| 2055 |
// ini�t�@�C�����������������s�������A�G���[���b�Z�[�W���\�������B(2012.10.18 yutaka) |
| 2056 |
ret = GetLastError(); |
| 2057 |
get_lang_msg("MSG_INI_WRITE_ERROR", uimsg, sizeof(uimsg), "Cannot write ini file", ts->UILanguageFile); |
| 2058 |
_snprintf_s(msg, sizeof(msg), _TRUNCATE, "%s (%d)", uimsg, ret); |
| 2059 |
|
| 2060 |
get_lang_msg("MSG_INI_ERROR", uimsg2, sizeof(uimsg2), "Tera Term: Error", ts->UILanguageFile); |
| 2061 |
|
| 2062 |
MessageBox(NULL, msg, uimsg2, MB_ICONEXCLAMATION); |
| 2063 |
} |
| 2064 |
|
| 2065 |
/* Language */ |
| 2066 |
{ |
| 2067 |
const char *language_str = GetLanguageStr(ts->Language); |
| 2068 |
WritePrivateProfileString(Section, "Language", language_str, FName); |
| 2069 |
} |
| 2070 |
|
| 2071 |
/* Port type */ |
| 2072 |
WritePrivateProfileString(Section, "Port", (ts->PortType==IdSerial)?"serial":"tcpip", FName); |
| 2073 |
|
| 2074 |
/* Save win position */ |
| 2075 |
if (ts->SaveVTWinPos) { |
| 2076 |
/* VT win position */ |
| 2077 |
WriteInt2(Section, "VTPos", FName, ts->VTPos.x, ts->VTPos.y); |
| 2078 |
} |
| 2079 |
|
| 2080 |
/* VT terminal size */ |
| 2081 |
WriteInt2(Section, "TerminalSize", FName, |
| 2082 |
ts->TerminalWidth, ts->TerminalHeight); |
| 2083 |
|
| 2084 |
/* Terminal size = Window size */ |
| 2085 |
WriteOnOff(Section, "TermIsWin", FName, ts->TermIsWin); |
| 2086 |
|
| 2087 |
/* Auto window resize flag */ |
| 2088 |
WriteOnOff(Section, "AutoWinResize", FName, ts->AutoWinResize); |
| 2089 |
|
| 2090 |
/* CR Receive */ |
| 2091 |
if (ts->CRReceive == IdCRLF) { |
| 2092 |
strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE); |
| 2093 |
} |
| 2094 |
else if (ts->CRReceive == IdLF) { |
| 2095 |
strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE); |
| 2096 |
} |
| 2097 |
else if (ts->CRReceive == IdAUTO) { |
| 2098 |
strncpy_s(Temp, sizeof(Temp), "AUTO", _TRUNCATE); |
| 2099 |
} |
| 2100 |
else { |
| 2101 |
strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE); |
| 2102 |
} |
| 2103 |
WritePrivateProfileString(Section, "CRReceive", Temp, FName); |
| 2104 |
|
| 2105 |
/* CR Send */ |
| 2106 |
if (ts->CRSend == IdCRLF) { |
| 2107 |
strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE); |
| 2108 |
} |
| 2109 |
else if (ts->CRSend == IdLF) { |
| 2110 |
strncpy_s(Temp, sizeof(Temp), "LF", _TRUNCATE); |
| 2111 |
} |
| 2112 |
else { |
| 2113 |
strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE); |
| 2114 |
} |
| 2115 |
WritePrivateProfileString(Section, "CRSend", Temp, FName); |
| 2116 |
|
| 2117 |
/* Local echo */ |
| 2118 |
WriteOnOff(Section, "LocalEcho", FName, ts->LocalEcho); |
| 2119 |
|
| 2120 |
/* Answerback */ |
| 2121 |
if ((ts->FTFlag & FT_BPAUTO) == 0) { |
| 2122 |
Str2Hex(ts->Answerback, Temp, ts->AnswerbackLen, |
| 2123 |
sizeof(Temp) - 1, TRUE); |
| 2124 |
WritePrivateProfileString(Section, "Answerback", Temp, FName); |
| 2125 |
} |
| 2126 |
|
| 2127 |
/* Kanji Code (receive) */ |
| 2128 |
{ |
| 2129 |
const char *code_str = GetKanjiCodeStr(ts->Language, ts->KanjiCode); |
| 2130 |
WritePrivateProfileString(Section, "KanjiReceive", code_str, FName); |
| 2131 |
} |
| 2132 |
|
| 2133 |
/* Katakana (receive) */ |
| 2134 |
if (ts->JIS7Katakana == 1) |
| 2135 |
strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE); |
| 2136 |
else |
| 2137 |
strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE); |
| 2138 |
|
| 2139 |
WritePrivateProfileString(Section, "KatakanaReceive", Temp, FName); |
| 2140 |
|
| 2141 |
/* Kanji Code (transmit) */ |
| 2142 |
{ |
| 2143 |
const char *code_str = GetKanjiCodeStr(ts->Language, ts->KanjiCodeSend); |
| 2144 |
WritePrivateProfileString(Section, "KanjiSend", code_str, FName); |
| 2145 |
} |
| 2146 |
|
| 2147 |
/* Katakana (transmit) */ |
| 2148 |
if (ts->JIS7KatakanaSend == 1) |
| 2149 |
strncpy_s(Temp, sizeof(Temp), "7", _TRUNCATE); |
| 2150 |
else |
| 2151 |
strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE); |
| 2152 |
|
| 2153 |
WritePrivateProfileString(Section, "KatakanaSend", Temp, FName); |
| 2154 |
|
| 2155 |
/* KanjiIn */ |
| 2156 |
if (ts->KanjiIn == IdKanjiInA) |
| 2157 |
strncpy_s(Temp, sizeof(Temp), "@", _TRUNCATE); |
| 2158 |
else |
| 2159 |
strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE); |
| 2160 |
|
| 2161 |
WritePrivateProfileString(Section, "KanjiIn", Temp, FName); |
| 2162 |
|
| 2163 |
/* KanjiOut */ |
| 2164 |
switch (ts->KanjiOut) { |
| 2165 |
case IdKanjiOutB: |
| 2166 |
strncpy_s(Temp, sizeof(Temp), "B", _TRUNCATE); |
| 2167 |
break; |
| 2168 |
case IdKanjiOutH: |
| 2169 |
strncpy_s(Temp, sizeof(Temp), "H", _TRUNCATE); |
| 2170 |
break; |
| 2171 |
default: |
| 2172 |
strncpy_s(Temp, sizeof(Temp), "J", _TRUNCATE); |
| 2173 |
} |
| 2174 |
WritePrivateProfileString(Section, "KanjiOut", Temp, FName); |
| 2175 |
|
| 2176 |
// new configuration |
| 2177 |
WriteInt(Section, "ConnectingTimeout", FName, ts->ConnectingTimeout); |
| 2178 |
|
| 2179 |
WriteOnOff(Section, "DisablePasteMouseRButton", FName, |
| 2180 |
(WORD) (ts->PasteFlag & CPF_DISABLE_RBUTTON)); |
| 2181 |
|
| 2182 |
WriteOnOff(Section, "DisablePasteMouseMButton", FName, |
| 2183 |
(WORD) (ts->PasteFlag & CPF_DISABLE_MBUTTON)); |
| 2184 |
|
| 2185 |
WriteOnOff(Section, "ConfirmPasteMouseRButton", FName, |
| 2186 |
(WORD) (ts->PasteFlag & CPF_CONFIRM_RBUTTON)); |
| 2187 |
|
| 2188 |
// added ConfirmChangePaste |
| 2189 |
WriteOnOff(Section, "ConfirmChangePaste", FName, |
| 2190 |
(WORD) (ts->PasteFlag & CPF_CONFIRM_CHANGEPASTE)); |
| 2191 |
|
| 2192 |
WriteOnOff(Section, "ConfirmChangePasteCR", FName, |
| 2193 |
(WORD) (ts->PasteFlag & CPF_CONFIRM_CHANGEPASTE_CR)); |
| 2194 |
|
| 2195 |
WritePrivateProfileString(Section, "ConfirmChangePasteStringFile", |
| 2196 |
ts->ConfirmChangePasteStringFile, FName); |
| 2197 |
|
| 2198 |
// added ScrollWindowClearScreen |
| 2199 |
WriteOnOff(Section, "ScrollWindowClearScreen", FName, |
| 2200 |
ts->ScrollWindowClearScreen); |
| 2201 |
|
| 2202 |
// added SelectOnlyByLButton (2007.11.20 maya) |
| 2203 |
WriteOnOff(Section, "SelectOnlyByLButton", FName, |
| 2204 |
ts->SelectOnlyByLButton); |
| 2205 |
// added DisableAcceleratorSendBreak (2007.3.17 maya) |
| 2206 |
WriteOnOff(Section, "DisableAcceleratorSendBreak", FName, |
| 2207 |
ts->DisableAcceleratorSendBreak); |
| 2208 |
WriteOnOff(Section, "EnableContinuedLineCopy", FName, |
| 2209 |
ts->EnableContinuedLineCopy); |
| 2210 |
WritePrivateProfileString(Section, "MouseCursor", ts->MouseCursorName, |
| 2211 |
FName); |
| 2212 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlendInactive); |
| 2213 |
WritePrivateProfileString(Section, "AlphaBlend", Temp, FName); |
| 2214 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->AlphaBlendActive); |
| 2215 |
WritePrivateProfileString(Section, "AlphaBlendActive", Temp, FName); |
| 2216 |
WritePrivateProfileString(Section, "CygwinDirectory", |
| 2217 |
ts->CygwinDirectory, FName); |
| 2218 |
WritePrivateProfileString(Section, "ViewlogEditor", ts->ViewlogEditor, |
| 2219 |
FName); |
| 2220 |
|
| 2221 |
// ANSI color(2004.9.5 yutaka) |
| 2222 |
Temp[0] = '\0'; |
| 2223 |
for (i = 0; i < 15; i++) { |
| 2224 |
_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d, ", |
| 2225 |
i, |
| 2226 |
GetRValue(ts->ANSIColor[i]), |
| 2227 |
GetGValue(ts->ANSIColor[i]), |
| 2228 |
GetBValue(ts->ANSIColor[i]) |
| 2229 |
); |
| 2230 |
strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE); |
| 2231 |
} |
| 2232 |
i = 15; |
| 2233 |
_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d,%d,%d,%d", |
| 2234 |
i, |
| 2235 |
GetRValue(ts->ANSIColor[i]), |
| 2236 |
GetGValue(ts->ANSIColor[i]), |
| 2237 |
GetBValue(ts->ANSIColor[i]) |
| 2238 |
); |
| 2239 |
strncat_s(Temp, sizeof(Temp), buf, _TRUNCATE); |
| 2240 |
WritePrivateProfileString(Section, "ANSIColor", Temp, FName); |
| 2241 |
|
| 2242 |
/* AutoWinChange VT<->TEK */ |
| 2243 |
WriteOnOff(Section, "AutoWinSwitch", FName, ts->AutoWinSwitch); |
| 2244 |
|
| 2245 |
/* Terminal ID */ |
| 2246 |
id2str(TermList, ts->TerminalID, IdVT100, Temp, sizeof(Temp)); |
| 2247 |
WritePrivateProfileString(Section, "TerminalID", Temp, FName); |
| 2248 |
|
| 2249 |
/* Title text */ |
| 2250 |
WritePrivateProfileString(Section, "Title", ts->Title, FName); |
| 2251 |
|
| 2252 |
/* Cursor shape */ |
| 2253 |
switch (ts->CursorShape) { |
| 2254 |
case IdVCur: |
| 2255 |
strncpy_s(Temp, sizeof(Temp), "vertical", _TRUNCATE); |
| 2256 |
break; |
| 2257 |
case IdHCur: |
| 2258 |
strncpy_s(Temp, sizeof(Temp), "horizontal", _TRUNCATE); |
| 2259 |
break; |
| 2260 |
default: |
| 2261 |
strncpy_s(Temp, sizeof(Temp), "block", _TRUNCATE); |
| 2262 |
} |
| 2263 |
WritePrivateProfileString(Section, "CursorShape", Temp, FName); |
| 2264 |
|
| 2265 |
/* Hide title */ |
| 2266 |
WriteOnOff(Section, "HideTitle", FName, ts->HideTitle); |
| 2267 |
|
| 2268 |
/* Popup menu */ |
| 2269 |
WriteOnOff(Section, "PopupMenu", FName, ts->PopupMenu); |
| 2270 |
|
| 2271 |
/* PC-Style bold color mapping */ |
| 2272 |
WriteOnOff(Section, "PcBoldColor", FName, |
| 2273 |
(WORD) (ts->ColorFlag & CF_PCBOLD16)); |
| 2274 |
|
| 2275 |
/* aixterm 16 colors mode */ |
| 2276 |
WriteOnOff(Section, "Aixterm16Color", FName, |
| 2277 |
(WORD) (ts->ColorFlag & CF_AIXTERM16)); |
| 2278 |
|
| 2279 |
/* xterm 256 colors mode */ |
| 2280 |
WriteOnOff(Section, "Xterm256Color", FName, |
| 2281 |
(WORD) (ts->ColorFlag & CF_XTERM256)); |
| 2282 |
|
| 2283 |
/* Enable scroll buffer */ |
| 2284 |
WriteOnOff(Section, "EnableScrollBuff", FName, ts->EnableScrollBuff); |
| 2285 |
|
| 2286 |
/* Scroll buffer size */ |
| 2287 |
WriteInt(Section, "ScrollBuffSize", FName, ts->ScrollBuffSize); |
| 2288 |
|
| 2289 |
/* VT Color */ |
| 2290 |
for (i = 0; i <= 1; i++) { |
| 2291 |
TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]); |
| 2292 |
TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]); |
| 2293 |
TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]); |
| 2294 |
} |
| 2295 |
WriteInt6(Section, "VTColor", FName, |
| 2296 |
TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], |
| 2297 |
TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); |
| 2298 |
|
| 2299 |
/* VT Bold Color */ |
| 2300 |
for (i = 0; i <= 1; i++) { |
| 2301 |
TmpColor[0][i * 3] = GetRValue(ts->VTBoldColor[i]); |
| 2302 |
TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBoldColor[i]); |
| 2303 |
TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBoldColor[i]); |
| 2304 |
} |
| 2305 |
WriteInt6(Section, "VTBoldColor", FName, |
| 2306 |
TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], |
| 2307 |
TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); |
| 2308 |
|
| 2309 |
/* VT Blink Color */ |
| 2310 |
for (i = 0; i <= 1; i++) { |
| 2311 |
TmpColor[0][i * 3] = GetRValue(ts->VTBlinkColor[i]); |
| 2312 |
TmpColor[0][i * 3 + 1] = GetGValue(ts->VTBlinkColor[i]); |
| 2313 |
TmpColor[0][i * 3 + 2] = GetBValue(ts->VTBlinkColor[i]); |
| 2314 |
} |
| 2315 |
WriteInt6(Section, "VTBlinkColor", FName, |
| 2316 |
TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], |
| 2317 |
TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); |
| 2318 |
|
| 2319 |
/* VT Reverse Color */ |
| 2320 |
for (i = 0; i <= 1; i++) { |
| 2321 |
TmpColor[0][i * 3] = GetRValue(ts->VTColor[i]); |
| 2322 |
TmpColor[0][i * 3 + 1] = GetGValue(ts->VTColor[i]); |
| 2323 |
TmpColor[0][i * 3 + 2] = GetBValue(ts->VTColor[i]); |
| 2324 |
} |
| 2325 |
WriteInt6(Section, "VTReverseColor", FName, |
| 2326 |
TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], |
| 2327 |
TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); |
| 2328 |
|
| 2329 |
WriteOnOff(Section, "EnableClickableUrl", FName, |
| 2330 |
ts->EnableClickableUrl); |
| 2331 |
|
| 2332 |
/* URL color */ |
| 2333 |
for (i = 0; i <= 1; i++) { |
| 2334 |
TmpColor[0][i * 3] = GetRValue(ts->URLColor[i]); |
| 2335 |
TmpColor[0][i * 3 + 1] = GetGValue(ts->URLColor[i]); |
| 2336 |
TmpColor[0][i * 3 + 2] = GetBValue(ts->URLColor[i]); |
| 2337 |
} |
| 2338 |
WriteInt6(Section, "URLColor", FName, |
| 2339 |
TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], |
| 2340 |
TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); |
| 2341 |
|
| 2342 |
WriteOnOff(Section, "EnableBoldAttrColor", FName, |
| 2343 |
(WORD) (ts->ColorFlag & CF_BOLDCOLOR)); |
| 2344 |
|
| 2345 |
WriteOnOff(Section, "EnableBlinkAttrColor", FName, |
| 2346 |
(WORD) (ts->ColorFlag & CF_BLINKCOLOR)); |
| 2347 |
|
| 2348 |
WriteOnOff(Section, "EnableReverseAttrColor", FName, |
| 2349 |
(WORD) (ts->ColorFlag & CF_REVERSECOLOR)); |
| 2350 |
|
| 2351 |
WriteOnOff(Section, "EnableURLColor", FName, |
| 2352 |
(WORD) (ts->ColorFlag & CF_URLCOLOR)); |
| 2353 |
|
| 2354 |
WriteOnOff(Section, "URLUnderline", FName, |
| 2355 |
(WORD) (ts->FontFlag & FF_URLUNDERLINE)); |
| 2356 |
|
| 2357 |
WriteOnOff(Section, "EnableANSIColor", FName, |
| 2358 |
(WORD) (ts->ColorFlag & CF_ANSICOLOR)); |
| 2359 |
|
| 2360 |
/* TEK Color */ |
| 2361 |
for (i = 0; i <= 1; i++) { |
| 2362 |
TmpColor[0][i * 3] = GetRValue(ts->TEKColor[i]); |
| 2363 |
TmpColor[0][i * 3 + 1] = GetGValue(ts->TEKColor[i]); |
| 2364 |
TmpColor[0][i * 3 + 2] = GetBValue(ts->TEKColor[i]); |
| 2365 |
} |
| 2366 |
WriteInt6(Section, "TEKColor", FName, |
| 2367 |
TmpColor[0][0], TmpColor[0][1], TmpColor[0][2], |
| 2368 |
TmpColor[0][3], TmpColor[0][4], TmpColor[0][5]); |
| 2369 |
|
| 2370 |
/* TEK color emulation */ |
| 2371 |
WriteOnOff(Section, "TEKColorEmulation", FName, ts->TEKColorEmu); |
| 2372 |
|
| 2373 |
/* VT Font */ |
| 2374 |
WriteFont(Section, "VTFont", FName, |
| 2375 |
ts->VTFont, ts->VTFontSize.x, ts->VTFontSize.y, |
| 2376 |
ts->VTFontCharSet); |
| 2377 |
|
| 2378 |
/* Enable bold font flag */ |
| 2379 |
WriteOnOff(Section, "EnableBold", FName, |
| 2380 |
(WORD) (ts->FontFlag & FF_BOLD)); |
| 2381 |
|
| 2382 |
/* TEK Font */ |
| 2383 |
WriteFont(Section, "TEKFont", FName, |
| 2384 |
ts->TEKFont, ts->TEKFontSize.x, ts->TEKFontSize.y, |
| 2385 |
ts->TEKFontCharSet); |
| 2386 |
|
| 2387 |
/* BS key */ |
| 2388 |
if (ts->BSKey == IdDEL) |
| 2389 |
strncpy_s(Temp, sizeof(Temp), "DEL", _TRUNCATE); |
| 2390 |
else |
| 2391 |
strncpy_s(Temp, sizeof(Temp), "BS", _TRUNCATE); |
| 2392 |
WritePrivateProfileString(Section, "BSKey", Temp, FName); |
| 2393 |
|
| 2394 |
/* Delete key */ |
| 2395 |
WriteOnOff(Section, "DeleteKey", FName, ts->DelKey); |
| 2396 |
|
| 2397 |
/* Meta key */ |
| 2398 |
switch (ts->MetaKey) { |
| 2399 |
case 1: |
| 2400 |
strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE); |
| 2401 |
break; |
| 2402 |
case 2: |
| 2403 |
strncpy_s(Temp, sizeof(Temp), "left", _TRUNCATE); |
| 2404 |
break; |
| 2405 |
case 3: |
| 2406 |
strncpy_s(Temp, sizeof(Temp), "right", _TRUNCATE); |
| 2407 |
break; |
| 2408 |
default: |
| 2409 |
strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE); |
| 2410 |
} |
| 2411 |
WritePrivateProfileString(Section, "Metakey", Temp, FName); |
| 2412 |
|
| 2413 |
/* Application Keypad */ |
| 2414 |
WriteOnOff(Section, "DisableAppKeypad", FName, ts->DisableAppKeypad); |
| 2415 |
|
| 2416 |
/* Application Cursor */ |
| 2417 |
WriteOnOff(Section, "DisableAppCursor", FName, ts->DisableAppCursor); |
| 2418 |
|
| 2419 |
/* Russian keyboard type */ |
| 2420 |
id2str(RussList2, ts->RussKeyb, IdWindows, Temp, sizeof(Temp)); |
| 2421 |
WritePrivateProfileString(Section, "RussKeyb", Temp, FName); |
| 2422 |
|
| 2423 |
/* Serial port ID */ |
| 2424 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->ComPort); |
| 2425 |
WritePrivateProfileString(Section, "ComPort", Temp, FName); |
| 2426 |
|
| 2427 |
/* Baud rate */ |
| 2428 |
_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d", ts->Baud); |
| 2429 |
WritePrivateProfileString(Section, "BaudRate", Temp, FName); |
| 2430 |
|
| 2431 |
/* Parity */ |
| 2432 |
if (!SerialPortConfconvertId2Str(COM_PARITY, ts->Parity, Temp, sizeof(Temp))) { |
| 2433 |
strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE); |
| 2434 |
} |
| 2435 |
WritePrivateProfileString(Section, "Parity", Temp, FName); |
| 2436 |
|
| 2437 |
/* Data bit */ |
| 2438 |
if (!SerialPortConfconvertId2Str(COM_DATABIT, ts->DataBit, Temp, sizeof(Temp))) { |
| 2439 |
strncpy_s(Temp, sizeof(Temp), "8", _TRUNCATE); |
| 2440 |
} |
| 2441 |
WritePrivateProfileString(Section, "DataBit", Temp, FName); |
| 2442 |
|
| 2443 |
/* Stop bit */ |
| 2444 |
if (!SerialPortConfconvertId2Str(COM_STOPBIT, ts->StopBit, Temp, sizeof(Temp))) { |
| 2445 |
strncpy_s(Temp, sizeof(Temp), "1", _TRUNCATE); |
| 2446 |
} |
| 2447 |
WritePrivateProfileString(Section, "StopBit", Temp, FName); |
| 2448 |
|
| 2449 |
/* Flow control */ |
| 2450 |
if (!SerialPortConfconvertId2Str(COM_FLOWCTRL, ts->Flow, Temp, sizeof(Temp))) { |
| 2451 |
strncpy_s(Temp, sizeof(Temp), "none", _TRUNCATE); |
| 2452 |
} |
| 2453 |
WritePrivateProfileString(Section, "FlowCtrl", Temp, FName); |
| 2454 |
|
| 2455 |
/* Delay per character */ |
| 2456 |
WriteInt(Section, "DelayPerChar", FName, ts->DelayPerChar); |
| 2457 |
|
| 2458 |
/* Delay per line */ |
| 2459 |
WriteInt(Section, "DelayPerLine", FName, ts->DelayPerLine); |
| 2460 |
|
| 2461 |
/* Telnet flag */ |
| 2462 |
WriteOnOff(Section, "Telnet", FName, ts->Telnet); |
| 2463 |
|
| 2464 |
/* Telnet terminal type */ |
| 2465 |
WritePrivateProfileString(Section, "TermType", ts->TermType, FName); |
| 2466 |
|
| 2467 |
/* TCP port num for non-telnet */ |
| 2468 |
WriteUint(Section, "TCPPort", FName, ts->TCPPort); |
| 2469 |
|
| 2470 |
/* Auto close flag */ |
| 2471 |
WriteOnOff(Section, "AutoWinClose", FName, ts->AutoWinClose); |
| 2472 |
|
| 2473 |
/* History list */ |
| 2474 |
WriteOnOff(Section, "Historylist", FName, ts->HistoryList); |
| 2475 |
|
| 2476 |
/* File transfer binary flag */ |
| 2477 |
WriteOnOff(Section, "TransBin", FName, ts->TransBin); |
| 2478 |
|
| 2479 |
/* Log binary flag */ |
| 2480 |
WriteOnOff(Section, "LogBinary", FName, ts->LogBinary); |
| 2481 |
|
| 2482 |
/* Log append */ |
| 2483 |
WriteOnOff(Section, "LogAppend", FName, ts->Append); |
| 2484 |
|
| 2485 |
/* Log plain text flag */ |
| 2486 |
WriteOnOff(Section, "LogTypePlainText", FName, ts->LogTypePlainText); |
| 2487 |
|
| 2488 |
/* Log with timestamp (2006.7.23 maya) */ |
| 2489 |
WriteOnOff(Section, "LogTimestamp", FName, ts->LogTimestamp); |
| 2490 |
|
| 2491 |
/* Log without transfer dialog */ |
| 2492 |
WriteOnOff(Section, "LogHideDialog", FName, ts->LogHideDialog); |
| 2493 |
|
| 2494 |
WriteOnOff(Section, "LogIncludeScreenBuffer", FName, ts->LogAllBuffIncludedInFirst); |
| 2495 |
|
| 2496 |
/* Timestamp format of Log each line */ |
| 2497 |
WritePrivateProfileString(Section, "LogTimestampFormat", |
| 2498 |
ts->LogTimestampFormat, FName); |
| 2499 |
|
| 2500 |
/* Timestamp type */ |
| 2501 |
switch (ts->LogTimestampType) { |
| 2502 |
case TIMESTAMP_LOCAL: |
| 2503 |
WritePrivateProfileString(Section, "LogTimestampType", "Local", FName); |
| 2504 |
break; |
| 2505 |
case TIMESTAMP_UTC: |
| 2506 |
WritePrivateProfileString(Section, "LogTimestampType", "UTC", FName); |
| 2507 |
break; |
| 2508 |
case TIMESTAMP_ELAPSED_LOGSTART: |
| 2509 |
WritePrivateProfileString(Section, "LogTimestampType", "LoggingElapsed", FName); |
| 2510 |
break; |
| 2511 |
case TIMESTAMP_ELAPSED_CONNECTED: |
| 2512 |
WritePrivateProfileString(Section, "LogTimestampType", "ConnectionElapsed", FName); |
| 2513 |
break; |
| 2514 |
} |
| 2515 |
|
| 2516 |
/* Default Log file name (2006.8.28 maya) */ |
| 2517 |
WritePrivateProfileString(Section, "LogDefaultName", |
| 2518 |
ts->LogDefaultName, FName); |
| 2519 |
|
| 2520 |
/* Default Log file path */ |
| 2521 |
if (wcscmp(ts->LogDefaultPathW, ts->LogDirW) != 0) { |
| 2522 |
// �����������������A�t�H���_���w�������� |
| 2523 |
WritePrivateProfileStringW(SectionW, L"LogDefaultPath", |
| 2524 |
ts->LogDefaultPathW, FName); |
| 2525 |
} |
| 2526 |
|
| 2527 |
/* Auto start logging (2007.5.31 maya) */ |
| 2528 |
WriteOnOff(Section, "LogAutoStart", FName, ts->LogAutoStart); |
| 2529 |
|
| 2530 |
/* Log Rotate (2013.3.24 yutaka) */ |
| 2531 |
WriteInt(Section, "LogRotate", FName, ts->LogRotate); |
| 2532 |
WriteInt(Section, "LogRotateSize", FName, ts->LogRotateSize); |
| 2533 |
WriteInt(Section, "LogRotateSizeType", FName, ts->LogRotateSizeType); |
| 2534 |
WriteInt(Section, "LogRotateStep", FName, ts->LogRotateStep); |
| 2535 |
|
| 2536 |
/* Deferred Log Write Mode (2013.4.20 yutaka) */ |
| 2537 |
WriteOnOff(Section, "DeferredLogWriteMode", FName, ts->DeferredLogWriteMode); |
| 2538 |
|
| 2539 |
/* XMODEM option */ |
| 2540 |
switch (ts->XmodemOpt) { |
| 2541 |
case XoptCRC: |
| 2542 |
strncpy_s(Temp, sizeof(Temp), "crc", _TRUNCATE); |
| 2543 |
break; |
| 2544 |
case Xopt1kCRC: |
| 2545 |
strncpy_s(Temp, sizeof(Temp), "1k", _TRUNCATE); |
| 2546 |
break; |
| 2547 |
case Xopt1kCksum: |
| 2548 |
strncpy_s(Temp, sizeof(Temp), "1ksum", _TRUNCATE); |
| 2549 |
break; |
| 2550 |
default: |
| 2551 |
strncpy_s(Temp, sizeof(Temp), "checksum", _TRUNCATE); |
| 2552 |
} |
| 2553 |
WritePrivateProfileString(Section, "XmodemOpt", Temp, FName); |
| 2554 |
|
| 2555 |
/* XMODEM binary flag */ |
| 2556 |
WriteOnOff(Section, "XmodemBin", FName, ts->XmodemBin); |
| 2557 |
|
| 2558 |
/* XMODEM ���M�R�}���h (2007.12.21 yutaka) */ |
| 2559 |
WritePrivateProfileString(Section, "XmodemRcvCommand", |
| 2560 |
ts->XModemRcvCommand, FName); |
| 2561 |
|
| 2562 |
/* Default directory for file transfer */ |
| 2563 |
WritePrivateProfileStringW(SectionW, L"FileDir", ts->FileDirW, FName); |
| 2564 |
|
| 2565 |
/* filter on file send (2007.6.5 maya) */ |
| 2566 |
WritePrivateProfileString(Section, "FileSendFilter", |
| 2567 |
ts->FileSendFilter, FName); |
| 2568 |
|
| 2569 |
WritePrivateProfileString(Section, "ScpSendDir", ts->ScpSendDir, FName); |
| 2570 |
|
| 2571 |
/*------------------------------------------------------------------*/ |
| 2572 |
/* 8 bit control code flag -- special option */ |
| 2573 |
WriteOnOff(Section, "Accept8BitCtrl", FName, |
| 2574 |
(WORD) (ts->TermFlag & TF_ACCEPT8BITCTRL)); |
| 2575 |
|
| 2576 |
/* Wrong sequence flag -- special option */ |
| 2577 |
WriteOnOff(Section, "AllowWrongSequence", FName, |
| 2578 |
(WORD) (ts->TermFlag & TF_ALLOWWRONGSEQUENCE)); |
| 2579 |
|
| 2580 |
/* Detect disconnect/reconnect of serial port --- special option */ |
| 2581 |
WriteOnOff(Section, "AutoComPortReconnect", FName, ts->AutoComPortReconnect); |
| 2582 |
|
| 2583 |
/* Auto file renaming --- special option */ |
| 2584 |
WriteOnOff(Section, "AutoFileRename", FName, |
| 2585 |
(WORD) (ts->FTFlag & FT_RENAME)); |
| 2586 |
|
| 2587 |
/* Auto text copy --- special option */ |
| 2588 |
WriteOnOff(Section, "AutoTextCopy", FName, ts->AutoTextCopy); |
| 2589 |
|
| 2590 |
/* Back wrap -- special option */ |
| 2591 |
WriteOnOff(Section, "BackWrap", FName, |
| 2592 |
(WORD) (ts->TermFlag & TF_BACKWRAP)); |
| 2593 |
|
| 2594 |
/* Beep type -- special option */ |
| 2595 |
WriteOnOff(Section, "Beep", FName, ts->Beep); |
| 2596 |
switch (ts->Beep) { |
| 2597 |
case IdBeepOff: |
| 2598 |
WritePrivateProfileString(Section, "Beep", "off", FName); |
| 2599 |
break; |
| 2600 |
case IdBeepOn: |
| 2601 |
WritePrivateProfileString(Section, "Beep", "on", FName); |
| 2602 |
break; |
| 2603 |
case IdBeepVisual: |
| 2604 |
WritePrivateProfileString(Section, "Beep", "visual", FName); |
| 2605 |
break; |
| 2606 |
} |
| 2607 |
|
| 2608 |
/* Beep on connection & disconnection -- special option */ |
| 2609 |
WriteOnOff(Section, "BeepOnConnect", FName, |
| 2610 |
(WORD) (ts->PortFlag & PF_BEEPONCONNECT)); |
| 2611 |
|
| 2612 |
/* Auto B-Plus activation -- special option */ |
| 2613 |
WriteOnOff(Section, "BPAuto", FName, (WORD) (ts->FTFlag & FT_BPAUTO)); |
| 2614 |
|
| 2615 |
/* B-Plus ESCCTL flag -- special option */ |
| 2616 |
WriteOnOff(Section, "BPEscCtl", FName, |
| 2617 |
(WORD) (ts->FTFlag & FT_BPESCCTL)); |
| 2618 |
|
| 2619 |
/* B-Plus log -- special option */ |
| 2620 |
WriteOnOff(Section, "BPLog", FName, (WORD) (ts->LogFlag & LOG_BP)); |
| 2621 |
|
| 2622 |
/* Clear serial port buffer when port opening -- special option */ |
| 2623 |
WriteOnOff(Section, "ClearComBuffOnOpen", FName, ts->ClearComBuffOnOpen); |
| 2624 |
|
| 2625 |
/* When serial port is specified with with /C= option and the port does not exist, Tera Term will wait for port connection. */ |
| 2626 |
WriteOnOff(Section, "WaitCom", FName, ts->WaitCom); |
| 2627 |
|
| 2628 |
/* Confirm disconnection -- special option */ |
| 2629 |
WriteOnOff(Section, "ConfirmDisconnect", FName, |
| 2630 |
(WORD) (ts->PortFlag & PF_CONFIRMDISCONN)); |
| 2631 |
|
| 2632 |
/* Ctrl code in Kanji -- special option */ |
| 2633 |
WriteOnOff(Section, "CtrlInKanji", FName, |
| 2634 |
(WORD) (ts->TermFlag & TF_CTRLINKANJI)); |
| 2635 |
|
| 2636 |
/* Debug flag -- special option */ |
| 2637 |
WriteOnOff(Section, "Debug", FName, ts->Debug); |
| 2638 |
|
| 2639 |
/* Delimiter list -- special option */ |
| 2640 |
Str2Hex(ts->DelimList, Temp, strlen(ts->DelimList), |
| 2641 |
sizeof(Temp) - 1, TRUE); |
| 2642 |
WritePrivateProfileString(Section, "DelimList", Temp, FName); |
| 2643 |
|
| 2644 |
/* regard DBCS characters as delimiters -- special option */ |
| 2645 |
WriteOnOff(Section, "DelimDBCS", FName, ts->DelimDBCS); |
| 2646 |
|
| 2647 |
// Enable popup menu -- special option |
| 2648 |
if ((ts->MenuFlag & MF_NOPOPUP) == 0) |
| 2649 |
WriteOnOff(Section, "EnablePopupMenu", FName, 1); |
| 2650 |
else |
| 2651 |
WriteOnOff(Section, "EnablePopupMenu", FName, 0); |
| 2652 |
|
| 2653 |
// Enable "Show menu" -- special option |
| 2654 |
if ((ts->MenuFlag & MF_NOSHOWMENU) == 0) |
| 2655 |
WriteOnOff(Section, "EnableShowMenu", FName, 1); |
| 2656 |
else |
| 2657 |
WriteOnOff(Section, "EnableShowMenu", FName, 0); |
| 2658 |
|
| 2659 |
/* Enable the status line -- special option */ |
| 2660 |
WriteOnOff(Section, "EnableStatusLine", FName, |
| 2661 |
(WORD) (ts->TermFlag & TF_ENABLESLINE)); |
| 2662 |
|
| 2663 |
/* Enable multiple bytes send -- special option */ |
| 2664 |
WriteOnOff(Section, "FileSendHighSpeedMode", FName, ts->FileSendHighSpeedMode); |
| 2665 |
|
| 2666 |
/* IME Flag -- special option */ |
| 2667 |
WriteOnOff(Section, "IME", FName, ts->UseIME); |
| 2668 |
|
| 2669 |
/* IME-inline Flag -- special option */ |
| 2670 |
WriteOnOff(Section, "IMEInline", FName, ts->IMEInline); |
| 2671 |
|
| 2672 |
/* Kermit log -- special option */ |
| 2673 |
WriteOnOff(Section, "KmtLog", FName, (WORD) (ts->LogFlag & LOG_KMT)); |
| 2674 |
WriteOnOff(Section, "KmtLongPacket", FName, (WORD) (ts->KermitOpt & KmtOptLongPacket)); |
| 2675 |
WriteOnOff(Section, "KmtFileAttr", FName, (WORD) (ts->KermitOpt & KmtOptFileAttr)); |
| 2676 |
|
| 2677 |
// Enable language selection -- special option |
| 2678 |
if ((ts->MenuFlag & MF_NOLANGUAGE) == 0) |
| 2679 |
WriteOnOff(Section, "LanguageSelection", FName, 1); |
| 2680 |
else |
| 2681 |
WriteOnOff(Section, "LanguageSelection", FName, 0); |
| 2682 |
|
| 2683 |
/* Maximum scroll buffer size -- special option */ |
| 2684 |
WriteInt(Section, "MaxBuffSize", FName, ts->ScrollBuffMax); |
| 2685 |
|
| 2686 |
/* Max com port number -- special option */ |
| 2687 |
WriteInt(Section, "MaxComPort", FName, ts->MaxComPort); |
| 2688 |
|
| 2689 |
/* Non-blinking cursor -- special option */ |
| 2690 |
WriteOnOff(Section, "NonblinkingCursor", FName, ts->NonblinkingCursor); |
| 2691 |
|
| 2692 |
WriteOnOff(Section, "KillFocusCursor", FName, ts->KillFocusCursor); |
| 2693 |
|
| 2694 |
/* Delay for pass-thru printing activation */ |
| 2695 |
/* -- special option */ |
| 2696 |
WriteUint(Section, "PassThruDelay", FName, ts->PassThruDelay); |
| 2697 |
|
| 2698 |
/* Printer port for pass-thru printing */ |
| 2699 |
/* -- special option */ |
| 2700 |
WritePrivateProfileString(Section, "PassThruPort", ts->PrnDev, FName); |
| 2701 |
|
| 2702 |
/* �v�����^�p�����R�[�h�������t������ */ |
| 2703 |
WriteOnOff(Section, "PrinterCtrlSequence", FName, |
| 2704 |
ts->TermFlag & TF_PRINTERCTRL); |
| 2705 |
|
| 2706 |
/* Printer Font --- special option */ |
| 2707 |
WriteFont(Section, "PrnFont", FName, |
| 2708 |
ts->PrnFont, ts->PrnFontSize.x, ts->PrnFontSize.y, |
| 2709 |
ts->PrnFontCharSet); |
| 2710 |
|
| 2711 |
// Page margins (left, right, top, bottom) for printing |
| 2712 |
// -- special option |
| 2713 |
WriteInt4(Section, "PrnMargin", FName, |
| 2714 |
ts->PrnMargin[0], ts->PrnMargin[1], |
| 2715 |
ts->PrnMargin[2], ts->PrnMargin[3]); |
| 2716 |
|
| 2717 |
/* Disable (convert to NL) Form Feed when printing */ |
| 2718 |
/* --- special option */ |
| 2719 |
WriteOnOff(Section, "PrnConvFF", FName, ts->PrnConvFF); |
| 2720 |
|
| 2721 |
/* Quick-VAN log -- special option */ |
| 2722 |
WriteOnOff(Section, "QVLog", FName, (WORD) (ts->LogFlag & LOG_QV)); |
| 2723 |
|
| 2724 |
/* Quick-VAN window size -- special */ |
| 2725 |
WriteInt(Section, "QVWinSize", FName, ts->QVWinSize); |
| 2726 |
|
| 2727 |
/* Scroll threshold -- special option */ |
| 2728 |
WriteInt(Section, "ScrollThreshold", FName, ts->ScrollThreshold); |
| 2729 |
|
| 2730 |
WriteInt(Section, "MouseWheelScrollLine", FName, ts->MouseWheelScrollLine); |
| 2731 |
|
| 2732 |
// Select on activate -- special option |
| 2733 |
WriteOnOff(Section, "SelectOnActivate", FName, ts->SelOnActive); |
| 2734 |
|
| 2735 |
/* Send 8bit control sequence -- special option */ |
| 2736 |
WriteOnOff(Section, "Send8BitCtrl", FName, ts->Send8BitCtrl); |
| 2737 |
|
| 2738 |
/* SendBreak time (in msec) -- special option */ |
| 2739 |
WriteInt(Section, "SendBreakTime", FName, ts->SendBreakTime); |
| 2740 |
|
| 2741 |
/* Startup macro -- special option */ |
| 2742 |
WritePrivateProfileString(Section, "StartupMacro", ts->MacroFN, FName); |
| 2743 |
|
| 2744 |
/* TEK GIN Mouse keycode -- special option */ |
| 2745 |
WriteInt(Section, "TEKGINMouseCode", FName, ts->GINMouseCode); |
| 2746 |
|
| 2747 |
/* Telnet Auto Detect -- special option */ |
| 2748 |
WriteOnOff(Section, "TelAutoDetect", FName, ts->TelAutoDetect); |
| 2749 |
|
| 2750 |
/* Telnet binary flag -- special option */ |
| 2751 |
WriteOnOff(Section, "TelBin", FName, ts->TelBin); |
| 2752 |
|
| 2753 |
/* Telnet Echo flag -- special option */ |
| 2754 |
WriteOnOff(Section, "TelEcho", FName, ts->TelEcho); |
| 2755 |
|
| 2756 |
/* Telnet log -- special option */ |
| 2757 |
WriteOnOff(Section, "TelLog", FName, (WORD) (ts->LogFlag & LOG_TEL)); |
| 2758 |
|
| 2759 |
/* TCP port num for telnet -- special option */ |
| 2760 |
WriteUint(Section, "TelPort", FName, ts->TelPort); |
| 2761 |
|
| 2762 |
/* Telnet keep-alive packet(NOP command) interval -- special option */ |
| 2763 |
WriteUint(Section, "TelKeepAliveInterval", FName, |
| 2764 |
ts->TelKeepAliveInterval); |
| 2765 |
|
| 2766 |
/* Max number of broadcast commad history */ |
| 2767 |
WriteUint(Section, "MaxBroadcatHistory", FName, |
| 2768 |
ts->MaxBroadcatHistory); |
| 2769 |
|
| 2770 |
/* Local echo for non-telnet */ |
| 2771 |
WriteOnOff(Section, "TCPLocalEcho", FName, ts->TCPLocalEcho); |
| 2772 |
|
| 2773 |
/* "new-line (transmit)" option for non-telnet -- special option */ |
| 2774 |
if (ts->TCPCRSend == IdCRLF) |
| 2775 |
strncpy_s(Temp, sizeof(Temp), "CRLF", _TRUNCATE); |
| 2776 |
else if (ts->TCPCRSend == IdCR) |
| 2777 |
strncpy_s(Temp, sizeof(Temp), "CR", _TRUNCATE); |
| 2778 |
else |
| 2779 |
Temp[0] = 0; |
| 2780 |
WritePrivateProfileString(Section, "TCPCRSend", Temp, FName); |
| 2781 |
|
| 2782 |
/* Use text (background) color for "white (black)" |
| 2783 |
--- special option */ |
| 2784 |
WriteOnOff(Section, "UseTextColor", FName, |
| 2785 |
(WORD) (ts->ColorFlag & CF_USETEXTCOLOR)); |
| 2786 |
|
| 2787 |
/* Title format -- special option */ |
| 2788 |
WriteUint(Section, "TitleFormat", FName, ts->TitleFormat); |
| 2789 |
|
| 2790 |
/* VT Compatible Tab -- special option */ |
| 2791 |
WriteOnOff(Section, "VTCompatTab", FName, ts->VTCompatTab); |
| 2792 |
|
| 2793 |
/* VT Font space --- special option */ |
| 2794 |
WriteInt4(Section, "VTFontSpace", FName, |
| 2795 |
ts->FontDX, ts->FontDW - ts->FontDX, |
| 2796 |
ts->FontDY, ts->FontDH - ts->FontDY); |
| 2797 |
|
| 2798 |
// VT-print scaling factors (pixels per inch) --- special option |
| 2799 |
WriteInt2(Section, "VTPPI", FName, ts->VTPPI.x, ts->VTPPI.y); |
| 2800 |
|
| 2801 |
// TEK-print scaling factors (pixels per inch) --- special option |
| 2802 |
WriteInt2(Section, "TEKPPI", FName, ts->TEKPPI.x, ts->TEKPPI.y); |
| 2803 |
|
| 2804 |
// Show "Window" menu -- special option |
| 2805 |
WriteOnOff(Section, "WindowMenu", FName, |
| 2806 |
(WORD) (ts->MenuFlag & MF_SHOWWINMENU)); |
| 2807 |
|
| 2808 |
/* XMODEM log -- special option */ |
| 2809 |
WriteOnOff(Section, "XmodemLog", FName, (WORD) (ts->LogFlag & LOG_X)); |
| 2810 |
|
| 2811 |
/* YMODEM log -- special option */ |
| 2812 |
WriteOnOff(Section, "YmodemLog", FName, (WORD) (ts->LogFlag & LOG_Y)); |
| 2813 |
|
| 2814 |
/* YMODEM ���M�R�}���h (2010.3.23 yutaka) */ |
| 2815 |
WritePrivateProfileString(Section, "YmodemRcvCommand", ts->YModemRcvCommand, FName); |
| 2816 |
|
| 2817 |
/* Auto ZMODEM activation -- special option */ |
| 2818 |
WriteOnOff(Section, "ZmodemAuto", FName, |
| 2819 |
(WORD) (ts->FTFlag & FT_ZAUTO)); |
| 2820 |
|
| 2821 |
/* ZMODEM data subpacket length for sending -- special */ |
| 2822 |
WriteInt(Section, "ZmodemDataLen", FName, ts->ZmodemDataLen); |
| 2823 |
/* ZMODEM window size for sending -- special */ |
| 2824 |
WriteInt(Section, "ZmodemWinSize", FName, ts->ZmodemWinSize); |
| 2825 |
|
| 2826 |
/* ZMODEM ESCCTL flag -- special option */ |
| 2827 |
WriteOnOff(Section, "ZmodemEscCtl", FName, |
| 2828 |
(WORD) (ts->FTFlag & FT_ZESCCTL)); |
| 2829 |
|
| 2830 |
/* ZMODEM log -- special option */ |
| 2831 |
WriteOnOff(Section, "ZmodemLog", FName, (WORD) (ts->LogFlag & LOG_Z)); |
| 2832 |
|
| 2833 |
/* ZMODEM ���M�R�}���h (2007.12.21 yutaka) */ |
| 2834 |
WritePrivateProfileString(Section, "ZmodemRcvCommand", ts->ZModemRcvCommand, FName); |
| 2835 |
|
| 2836 |
/* update file */ |
| 2837 |
WritePrivateProfileString(NULL, NULL, NULL, FName); |
| 2838 |
|
| 2839 |
DispWriteIni(FName, ts); |
| 2840 |
|
| 2841 |
// theme�t�H���_������ |
| 2842 |
{ |
| 2843 |
wchar_t *theme_folder = NULL; |
| 2844 |
awcscats(&theme_folder, ts->HomeDirW, L"\\", BG_THEME_DIR, NULL); |
| 2845 |
CreateDirectoryW(theme_folder, NULL); |
| 2846 |
free(theme_folder); |
| 2847 |
} |
| 2848 |
|
| 2849 |
| |