This commit is contained in:
YuSanka 2019-01-10 11:10:01 +01:00
commit 107152b25e
30 changed files with 327 additions and 68 deletions

View file

@ -67,7 +67,7 @@ wxString file_wildcards(FileType file_type, const std::string &custom_extension)
out += std::string(";*") + custom_extension;
}
}
return wxString::FromUTF8(out.c_str());
return from_u8(out);
}
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
@ -464,7 +464,7 @@ bool GUI_App::select_language( wxArrayString & names,
{
m_wxLocale = new wxLocale;
m_wxLocale->Init(identifiers[index]);
m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir()));
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
wxSetlocale(LC_NUMERIC, "C");
@ -492,7 +492,7 @@ bool GUI_App::load_language()
{
m_wxLocale = new wxLocale;
m_wxLocale->Init(identifiers[i]);
m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir()));
m_wxLocale->AddCatalogLookupPathPrefix(from_u8(localization_dir()));
m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE");
//FIXME This is a temporary workaround, the correct solution is to switch to "C" locale during file import / export only.
wxSetlocale(LC_NUMERIC, "C");
@ -520,7 +520,7 @@ void GUI_App::get_installed_languages(wxArrayString & names, wxArrayLong & ident
names.Clear();
identifiers.Clear();
wxDir dir(wxString::FromUTF8(localization_dir()));
wxDir dir(from_u8(localization_dir()));
wxString filename;
const wxLanguageInfo * langinfo;
wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT);
@ -742,6 +742,17 @@ void GUI_App::load_current_presets()
}
}
#ifdef __APPLE__
// wxWidgets override to get an event on open files.
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
{
std::vector<std::string> files;
for (size_t i = 0; i < fileNames.GetCount(); ++ i)
files.emplace_back(fileNames[i].ToUTF8().data());
this->plater()->load_files(files, true, true);
}
#endif /* __APPLE */
Sidebar& GUI_App::sidebar()
{
return plater_->sidebar();