void CMainFrame::OnHelpClientTools() { boost::filesystem::path folder; GetProgramFolder(folder); boost::filesystem::path file = folder / boost::filesystem::path("ClientTools.pdf", boost::filesystem::native); ::ShellExecute(m_hWnd, _T("open"), pathToWString(file).c_str(), 0, pathToWString(folder).c_str(), SW_MAXIMIZE); }
void ImportLanguageReference() { m_lang.clear(); boost::filesystem::path binFolder; GetProgramFolder(binFolder); boost::filesystem::path path = binFolder / stringToPath(LANGREFFILE_CSV); boost::filesystem::path xml_path = binFolder / stringToPath(ReferenceFileName().GetString()); CUnicodeFile file; if (file.Open(pathToString(path).c_str())) { std::_tstring data; file.Read(data); typedef std::vector<std::_tstring> split_vector_type; split_vector_type SplitVec; boost::algorithm::split(SplitVec, data, boost::algorithm::is_any_of("\r\n"), boost::algorithm::token_compress_on); for (split_vector_type::const_iterator itr = SplitVec.begin(); itr != SplitVec.end(); ++itr) { std::_tstring line = *itr; if (line.length()) { std::vector<std::_tstring> fields; DecodeCSV(line, fields); m_lang.push_back(fields); } } } save(m_lang, xml_path.string().c_str()); }
void ZFileExtDlg::SaveExtEnv() { std::vector < ExtSetting >::iterator it, endit = ExtInfoManager::GetInstance().m_extConnect.end(); tstring strProgramFolder(GetProgramFolder()); tstring strIconDll = strProgramFolder; strIconDll += TEXT("ZViewerIcons.dll"); for ( it = ExtInfoManager::GetInstance().m_extConnect.begin(); it != endit; ++it) { const ExtSetting & extset = *it; if ( false == SetExtWithProgram(TEXT("ZViewer"), extset.m_strExt, TEXT(""), /// 프로그램 Full Path. 비워두면 현재 프로그램이다. strIconDll.c_str(), /// 아이콘 프로그램 extset.m_numIconIndex /// 아이콘 index ) ) { assert(false); } } /// explorer 의 아이콘을 update 시킨다. SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); }
void loadReference() { m_lang.clear(); CString fileName = ReferenceFileName(); // Check if this user has customized the colors boost::filesystem::path binFolder; GetProgramFolder(binFolder); boost::filesystem::path file = binFolder / stringToPath(fileName.GetString()); if (!clib::filesystem::exists(file)) { ATLASSERT(!(_T("Unable to locate ") + fileName)); } restore(m_lang, file.string().c_str()); std::sort(m_lang.begin(), m_lang.end()); int row = 0; for(CLanguageReferenceVector::iterator itr = m_lang.begin(); itr != m_lang.end(); ++itr) { std::_tstring name = itr->GetName(); std::transform(name.begin(), name.end(), name.begin(), ::tolower); m_langNameIndex[name].m_cat = itr->GetCategoryID(); m_langNameIndex[name].m_row = row; m_langCatNameIndex[itr->GetCategoryID()][name].m_cat = itr->GetCategoryID(); m_langCatNameIndex[itr->GetCategoryID()][name].m_row = row; ++row; } }
void ExportLanguageReference() { boost::filesystem::path binFolder; GetProgramFolder(binFolder); boost::filesystem::path path = binFolder / stringToPath(LANGREFFILE_CSV); std::ofstream ofs(path.string()); assert(ofs.good()); for(CLanguageReferenceVector::iterator itr = m_lang.begin(); itr != m_lang.end(); ++itr) { std::_tstring line; ofs << CT2A(itr->ToCSV(line)) << std::endl; } }
bool loadDefaultColor(CategoryLanguageColorMap & t) { t.clear(); // Check if this user has customized the colors boost::filesystem::path binFolder; GetProgramFolder(binFolder); boost::filesystem::path file = binFolder / stringToPath(ColorFileName().GetString()); if (!clib::filesystem::exists(file)) { return false; } restore(t, file.string().c_str()); return true; }
bool loadSamples() { if (m_sample.size() != 0) return true; m_sample.clear(); boost::filesystem::path binFolder; GetProgramFolder(binFolder); boost::filesystem::path file = binFolder / stringToPath(LANGSYNTAXSAMPLES); if (!clib::filesystem::exists(file)) { ATLASSERT(!(_T("Unable to locate language syntax sample file"))); } restore(m_sample, file.string().c_str()); return true; }
LRESULT CALLBACK AboutWndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam) { switch(iMessage) { case WM_CREATE: { int y = 20; TCHAR szTemp[MAX_PATH]; SPrintf(szTemp, MAX_PATH, TEXT("ZViewer Version : %s"), g_strVersion.c_str()); CreateLabel(hWnd, szTemp, y); y += 20; SPrintf(szTemp, MAX_PATH, TEXT("CacheHitRate : %d%%"), CacheManager::GetInstance().GetCacheHitRate()); CreateLabel(hWnd, szTemp, y); NUMBERFMT nFmt = { 0, 0, 3, TEXT("."), TEXT(","), 1 }; TCHAR szOUT[20]; SPrintf(szTemp, MAX_PATH, TEXT("%d"), CacheManager::GetInstance().GetCachedKByte()); ::GetNumberFormat((LCID)NULL, (DWORD)NULL, szTemp, &nFmt, szOUT, 20); SPrintf(szTemp, MAX_PATH, TEXT("CachedMemory : %sKB, Num of Cached Image : %u"), szOUT, static_cast<unsigned int>(CacheManager::GetInstance().GetNumOfCacheImage())); CreateLabel(hWnd, szTemp, y); SPrintf(szTemp, MAX_PATH, TEXT("ProgramPath : %s"), GetProgramFolder().c_str()); CreateLabel(hWnd, szTemp, y); SPrintf(szTemp, MAX_PATH, TEXT("Library Version : %s"), ZImage::GetLibraryVersion().c_str()); CreateLabel(hWnd, szTemp, y); y += 20; SPrintf(szTemp, MAX_PATH, TEXT("Homepage : http://zviewer.wimy.com/")); CreateLabel(hWnd, szTemp, y); } return TRUE; case WM_DESTROY: { EnableWindow( ZMain::GetInstance().GetHWND(), TRUE ); break; } } return (DefWindowProc(hWnd, iMessage, wParam, lParam)); }