Changeset 170 for trunk/settings.cpp
- Timestamp:
- Sep 22, 2025, 10:04:44 PM (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/settings.cpp
r151 r170 279 279 280 280 // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-) 281 HWND g_hwndSettingsDialog = NULL;282 HWND g_hwndPage0 = NULL;281 //HWND g_hwndSettingsDialog = NULL; 282 //HWND g_hwndPage0 = NULL; 283 283 284 284 BOOL SETTINGS :: Dialog (BOOL fOnlyLanguage) … … 292 292 hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndFrame, PFNWP (DialogProcedure), 293 293 GETMODULE, ID_DLG_SETTINGS, this); 294 // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)295 g_hwndSettingsDialog = hwndDlg;296 294 #ifdef _DOLOGDEBUG_ 297 295 LogDebug( "Dialog: checkpoint 2" ); 298 296 #endif 299 300 // disable th istwo buttons if only language select297 #if 1 298 // disable these two buttons if only language select 301 299 if (fAutoLanguage) 302 300 { … … 309 307 LogDebug( "Dialog: checkpoint 3" ); 310 308 #endif 311 309 312 310 // set notebook background color 313 311 WinSendMsg (hwndNB, BKM_SETNOTEBOOKCOLORS, … … 349 347 MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE, 350 348 BKA_LAST)); 351 //if (pset->GetLangID() == CZ || pset->GetLangID() == RU || pset->GetLangID() == PL) { 352 UniChar target[300]; 353 CHAR ucLangStr[300]; 354 UconvObject uconv_object866 = NULL; 355 UconvObject uconv_object852 = NULL; 356 UconvObject uconv_object1207 = NULL; 357 UconvObject uconv_object850 = NULL; 358 HAB hab; 359 CHAR ucFont[FACESIZE]; 360 361 UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852); 362 UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850); 363 UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866); 364 UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207); 349 #ifndef _QUIET_ // Take this out and the unicode stuff in the DialogProcedure 350 UniChar target[300]; 351 CHAR ucLangStr[300]; 352 UconvObject uconv_object866 = NULL; 353 UconvObject uconv_object852 = NULL; 354 UconvObject uconv_object1207 = NULL; 355 UconvObject uconv_object850 = NULL; 356 //HAB hab; 357 CHAR ucFont[FACESIZE]; 358 359 UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852); 360 UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850); 361 UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866); 362 UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207); 363 364 strcpy(ucLangStr, pszPageTab[i]); 365 if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 365 366 366 strcpy(ucLangStr, pszPageTab[i]); 367 if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 368 369 UniStrToUcs( uconv_object852, target, ucLangStr, 299); 370 } 371 else if (pset->GetLangID() == RU) 372 UniStrToUcs( uconv_object866, target, ucLangStr, 299); 373 else { 374 UniStrToUcs( uconv_object850, target, ucLangStr, 299); 375 } 376 UniStrFromUcs( uconv_object1207, ucLangStr, target, 300); 377 WinSendMsg (hwndNB, BKM_SETTABTEXT, 378 MPFROMLONG (idPage[i]), MPFROMP (ucLangStr)); 379 if (uconv_object866) 380 UniFreeUconvObject(uconv_object866); 381 if (uconv_object852) 382 UniFreeUconvObject(uconv_object852); 383 if (uconv_object850) 384 UniFreeUconvObject(uconv_object850); 385 if (uconv_object1207) 386 UniFreeUconvObject(uconv_object1207); 387 //} 388 else 389 WinSendMsg (hwndNB, BKM_SETTABTEXT, 390 MPFROMLONG (idPage[i]), MPFROMP (pszPageTab[i])); 391 } 367 UniStrToUcs( uconv_object852, target, ucLangStr, 299); 368 } 369 else if (pset->GetLangID() == RU) 370 UniStrToUcs( uconv_object866, target, ucLangStr, 299); 371 else { 372 UniStrToUcs( uconv_object850, target, ucLangStr, 299); 373 } 374 UniStrFromUcs( uconv_object1207, ucLangStr, target, 300); 375 WinSendMsg (hwndNB, BKM_SETTABTEXT, 376 MPFROMLONG (idPage[i]), MPFROMP (ucLangStr)); 377 if (uconv_object866) 378 UniFreeUconvObject(uconv_object866); 379 if (uconv_object852) 380 UniFreeUconvObject(uconv_object852); 381 if (uconv_object850) 382 UniFreeUconvObject(uconv_object850); 383 if (uconv_object1207) 384 UniFreeUconvObject(uconv_object1207); 385 } 386 #else 387 CHAR ucLangStr[300]; 388 389 strcpy(ucLangStr, pszPageTab[i]); 390 WinSendMsg (hwndNB, BKM_SETTABTEXT, 391 MPFROMLONG (idPage[i]), MPFROMP (ucLangStr)); 392 } 393 #endif 392 394 #ifndef _QUIET_ 393 395 // open and assign dialogs to pages … … 409 411 hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure, 410 412 GETMODULE, ID_DLG_SETTINGSPAGE4, this); 411 g_hwndPage0 = hwndPage[0];413 //g_hwndPage0 = hwndPage[0]; 412 414 413 415 #endif … … 427 429 LogDebug( "Dialog: checkpoint 6" ); 428 430 #endif 429 WinSendDlgItemMsg ( g_hwndPage0, WID_RB_FILE, BM_CLICK,431 WinSendDlgItemMsg (GethwndPage0(), WID_RB_FILE, BM_CLICK, 430 432 MPFROMSHORT (TRUE), 0); 431 433 #ifdef _QUIET_ … … 434 436 } 435 437 #endif 436 WinSetActiveWindow( HWND_DESKTOP, hwndDlg ); 438 SWP swp; 439 //WinQueryWindowPos(hwndDlg, &swp); 440 //WinSetWindowPos(hwndNB, 0, 0, 0, swp.cx - 30, swp.cy - 90, SWP_SIZE); 441 //WinInvalidateRect(hwndNB, NULL, TRUE); 437 442 #ifdef _DOLOGDEBUG_ 438 443 LogDebug( "Dialog: checkpoint 7" ); … … 454 459 hwndPage[i] = NULL; 455 460 456 hwndDlg = NULLHANDLE;461 //hwndDlg = NULLHANDLE; 457 462 #ifdef _DOLOGDEBUG_ 458 463 LogDebug( "Dialog: checkpoint 9" ); 464 #endif 459 465 #endif 460 466 return TRUE; … … 483 489 LogDebug( "DialogProcedure: end WM_INITDLG" ); 484 490 #endif 491 #ifdef _QUIET_ 492 HMQ hmq = WinQueryWindowULong( hwnd, QWL_HMQ); 493 if (pset->GetLangID() == RU) { 494 WinSetCp(hmq, 866); 495 } 496 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 497 WinSetCp(hmq, 852); 498 } 499 else { 500 WinSetCp(hmq, 850); 501 } 502 503 #else 485 504 CHAR ucFont[FACESIZE]; 486 505 … … 548 567 HMQ hmq = WinQueryWindowULong( hwnd, QWL_HMQ); 549 568 WinSetCp(hmq, 1207); 550 if (pset->GetLangID() == CZ || pset->GetLangID() == RU || pset->GetLangID() == PL) { 551 strcpy(ucFont, "9.Times New Roman MT 30"); 569 570 int x; 571 ULONG ulSize; 572 573 PrfQueryProfileString(HINI_USERPROFILE, (PSZ) "PM_SystemFonts", (PSZ) "WindowText", 574 (PSZ) "9.WarpSans", &ucFont, FACESIZE); 575 x = atol(ucFont); 576 if (PrfQueryProfileSize(HINI_USERPROFILE, (PSZ) "PM_Fonts", (PSZ) "WPSU.TTF", &ulSize)) { 577 if (x < 10) 578 strcpy(ucFont, "9.Workplace Sans"); 579 if (x == 10) 580 strcpy(ucFont, "10.Workplace Sans"); 581 if (x == 11) 582 strcpy(ucFont, "11.Workplace Sans"); 583 if (x > 11) 584 strcpy(ucFont, "12.Workplace Sans"); 552 585 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont); 553 586 } 554 //} 555 else if (g_installer) { 556 strcpy(ucFont, "9.WarpSans"); 587 else { 588 if (x > 11) 589 strcpy(ucFont, "12.Times New Roman MT 30"); 590 else 591 strcpy(ucFont, "10.Times New Roman MT 30"); 557 592 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont); 558 593 } 594 #endif 559 595 return MRESULT (FALSE); 560 596 } … … 746 782 } 747 783 } 748 HMQ hmq; 749 BOOL bUniCodeFont = FALSE; 750 CHAR ucFont[FACESIZE]; 751 784 HMQ hmq = WinQueryWindowULong( hwnd, QWL_HMQ); 752 785 if (pset->GetLangID() == RU) { 753 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);754 786 WinSetCp(hmq, 866); 755 bUniCodeFont = TRUE;756 787 } 757 788 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 758 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);759 789 WinSetCp(hmq, 852); 760 bUniCodeFont = TRUE;761 790 } 762 791 else { 763 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);764 792 WinSetCp(hmq, 850); 765 793 } 766 767 if (bUniCodeFont) {768 strcpy(ucFont, "9.Times New Roman MT 30");769 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);770 }771 else if (g_installer) {772 strcpy(ucFont, "9.WarpSans");773 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);774 }775 776 794 #ifdef _DOLOGDEBUG_ 777 795 LogDebug( "Page1Procedure: end WM_INITDLG" ); … … 782 800 case WM_COMMAND: 783 801 if( SHORT1FROMMP( mp1 ) == DID_CANCEL ) 784 WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );802 WinPostMsg( pset->GethwndSettingsDialog(), msg, mp1, mp2 ); 785 803 return MRESULT( FALSE ); 786 804 … … 952 970 #endif 953 971 HMQ hmq; 954 BOOL bUniCodeFont = FALSE;955 972 CHAR ucFont[FACESIZE]; 956 973 974 hmq = WinQueryWindowULong( hwnd, QWL_HMQ); 957 975 if (pset->GetLangID() == RU) { 958 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);959 976 WinSetCp(hmq, 866); 960 bUniCodeFont = TRUE;961 977 } 962 978 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 963 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);964 979 WinSetCp(hmq, 852); 965 bUniCodeFont = TRUE;966 980 } 967 981 else { 968 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);969 982 WinSetCp(hmq, 850); 970 }971 972 if (bUniCodeFont) {973 strcpy(ucFont, "9.Times New Roman MT 30");974 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);975 }976 else if (g_installer) {977 strcpy(ucFont, "9.WarpSans");978 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);979 983 } 980 984 return MRESULT (FALSE); … … 984 988 if( SHORT1FROMMP( mp1 ) == WID_PB_OK) { 985 989 saveum = TRUE; 986 WinSendMsg ( g_hwndSettingsDialog, WM_CLOSE, 0,0);990 WinSendMsg ( pset->GethwndSettingsDialog(), WM_CLOSE, 0,0); 987 991 } 988 992 if( SHORT1FROMMP( mp1 ) == DID_CANCEL ) 989 WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );993 WinPostMsg( pset->GethwndSettingsDialog(), msg, mp1, mp2 ); 990 994 return MRESULT( FALSE ); 991 995 … … 1137 1141 case WID_CB_DELAYEDCAPTURE: 1138 1142 1139 WinSendDlgItemMsg ( g_hwndPage0, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,1143 WinSendDlgItemMsg (pset->GethwndPage0(), WID_CB_DELAYEDCAPTURE, BM_SETCHECK, 1140 1144 MPFROMLONG (WinQueryButtonCheckstate 1141 1145 (hwnd,WID_CB_DELAYEDCAPTURE)), … … 1171 1175 #endif 1172 1176 HMQ hmq; 1173 BOOL bUniCodeFont = FALSE;1174 1177 CHAR ucFont[FACESIZE]; 1175 1178 1179 hmq = WinQueryWindowULong( hwnd, QWL_HMQ); 1176 1180 if (pset->GetLangID() == RU) { 1177 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);1178 1181 WinSetCp(hmq, 866); 1179 bUniCodeFont = TRUE;1180 1182 } 1181 1183 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 1182 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);1183 1184 WinSetCp(hmq, 852); 1184 bUniCodeFont = TRUE;1185 1185 } 1186 1186 else { 1187 hmq = WinQueryWindowULong( hwnd, QWL_HMQ);1188 1187 WinSetCp(hmq, 850); 1189 }1190 1191 if (bUniCodeFont) {1192 strcpy(ucFont, "9.Times New Roman MT 30");1193 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);1194 1188 } 1195 1189 return MRESULT (FALSE); … … 1198 1192 case WM_COMMAND: 1199 1193 if( SHORT1FROMMP( mp1 ) == DID_CANCEL ) 1200 WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );1194 WinPostMsg( pset->GethwndSettingsDialog(), msg, mp1, mp2 ); 1201 1195 return MRESULT( FALSE ); 1202 1196 … … 1318 1312 #endif 1319 1313 pset = PSETTINGS (mp2); 1320 1321 HMQ hmq = WinQueryWindowULong(hwnd /*WinWindowFromID(hwnd, ID_DLG_SETTINGSPAGE4)*/, QWL_HMQ); 1314 #ifdef _QUIET_ 1315 HMQ hmq; 1316 CHAR ucFont[FACESIZE]; 1317 1318 hmq = WinQueryWindowULong( hwnd, QWL_HMQ); 1319 if (pset->GetLangID() == RU) { 1320 WinSetCp(hmq, 866); 1321 } 1322 else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) { 1323 WinSetCp(hmq, 852); 1324 } 1325 else { 1326 WinSetCp(hmq, 850); 1327 } 1328 #else 1329 HMQ hmq = WinQueryWindowULong(hwnd /*WinWindowFromID(hwnd, WID_LB_LANGUAGES)*/, QWL_HMQ); 1322 1330 WinSetCp(hmq, 1207); // UPF-8 Unicode 1323 1331 WinRemovePresParam(hwnd, PP_FONTNAMESIZE); 1332 #endif 1324 1333 #ifndef _QUIET_ //?? 1325 1334 pset->GetLanguages(WinWindowFromID (hwnd, WID_LB_LANGUAGES)); … … 1338 1347 LogDebug( "Page4Procedure: end WM_INITDLG" ); 1339 1348 #endif 1340 1349 #ifdef _QUIET_ 1350 CHAR ucLangStr[300]; 1351 int i; 1352 1353 for (i = 0; i < WID_ST_END - 400; i++) { 1354 WinLoadString(hab, g_hmod, LANG_COPYRIGHT + i, sizeof(ucLangStr), ucLangStr); 1355 WinSetDlgItemText(hwnd, WID_ST_COPYRIGHT + i, ucLangStr); 1356 } 1357 #else 1341 1358 UniChar target[300]; 1342 1359 CHAR ucLangStr[300]; … … 1349 1366 int i; 1350 1367 HAB hab; 1351 CHAR ucFont[FACESIZE]; 1368 CHAR ucFont[FACESIZE] = {0}; 1369 int rc; 1352 1370 1353 1371 UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852); 1354 UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);1372 rc = UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850); 1355 1373 UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866); 1356 1374 1357 UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);1375 rc = UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207); 1358 1376 for (i = 0; i < WID_ST_END - 400; i++) { 1359 WinLoadString(hab, g_hmod, LANG_COPYRIGHT + i, sizeof(ucLangStr), ucLangStr);1377 rc = WinLoadString(hab, g_hmod, LANG_COPYRIGHT + i, sizeof(ucLangStr), ucLangStr); 1360 1378 if (pset->GetLangID() == 420 || 1361 1379 pset->GetLangID() == PL) { … … 1366 1384 UniStrToUcs( uconv_object866, target, ucLangStr, 299); 1367 1385 else { 1368 UniStrToUcs( uconv_object850, target, ucLangStr, 299);1386 rc = UniStrToUcs( uconv_object850, target, ucLangStr, 299); 1369 1387 } 1370 UniStrFromUcs( uconv_object1207, ucLangStr, target, 300); 1371 WinSetDlgItemText(hwnd, WID_ST_COPYRIGHT + i, ucLangStr); 1372 } 1373 1388 rc = UniStrFromUcs( uconv_object1207, ucLangStr, target, 300); 1389 rc = WinSetDlgItemText(hwnd, WID_ST_COPYRIGHT + i, ucLangStr); 1390 } 1374 1391 if (uconv_object866) 1375 1392 UniFreeUconvObject(uconv_object866); … … 1380 1397 if (uconv_object1207) 1381 1398 UniFreeUconvObject(uconv_object1207); 1382 CHAR *env, *p; 1383 env = getenv("OSDIR"); 1384 p = env; 1385 p++; 1386 if (!stricmp(p, ":\\sys") || !stricmp(p, ":\\ecs")) { 1387 strcpy(ucFont, "9.Workplace Sans"); 1399 1400 int x; 1401 ULONG ulSize; 1402 1403 PrfQueryProfileString(HINI_USERPROFILE, (PSZ) "PM_SystemFonts", (PSZ) "WindowText", 1404 (PSZ) "9.WarpSans", &ucFont, FACESIZE); 1405 x = atol(ucFont); 1406 if (PrfQueryProfileSize(HINI_USERPROFILE, (PSZ) "PM_Fonts", (PSZ) "WPSUB.TTF", &ulSize)) { 1407 if (x < 10) 1408 strcpy(ucFont, "9.Workplace Sans Bold"); 1409 if (x == 10) 1410 strcpy(ucFont, "10.Workplace Sans Bold"); 1411 if (x == 11) 1412 strcpy(ucFont, "11.Workplace Sans Bold"); 1413 if (x > 10) 1414 strcpy(ucFont, "12.Workplace Sans Bold"); 1415 rc = WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont); 1416 } 1417 else { 1418 if (x > 11) 1419 strcpy(ucFont, "12.Times New Roman MT 30"); 1420 else 1421 strcpy(ucFont, "10.Times New Roman MT 30"); 1388 1422 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont); 1389 1423 } 1390 else { 1391 strcpy(ucFont, "9.Times New Roman MT 30"); 1392 WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont); 1393 } 1394 return MRESULT (FALSE); 1424 #endif 1425 return MRESULT (FALSE); 1395 1426 } 1396 1427 1397 1428 case WM_COMMAND: 1398 1429 if( SHORT1FROMMP( mp1 ) == DID_CANCEL ) 1399 WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );1430 WinPostMsg( pset->GethwndSettingsDialog(), msg, mp1, mp2 ); 1400 1431 return MRESULT( FALSE ); 1401 1432 #ifndef _QUIET_ … … 1563 1594 pszPageTab[0] = RSTR (IDS_PAGESAVE); 1564 1595 pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT); 1565 pszPageTab[2] = RSTR (IDS_CAPTURE 1596 pszPageTab[2] = RSTR (IDS_CAPTURE); 1566 1597 pszPageTab[3] = RSTR (IDS_PAGELANGUAGE); 1567 1598 #endif
Note:
See TracChangeset
for help on using the changeset viewer.