mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-15 18:58:00 -06:00
parent
5aec48418a
commit
cde0aa4443
9 changed files with 40 additions and 15 deletions
|
@ -59,7 +59,19 @@ if (SLIC3R_GUI)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if (SLIC3R_WX_STABLE)
|
||||
find_package(wxWidgets 3.0 REQUIRED COMPONENTS base core adv html gl)
|
||||
else ()
|
||||
find_package(wxWidgets 3.1 QUIET COMPONENTS base core adv html gl)
|
||||
if (NOT wxWidgets_FOUND)
|
||||
message(FATAL_ERROR "\nCould not find wxWidgets 3.1.\nHint: On Linux you can set -DSLIC3R_WX_STABLE=1 to use wxWidgets 3.0")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
find_package(wxWidgets 3.1 REQUIRED COMPONENTS base core adv html gl)
|
||||
endif ()
|
||||
|
||||
include(${wxWidgets_USE_FILE})
|
||||
endif()
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ bool GLTexture::load_from_file(const std::string& filename, bool generate_mipmap
|
|||
|
||||
// Load a PNG with an alpha channel.
|
||||
wxImage image;
|
||||
if (!image.LoadFile(wxString::FromUTF8(filename), wxBITMAP_TYPE_PNG))
|
||||
if (!image.LoadFile(wxString::FromUTF8(filename.c_str()), wxBITMAP_TYPE_PNG))
|
||||
{
|
||||
reset();
|
||||
return false;
|
||||
|
|
|
@ -234,7 +234,7 @@ void show_error(wxWindow* parent, const wxString& message)
|
|||
void show_error_id(int id, const std::string& message)
|
||||
{
|
||||
auto *parent = id != 0 ? wxWindow::FindWindowById(id) : nullptr;
|
||||
show_error(parent, wxString::FromUTF8(message.data()));
|
||||
show_error(parent, from_u8(message));
|
||||
}
|
||||
|
||||
void show_info(wxWindow* parent, const wxString& message, const wxString& title)
|
||||
|
@ -324,7 +324,7 @@ wxString from_path(const boost::filesystem::path &path)
|
|||
#ifdef _WIN32
|
||||
return wxString(path.string<std::wstring>());
|
||||
#else
|
||||
return wxString::FromUTF8(path.string<std::string>());
|
||||
return from_u8(path.string<std::string>());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ void desktop_open_datadir_folder()
|
|||
|
||||
const auto path = data_dir();
|
||||
#ifdef _WIN32
|
||||
const auto widepath = wxString::FromUTF8(path.data());
|
||||
const wxString widepath = from_u8(path);
|
||||
const wchar_t *argv[] = { L"explorer", widepath.GetData(), nullptr };
|
||||
::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
|
||||
#elif __APPLE__
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -9,9 +9,12 @@
|
|||
#include <wx/numformatter.h>
|
||||
|
||||
#include "BitmapCache.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
|
||||
using Slic3r::GUI::from_u8;
|
||||
|
||||
wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);
|
||||
wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
|
||||
|
||||
|
@ -37,7 +40,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
|
|||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
std::function<void(wxCommandEvent& event)> cb, const std::string& icon, wxEvtHandler* event_handler)
|
||||
{
|
||||
const wxBitmap& bmp = !icon.empty() ? wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap;
|
||||
const wxBitmap& bmp = !icon.empty() ? wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap;
|
||||
return append_menu_item(menu, id, string, description, cb, bmp, event_handler);
|
||||
}
|
||||
|
||||
|
@ -48,7 +51,7 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
|
|||
|
||||
wxMenuItem* item = new wxMenuItem(menu, id, string, description);
|
||||
if (!icon.empty())
|
||||
item->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG));
|
||||
item->SetBitmap(wxBitmap(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG));
|
||||
|
||||
item->SetSubMenu(sub_menu);
|
||||
menu->Append(item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue