void CFeedbackReplaceDlg::RefreshFilesInfo() { BOOST_ASSERT(m_pfiSrcFile && m_pfiDstFile); if(!m_pfiSrcFile || !m_pfiDstFile) return; // load template ictranslate::CResourceManager& rManager = GetResManager(); CString strTemplate; strTemplate += rManager.LoadString(IDS_INFO_FILE_STRING); strTemplate += _T("\r\n"); strTemplate += rManager.LoadString(IDS_INFO_SIZE_STRING); strTemplate += _T("\r\n"); strTemplate += rManager.LoadString(IDS_INFO_MODIFIED_STRING); ictranslate::CFormat fmt(strTemplate); fmt.SetParam(_T("%filename"), m_pfiSrcFile->GetFullFilePath()); fmt.SetParam(_T("%size"), m_pfiSrcFile->GetLength64()); fmt.SetParam(_T("%datemod"), m_pfiSrcFile->GetLastWriteTime().Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT)); m_ctlSrcInfo.SetWindowText(fmt); fmt.SetFormat(strTemplate); fmt.SetParam(_T("%filename"), m_pfiDstFile->GetFullFilePath()); fmt.SetParam(_T("%size"), m_pfiDstFile->GetLength64()); fmt.SetParam(_T("%datemod"), m_pfiDstFile->GetLastWriteTime().Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT)); m_ctlDstInfo.SetWindowText(fmt); }
void CReplacePathsDlg::OnBrowseButton() { CString strPath; if (BrowseForFolder(GetResManager().LoadString(IDS_BROWSE_STRING), &strPath)) { UpdateData(TRUE); m_strDest=strPath; UpdateData(FALSE); } }
BOOL duStyleGroup::OnCreate(TiXmlElement *pElement) { if (!duResBase::OnCreate(pElement)) return FALSE; TiXmlElement *pChildElement = pElement->FirstChildElement(); for (; pChildElement; pChildElement = pChildElement->NextSiblingElement()) { LPCTSTR lpszType = pChildElement->Value(); duStyleBase *pNewStyle = CreateChildStyle(lpszType); if (pNewStyle) { pNewStyle->SetResManager(GetResManager()); duWindowManager *pWinManager = GetResManager()->GetWindowManager(); AddStyle(pNewStyle); pNewStyle->OnCreate(pChildElement); } } return TRUE; }
bool CCopyHandlerApp::UpdateHelpPaths() { bool bChanged=false; // flag that'll be returned - if the paths has changed // generate the current filename - uses language from config TCHAR szBuffer[_MAX_PATH]; _tcscpy(szBuffer, _T("<PROGRAM>\\Help\\")); ExpandPath(szBuffer); _tcscat(szBuffer, GetResManager().m_ld.GetHelpName()); if(_tcscmp(szBuffer, m_pszHelpFilePath) != 0) { free((void*)m_pszHelpFilePath); m_pszHelpFilePath = _tcsdup(szBuffer); bChanged=true; } return bChanged; }
///////////////////////////////////////////////////////////////////////////// // CFeedbackNotEnoughSpaceDlg message handlers void CFeedbackNotEnoughSpaceDlg::UpdateDialog() { // format needed text ictranslate::CFormat fmt(GetResManager().LoadString(IDS_NERPATH_STRING)); fmt.SetParam(_t("%path"), m_strDisk); CWnd* pWnd=GetDlgItem(IDC_HEADER_STATIC); if (pWnd) pWnd->SetWindowText(fmt); // now the sizes TCHAR szData[128]; pWnd=GetDlgItem(IDC_REQUIRED_STATIC); if (pWnd) pWnd->SetWindowText(GetSizeString(m_ullRequired, szData, 128)); ull_t ullFree; pWnd=GetDlgItem(IDC_AVAILABLE_STATIC); if (pWnd && GetDynamicFreeSpace(m_strDisk, &ullFree, NULL)) pWnd->SetWindowText(GetSizeString(ullFree, szData, 128)); }
void CCopyHandlerApp::OnConfigNotify(uint_t uiPropID) { // is this language switch(uiPropID) { case PP_PLANGUAGE: { // update language in resource manager TCHAR szPath[_MAX_PATH]; GetConfig().get_string(PP_PLANGUAGE, szPath, _MAX_PATH); GetResManager().SetLanguage(ExpandPath(szPath)); break; } case PP_LOGENABLELOGGING: { chcore::TLogger& rLogger = chcore::TLogger::Acquire(); rLogger.Enable(GetConfig().get_bool(PP_LOGENABLELOGGING)); break; } case PP_LOGLEVEL: { chcore::TLogger& rLogger = chcore::TLogger::Acquire(); rLogger.set_log_level((int_t)GetConfig().get_unsigned_num(PP_LOGLEVEL)); break; } case PP_LOGMAXSIZE: { chcore::TLogger& rLogger = chcore::TLogger::Acquire(); rLogger.set_max_size((int_t)GetConfig().get_signed_num(PP_LOGMAXSIZE)); break; } } }
int MsgBox(UINT uiID, UINT nType, UINT nIDHelp) { return AfxMessageBox(GetResManager().LoadString(uiID), nType, nIDHelp); }
void duStyleGroup::GrayDrawByStyle(HDC hDC, LPRECT lpDstRect, UINT uState, LPCTSTR lpszText, int nAlpha) { BYTE r,g,b,gray; int styleCount = GetStyleCount(); UINT nStyleType = 0; COLORREF orgColor, grayColor; int i = 0; for (i = 0;i < styleCount; i++) { duStyleBase *pStyle = m_vtStylelist[i]; if ( (pStyle == NULL) || (!(pStyle->GetState() & uState)) ) continue; nStyleType = pStyle->GetType(); if (nStyleType == STYLE_TEXT) { duTextStyle *pTextStyle = (duTextStyle *)pStyle; orgColor = pTextStyle->GetTextColor(); r = GetRValue(orgColor); g = GetGValue(orgColor); b = GetBValue(orgColor); gray = RGB2GRAY(r,g,b); grayColor = RGB(gray, gray, gray); pTextStyle->SetTextColor(grayColor); pTextStyle->Draw(hDC, lpDstRect, lpszText, nAlpha); pTextStyle->SetTextColor(orgColor); } else if (nStyleType == STYLE_RECT) { duRectStyle *pRectStyle = (duRectStyle *)pStyle; COLORREF fillColor, fillGrayColor, borderColor, borderGrayColor; if ( pRectStyle->IsFillRect() ) { fillColor = pRectStyle->GetFillColor(); r = GetRValue(fillColor); g = GetGValue(fillColor); b = GetBValue(fillColor); gray = RGB2GRAY(r, g, b); fillGrayColor = RGB(gray, gray, gray); pRectStyle->SetFillColor(fillGrayColor); if ( pRectStyle->IsDrawBorder() ) { borderColor = pRectStyle->GetBorderColor(); r = GetRValue(borderColor); g = GetGValue(borderColor); b = GetBValue(borderColor); gray = RGB2GRAY(r, g, b); borderGrayColor = RGB(gray, gray, gray); pRectStyle->SetBorderColor(borderGrayColor); } pRectStyle->Draw(hDC, lpDstRect, lpszText, nAlpha); pRectStyle->SetFillColor(fillColor); if ( pRectStyle->IsDrawBorder() ) { pRectStyle->SetBorderColor(borderColor); } } else { if ( pRectStyle->IsDrawBorder() ) { borderColor = pRectStyle->GetBorderColor(); r = GetRValue(borderColor); g = GetGValue(borderColor); b = GetBValue(borderColor); gray = RGB2GRAY(r, g, b); borderGrayColor = RGB(gray, gray, gray); pRectStyle->SetBorderColor(borderGrayColor); pRectStyle->Draw(hDC, lpDstRect, lpszText, nAlpha); pRectStyle->SetBorderColor(borderColor); } } } else if (nStyleType == STYLE_IMAGE) { duImageStyle *pImageStyle = (duImageStyle *)pStyle; duResManager *pResManager = GetResManager(); if (pResManager) { dustring picfile = pImageStyle->GetPicFile(); duImage *pImage = (duImage *)pResManager->GetResObj(picfile.c_str(), DU_RES_IMAGE); if (pImage) { duImage *pGrayImage = pImage->CreateGrayImage(); if (pGrayImage) { pResManager->AddResObj(pGrayImage); LPCTSTR pNewPicFile = pGrayImage->GetName(); pImageStyle->SetPicFile(pNewPicFile); pImageStyle->Draw(hDC, lpDstRect, lpszText, nAlpha); pImageStyle->SetPicFile(picfile.c_str()); pResManager->DeleteResObj(pNewPicFile, DU_RES_IMAGE); } } } } else if (nStyleType == STYLE_LINE) { duLineStyle *pLineStyle = (duLineStyle *)pStyle; COLORREF clrLineColor, clrGrayColor; clrLineColor = pLineStyle->GetLineColor(); BYTE r, g, b, gray; r = GetRValue(clrLineColor); g = GetGValue(clrLineColor); b = GetBValue(clrLineColor); gray = RGB2GRAY(r, g, b); clrGrayColor = RGB(gray, gray, gray); pLineStyle->SetLineColor(clrGrayColor); pLineStyle->Draw(hDC, lpDstRect, lpszText, nAlpha); pLineStyle->SetLineColor(clrLineColor); } } }