Clone
ixen <ixen@copyhandler.com>
committed
on 22 Mar 08
Removed unneeded attributes from language files.
LoggerImprovements + 5 more
src/libictranslate/LanguageDialog.cpp (+5 -5)
413 413 {
414 414         if (m_pFont)
415 415         {
416 416                 pRect->left=MulDiv(pRect->left, m_iBaseX, 4);
417 417                 pRect->right=MulDiv(pRect->right, m_iBaseX, 4);
418 418                 pRect->top=MulDiv(pRect->top, m_iBaseY, 8);
419 419                 pRect->bottom=MulDiv(pRect->bottom, m_iBaseY, 8);
420 420         }
421 421         else
422 422                 MapDialogRect(pRect);
423 423 }
424 424
425 425 ///////////////////////////////////////////////////////////////
426 426 // Helper function - called when this dialog receives message
427 427 // WM_RMNOTIFY (with WPARAM == RMNT_LANGCHANGE). Updates the
428 428 // dialog with data from a new template. Passes params to
429 429 // virtual function OnLanguageChanged.
430 430 // wOldLang [in] - specifies the old language code
431 431 // wNewLang [in] - specifies the new language code.
432 432 ///////////////////////////////////////////////////////////////
433   void CLanguageDialog::UpdateLanguage(WORD /*wOldLang*/, WORD /*wNewLang*/)
  433 void CLanguageDialog::UpdateLanguage()
434 434 {
435 435         // cannot update for string based template
436 436         if (m_uiResID == 0)
437 437                 return;
438 438
439 439         // set the title
440 440         SetWindowText(m_prm->LoadString((WORD)m_uiResID, 0));
441 441
442 442         // load the dialog template
443 443         CDlgTemplate dt;
444 444         if (!dt.Open(m_prm->LoadDialog(MAKEINTRESOURCE(m_uiResID))))
445 445         {
446 446                 TRACE("Cannot open dialog template in UpdateLanguage\n");
447 447                 return;
448 448         }
449 449
450 450         // update the menu
451 451         if (GetMenu())
452 452                 m_prm->UpdateMenu(GetMenu()->m_hMenu, dt.m_wMenu);
453 453
454 454         // font
455 455         if (!(GetLanguageUpdateOptions() & LDF_NODIALOGFONT))
456 456         {
457 457                 // dialog font
458 458                 LOGFONT lf;
459 459                 memset(&lf, 0, sizeof(LOGFONT));
460 460                 HDC hdc=::GetDC(NULL);
461 461                 lf.lfHeight = -MulDiv(m_prm->m_ld.GetPointSize(), GetDeviceCaps(hdc, LOGPIXELSY), 72);
462 462                 ::ReleaseDC(NULL, hdc);
463 463                 lf.lfWeight = FW_NORMAL;
464                   lf.lfCharSet = m_prm->m_ld.GetCharset();
  464                 lf.lfCharSet = DEFAULT_CHARSET;
465 465                 _tcscpy(lf.lfFaceName, m_prm->m_ld.GetFontFace());
466 466                 
467 467                 delete m_pFont;
468 468                 m_pFont=new CFont();
469 469                 m_pFont->CreateFontIndirect(&lf);
470 470
471 471                 // change base dlg units
472 472                 CalcBaseUnits(dt.m_pszFace, dt.m_wFontSize);
473 473         }
474 474         
475 475         if (!(GetLanguageUpdateOptions() & LDF_NODIALOGSIZE))
476 476         {
477 477                 // dialog size
478 478                 CRect rcWin;
479 479                 GetWindowRect(&rcWin);
480 480                 
481 481                 CRect rcDialog(0, 0, dt.m_dlgTemplate.cx, dt.m_dlgTemplate.cy);
482 482                 MapRect(&rcDialog);
483 483                 rcDialog.bottom+=2*GetSystemMetrics(SM_CYDLGFRAME)+GetSystemMetrics(SM_CYCAPTION);
484 484
 
542 542 void CLanguageDialog::Cleanup()
543 543 {
544 544         TRACE("CLanguageDialog::Cleanup()\n");
545 545
546 546         if (m_bLockChanged && m_pbLock)
547 547                 *m_pbLock=false;
548 548
549 549         delete m_pFont;
550 550
551 551         if (m_bAutoDelete)
552 552                 delete this;
553 553 }
554 554
555 555 ///////////////////////////////////////////////////////////////
556 556 // Standard msg - initializes tool tip handling
557 557 ///////////////////////////////////////////////////////////////
558 558 BOOL CLanguageDialog::OnInitDialog()
559 559 {
560 560         CDialog::OnInitDialog();
561 561
562           UpdateLanguage(0,0);            // because initially all the texts are empty
  562         UpdateLanguage();               // because initially all the texts are empty
563 563
564 564         EnableToolTips(TRUE);
565 565
566 566         return TRUE// return TRUE unless you set the focus to a control
567 567         // EXCEPTION: OCX Property Pages should return FALSE
568 568 }
569 569
570 570 ///////////////////////////////////////////////////////////////
571 571 // Standard handler for pressing cancel button in a dialog.
572 572 // For modeless dialog causes dialog to be destroyed.
573 573 ///////////////////////////////////////////////////////////////
574 574 void CLanguageDialog::OnCancel()
575 575 {
576 576         switch (m_cType)
577 577         {
578 578         case 0:
579 579                 CDialog::OnCancel();
580 580                 break;
581 581         case 1:
582 582                 DestroyWindow();
 
603 603
604 604 ///////////////////////////////////////////////////////////////
605 605 // Standard override - calls cleanup.
606 606 ///////////////////////////////////////////////////////////////
607 607 void CLanguageDialog::PostNcDestroy()
608 608 {
609 609         CDialog::PostNcDestroy();
610 610         Cleanup();
611 611 }
612 612
613 613 ///////////////////////////////////////////////////////////////
614 614 // This dialog's window procedure handler - look at ms docs.
615 615 ///////////////////////////////////////////////////////////////
616 616 LRESULT CLanguageDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
617 617 {
618 618         switch(message)
619 619         {
620 620         case WM_RMNOTIFY:
621 621                 if ((UINT)wParam == RMNT_LANGCHANGE)
622 622                 {
623                           UpdateLanguage(HIWORD(lParam), LOWORD(lParam));
  623                         UpdateLanguage();
624 624
625 625                         // now update user controls (everybody has to do it him(her)self)
626                           OnLanguageChanged(HIWORD(lParam), LOWORD(lParam));
  626                         OnLanguageChanged();
627 627                         break;
628 628                 }
629 629         case WM_NOTIFY:
630 630                 {
631 631                         NMHDR* pnmh=(NMHDR*)lParam;
632 632                         if (pnmh->code == TTN_NEEDTEXT)
633 633                         {
634 634                                 // establish the ID of a control
635 635                                 TOOLTIPTEXT *ppt=(TOOLTIPTEXT*)pnmh;
636 636                                 UINT nID;
637 637                                 if (ppt->uFlags & TTF_IDISHWND)
638 638                                         nID=(UINT)::GetDlgCtrlID((HWND)pnmh->idFrom);
639 639                                 else
640 640                                         nID=(UINT)pnmh->idFrom;
641 641
642 642                                 return OnTooltipText(nID, ppt);
643 643                         }
644 644                         break;
645 645                 }
646 646         }