예제 #1
0
void C_DictionaryClient::LanguageChange()
{
    C_STLException::install();

    try {

        if (m_dic) {

            IFontDisp *fontdisp = NULL;

            m_dic->get_TranslationFont(&fontdisp);

            if (fontdisp) {

                IFont *font = NULL;
                fontdisp->QueryInterface(IID_IFont, reinterpret_cast<void**>(&font));

                if (font) {

                    BSTR bs = NULL;
                    CY cy;
                    BOOL bold = FALSE;
                    BOOL italic = FALSE;
                    short weight = FW_NORMAL;

                    font->get_Name(&bs);
                    font->get_Size(&cy);
                    font->get_Bold(&bold);
                    font->get_Italic(&italic);
                    font->get_Weight(&weight);

                    String name(bs);
                    String::FreeBSTR(&bs);

                    font->Release();

                    static C_NullDC null;
                    static int ppi = GetDeviceCaps(null.GetHandle(), LOGPIXELSY);

                    LOGFONT lf = {
                        cy.Lo * ppi / 560000,
                        0,
                        0,
                        0,
                        weight,
                        italic,
                        FALSE,
                        FALSE,
                        ANSI_CHARSET,
                        OUT_DEFAULT_PRECIS,
                        CLIP_DEFAULT_PRECIS,
                        DEFAULT_QUALITY | ANTIALIASED_QUALITY,
                        DEFAULT_PITCH | FF_DECORATIVE,
                        _T("Arial")
                    };

                    _stprintf(lf.lfFaceName, name.toLPCTSTR());

                    m_lFont = lf;
                }

                fontdisp->Release();
            }
        }
    }
    catch (C_STLNonStackException const &exception) {
        exception.Log(_T("Exception in C_DictionaryClient::LanguageChange"));
    }
}
예제 #2
0
BOOL DispReel::LoadToken(int id, BiffReader *pbr)
{
   if (id == FID(PIID))
   {
      pbr->GetInt((int *)pbr->m_pdata);
   }
   else if (id == FID(VER1))
   {
      pbr->GetStruct(&m_d.m_v1, sizeof(Vertex2D));
   }
   else if (id == FID(VER2))
   {
      pbr->GetStruct(&m_d.m_v2, sizeof(Vertex2D));
   }
   else if (id == FID(WDTH))
   {
      pbr->GetFloat(&m_d.m_width);
   }
   else if (id == FID(HIGH))
   {
      pbr->GetFloat(&m_d.m_height);
   }
   else if (id == FID(CLRB))
   {
      pbr->GetInt(&m_d.m_backcolor);
   }
   else if (id == FID(TMON))
   {
      pbr->GetBool(&m_d.m_tdr.m_fTimerEnabled);
   }
   else if (id == FID(TMIN))
   {
      pbr->GetInt(&m_d.m_tdr.m_TimerInterval);
   }
   else if (id == FID(NAME))
   {
      pbr->GetWideString((WCHAR *)m_wzName);
   }
   else if (id == FID(TRNS))
   {
      pbr->GetBool(&m_d.m_fTransparent);
   }
   else if (id == FID(IMAG))
   {
      pbr->GetString(m_d.m_szImage);
   }
   else if (id == FID(RCNT))
   {
      float reel;
      pbr->GetFloat(&reel);
      m_d.m_reelcount = (int)reel;
   }
   else if (id == FID(RSPC))
   {
      pbr->GetFloat(&m_d.m_reelspacing);
   }
   else if (id == FID(MSTP))
   {
      pbr->GetFloat(&m_d.m_motorsteps);
   }
   else if (id == FID(SOUN))
   {
      pbr->GetString(m_d.m_szSound);
   }
   else if (id == FID(UGRD))
   {
      pbr->GetBool(&m_d.m_fUseImageGrid);
   }
   else if (id == FID(VISI))
   {
      pbr->GetBool(&m_d.m_fVisible);
   }
   else if (id == FID(GIPR))
   {
      pbr->GetInt(&m_d.m_imagesPerGridRow);
   }
   else if (id == FID(RANG))
   {
      float dig;
      pbr->GetFloat(&dig);
      m_d.m_digitrange = (int)dig;
   }
   else if (id == FID(UPTM))
   {
      pbr->GetInt(&m_d.m_updateinterval);
   }
   else if (id == FID(FONT)) //!! deprecated, only here to support loading of old tables
   {
      IFont *pIFont;
      FONTDESC fd;
      fd.cbSizeofstruct = sizeof(FONTDESC);
      fd.lpstrName = L"Times New Roman";
      fd.cySize.int64 = 260000;
      //fd.cySize.Lo = 0;
      fd.sWeight = FW_BOLD;
      fd.sCharset = 0;
      fd.fItalic = 0;
      fd.fUnderline = 0;
      fd.fStrikethrough = 0;
      OleCreateFontIndirect(&fd, IID_IFont, (void **)&pIFont);

      IPersistStream * ips;
      pIFont->QueryInterface(IID_IPersistStream, (void **)&ips);

      ips->Load(pbr->m_pistream);

      pIFont->Release();
   }
   else
   {
      ISelect::LoadToken(id, pbr);
   }
   return fTrue;
}