X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d21f1d8f155ad46e93e0bd3d8a5b2528b8c43330..3a39df31ff47004a46cfb06f3fb2d3e317f96d2b:/utils/configtool/src/utils.cpp diff --git a/utils/configtool/src/utils.cpp b/utils/configtool/src/utils.cpp index 8c0237f458..e7a1d56125 100644 --- a/utils/configtool/src/utils.cpp +++ b/utils/configtool/src/utils.cpp @@ -35,6 +35,7 @@ #include "wx/log.h" #include "wx/sizer.h" #include "wx/icon.h" +#include "wx/intl.h" #endif @@ -120,7 +121,7 @@ wxFont apStringToFont(const wxString& str) int style = wxNORMAL; int weight = wxNORMAL; int underlined = 0; - wxString facename(wxT("")); + wxString facename; wxStringTokenizer tkz(str, wxT(",")); int i = 0; @@ -171,56 +172,6 @@ int apFindNotebookPage(wxNotebook* notebook, const wxString& name) return -1; } -/* - * View an HTML file - */ - -void apViewHTMLFile(const wxString& url) -{ -#ifdef __WXMSW__ - HKEY hKey; - TCHAR szCmdName[1024]; - DWORD dwType, dw = sizeof(szCmdName); - LONG lRes; - lRes = RegOpenKey(HKEY_CLASSES_ROOT, _T("htmlfile\\shell\\open\\command"), &hKey); - if(lRes == ERROR_SUCCESS && RegQueryValueEx(hKey,(LPTSTR)NULL, NULL, - &dwType, (LPBYTE)szCmdName, &dw) == ERROR_SUCCESS) - { - wxStrcat(szCmdName, (const wxChar*) url); - PROCESS_INFORMATION piProcInfo; - STARTUPINFO siStartInfo; - memset(&siStartInfo, 0, sizeof(STARTUPINFO)); - siStartInfo.cb = sizeof(STARTUPINFO); - CreateProcess(NULL, szCmdName, NULL, NULL, false, 0, NULL, - NULL, &siStartInfo, &piProcInfo ); - } - if(lRes == ERROR_SUCCESS) - RegCloseKey(hKey); -#else - wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT("html")); - if ( !ft ) - { - wxLogError(_T("Impossible to determine the file type for extension html. Please edit your MIME types.")); - return ; - } - - wxString cmd; - bool ok = ft->GetOpenCommand(&cmd, - wxFileType::MessageParameters(url, _T(""))); - delete ft; - - if (!ok) - { - // TODO: some kind of configuration dialog here. - wxMessageBox(_("Could not determine the command for running the browser."), - wxT("Browsing problem"), wxOK|wxICON_EXCLAMATION); - return ; - } - - ok = (wxExecute(cmd, false) != 0); -#endif -} - wxString wxGetTempDir() { wxString dir; @@ -266,7 +217,7 @@ bool apInvokeAppForFile(const wxString& filename) } wxString cmd; - ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(filename, _T(""))); + ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(filename, wxEmptyString)); delete ft; return (wxExecute(cmd, false) != 0); @@ -281,10 +232,10 @@ bool apInvokeAppForFile(const wxString& filename) wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName) { // Try appVariableName - if (!appVariableName.IsEmpty()) + if (!appVariableName.empty()) { wxString strVar(wxGetenv(appVariableName.c_str())); - if (!strVar.IsEmpty()) + if (!strVar.empty()) return strVar; } @@ -308,7 +259,7 @@ wxString apFindAppPath(const wxString& argv0, const wxString& cwd, const wxStrin wxPathList pathList; pathList.AddEnvList(wxT("PATH")); wxString strPath = pathList.FindAbsoluteValidPath(argv0); - if (!strPath.IsEmpty()) + if (!strPath.empty()) return wxPathOnly(strPath); // Failed @@ -525,7 +476,7 @@ bool ctMatchString(const wxString& matchAgainst, const wxString& matchText, bool wxString left(matchAgainst); bool success = false; int matchTextLen = (int) matchText.Length(); - while (!success && !matchAgainst.IsEmpty()) + while (!success && !matchAgainst.empty()) { int pos = left.Find(matchText); if (pos == wxNOT_FOUND)