mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 08:17:51 -06:00
Fixing build against wxWidgets 3.0
The wxString saga continues. wxWidgets 3.0 don't have the wxString::FromUTF8(const std::string&) overload, we must use the GUI::from_u8 helper Also wxWidgets 3.0 don't allow to disable wxString->const char* conversion, so calling show_info(wxWindow*, wxString, const char*) was ambiguous Several includes moved around
This commit is contained in:
parent
a87ba5d6a6
commit
eb3b65d8af
15 changed files with 28 additions and 22 deletions
|
@ -16,8 +16,8 @@
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
|
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format/format_fwd.hpp>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree_fwd.hpp>
|
||||||
|
|
||||||
#include <cereal/access.hpp>
|
#include <cereal/access.hpp>
|
||||||
#include <cereal/types/base_class.hpp>
|
#include <cereal/types/base_class.hpp>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "Extruder.hpp"
|
#include "Extruder.hpp"
|
||||||
|
#include "PrintConfig.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
#include "libslic3r.h"
|
#include "libslic3r.h"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "PrintConfig.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
class GCodeConfig;
|
||||||
|
|
||||||
class Extruder
|
class Extruder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -36,7 +36,7 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
|
||||||
// CopyrightsDialog
|
// CopyrightsDialog
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
CopyrightsDialog::CopyrightsDialog()
|
CopyrightsDialog::CopyrightsDialog()
|
||||||
: DPIDialog(NULL, wxID_ANY, wxString::FromUTF8((boost::format("%1% - %2%")
|
: DPIDialog(NULL, wxID_ANY, from_u8((boost::format("%1% - %2%")
|
||||||
% SLIC3R_APP_NAME
|
% SLIC3R_APP_NAME
|
||||||
% _utf8(L("Portions copyright"))).str()),
|
% _utf8(L("Portions copyright"))).str()),
|
||||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
|
@ -198,7 +198,7 @@ void CopyrightsDialog::onCloseDialog(wxEvent &)
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutDialog::AboutDialog()
|
AboutDialog::AboutDialog()
|
||||||
: DPIDialog(NULL, wxID_ANY, wxString::FromUTF8((boost::format(_utf8(L("About %s"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
: DPIDialog(NULL, wxID_ANY, from_u8((boost::format(_utf8(L("About %s"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
|
||||||
wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
{
|
{
|
||||||
SetFont(wxGetApp().normal_font());
|
SetFont(wxGetApp().normal_font());
|
||||||
|
@ -261,7 +261,7 @@ AboutDialog::AboutDialog()
|
||||||
const std::string license_str = _utf8(L("GNU Affero General Public License, version 3"));
|
const std::string license_str = _utf8(L("GNU Affero General Public License, version 3"));
|
||||||
const std::string based_on_str = _utf8(L("PrusaSlicer is based on Slic3r by Alessandro Ranellucci and the RepRap community."));
|
const std::string based_on_str = _utf8(L("PrusaSlicer is based on Slic3r by Alessandro Ranellucci and the RepRap community."));
|
||||||
const std::string contributors_str = _utf8(L("Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others."));
|
const std::string contributors_str = _utf8(L("Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others."));
|
||||||
const auto text = wxString::FromUTF8(
|
const auto text = from_u8(
|
||||||
(boost::format(
|
(boost::format(
|
||||||
"<html>"
|
"<html>"
|
||||||
"<body bgcolor= %1% link= %2%>"
|
"<body bgcolor= %1% link= %2%>"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "BackgroundSlicingProcess.hpp"
|
#include "BackgroundSlicingProcess.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
|
@ -219,7 +220,7 @@ void BackgroundSlicingProcess::thread_proc()
|
||||||
// Canceled, this is all right.
|
// Canceled, this is all right.
|
||||||
assert(m_print->canceled());
|
assert(m_print->canceled());
|
||||||
} catch (const std::bad_alloc& ex) {
|
} catch (const std::bad_alloc& ex) {
|
||||||
wxString errmsg = wxString::FromUTF8((boost::format(_utf8(L("%s has encountered an error. It was likely caused by running out of memory. "
|
wxString errmsg = GUI::from_u8((boost::format(_utf8(L("%s has encountered an error. It was likely caused by running out of memory. "
|
||||||
"If you are sure you have enough RAM on your system, this may also be a bug and we would "
|
"If you are sure you have enough RAM on your system, this may also be a bug and we would "
|
||||||
"be glad if you reported it."))) % SLIC3R_APP_NAME).str());
|
"be glad if you reported it."))) % SLIC3R_APP_NAME).str());
|
||||||
error = std::string(errmsg.ToUTF8()) + "\n\n" + std::string(ex.what());
|
error = std::string(errmsg.ToUTF8()) + "\n\n" + std::string(ex.what());
|
||||||
|
|
|
@ -219,10 +219,10 @@ void BonjourDialog::on_timer(wxTimerEvent &)
|
||||||
|
|
||||||
if (timer_state > 0) {
|
if (timer_state > 0) {
|
||||||
const std::string dots(timer_state, '.');
|
const std::string dots(timer_state, '.');
|
||||||
label->SetLabel(wxString::FromUTF8((boost::format("%1% %2%") % search_str % dots).str()));
|
label->SetLabel(GUI::from_u8((boost::format("%1% %2%") % search_str % dots).str()));
|
||||||
timer_state = (timer_state) % 3 + 1;
|
timer_state = (timer_state) % 3 + 1;
|
||||||
} else {
|
} else {
|
||||||
label->SetLabel(wxString::FromUTF8((boost::format("%1%: %2%") % search_str % (_utf8(L("Finished"))+".")).str()));
|
label->SetLabel(GUI::from_u8((boost::format("%1%: %2%") % search_str % (_utf8(L("Finished"))+".")).str()));
|
||||||
timer->Stop();
|
timer->Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! compatible) {
|
if (! compatible) {
|
||||||
text += "<p align=\"right\">" + wxString::FromUTF8((boost::format(_utf8(L("Incompatible with this %s"))) % SLIC3R_APP_NAME).str()) + "</p>";
|
text += "<p align=\"right\">" + from_u8((boost::format(_utf8(L("Incompatible with this %s"))) % SLIC3R_APP_NAME).str()) + "</p>";
|
||||||
}
|
}
|
||||||
else if (! snapshot_active)
|
else if (! snapshot_active)
|
||||||
text += "<p align=\"right\"><a href=\"" + snapshot.id + "\">" + _(L("Activate")) + "</a></p>";
|
text += "<p align=\"right\"><a href=\"" + snapshot.id + "\">" + _(L("Activate")) + "</a></p>";
|
||||||
|
|
|
@ -422,14 +422,14 @@ void ConfigWizardPage::append_spacer(int space)
|
||||||
// Wizard pages
|
// Wizard pages
|
||||||
|
|
||||||
PageWelcome::PageWelcome(ConfigWizard *parent)
|
PageWelcome::PageWelcome(ConfigWizard *parent)
|
||||||
: ConfigWizardPage(parent, wxString::FromUTF8((boost::format(
|
: ConfigWizardPage(parent, from_u8((boost::format(
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
_utf8(L("Welcome to the %s Configuration Assistant"))
|
_utf8(L("Welcome to the %s Configuration Assistant"))
|
||||||
#else
|
#else
|
||||||
_utf8(L("Welcome to the %s Configuration Wizard"))
|
_utf8(L("Welcome to the %s Configuration Wizard"))
|
||||||
#endif
|
#endif
|
||||||
) % SLIC3R_APP_NAME).str()), _(L("Welcome")))
|
) % SLIC3R_APP_NAME).str()), _(L("Welcome")))
|
||||||
, welcome_text(append_text(wxString::FromUTF8((boost::format(
|
, welcome_text(append_text(from_u8((boost::format(
|
||||||
_utf8(L("Hello, welcome to %s! This %s helps you with the initial configuration; just a few settings and you will be ready to print.")))
|
_utf8(L("Hello, welcome to %s! This %s helps you with the initial configuration; just a few settings and you will be ready to print.")))
|
||||||
% SLIC3R_APP_NAME
|
% SLIC3R_APP_NAME
|
||||||
% _utf8(ConfigWizard::name())).str())
|
% _utf8(ConfigWizard::name())).str())
|
||||||
|
@ -478,7 +478,7 @@ PagePrinters::PagePrinters(ConfigWizard *parent,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto picker_title = family.empty() ? wxString() : wxString::FromUTF8((boost::format(_utf8(L("%s Family"))) % family).str());
|
const auto picker_title = family.empty() ? wxString() : from_u8((boost::format(_utf8(L("%s Family"))) % family).str());
|
||||||
auto *picker = new PrinterPicker(this, vendor, picker_title, MAX_COLS, *appconfig, filter);
|
auto *picker = new PrinterPicker(this, vendor, picker_title, MAX_COLS, *appconfig, filter);
|
||||||
|
|
||||||
picker->Bind(EVT_PRINTER_PICK, [this, appconfig](const PrinterPickerEvent &evt) {
|
picker->Bind(EVT_PRINTER_PICK, [this, appconfig](const PrinterPickerEvent &evt) {
|
||||||
|
|
|
@ -952,7 +952,7 @@ wxString Control::get_tooltip(int tick/*=-1*/)
|
||||||
return _(L("Discard all custom changes"));
|
return _(L("Discard all custom changes"));
|
||||||
if (m_focus == fiCogIcon)
|
if (m_focus == fiCogIcon)
|
||||||
return m_mode == t_mode::MultiAsSingle ?
|
return m_mode == t_mode::MultiAsSingle ?
|
||||||
wxString::FromUTF8((boost::format(_utf8(L("Jump to height %s or "
|
GUI::from_u8((boost::format(_utf8(L("Jump to height %s or "
|
||||||
"Set extruder sequence for the entire print"))) % " (Shift + G)\n").str()) :
|
"Set extruder sequence for the entire print"))) % " (Shift + G)\n").str()) :
|
||||||
_(L("Jump to height")) + " (Shift + G)";
|
_(L("Jump to height")) + " (Shift + G)";
|
||||||
if (m_focus == fiColorBand)
|
if (m_focus == fiColorBand)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef slic3r_GUI_hpp_
|
#ifndef slic3r_GUI_hpp_
|
||||||
#define slic3r_GUI_hpp_
|
#define slic3r_GUI_hpp_
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
namespace boost { class any; }
|
||||||
|
namespace boost::filesystem { class path; }
|
||||||
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#ifndef slic3r_LambdaObjectDialog_hpp_
|
#ifndef slic3r_LambdaObjectDialog_hpp_
|
||||||
#define slic3r_LambdaObjectDialog_hpp_
|
#define slic3r_LambdaObjectDialog_hpp_
|
||||||
|
|
||||||
#include "GUI.hpp"
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ void MainFrame::load_configbundle(wxString file/* = wxEmptyString, const bool re
|
||||||
wxGetApp().load_current_presets();
|
wxGetApp().load_current_presets();
|
||||||
|
|
||||||
const auto message = wxString::Format(_(L("%d presets successfully imported.")), presets_imported);
|
const auto message = wxString::Format(_(L("%d presets successfully imported.")), presets_imported);
|
||||||
Slic3r::GUI::show_info(this, message, "Info");
|
Slic3r::GUI::show_info(this, message, wxString("Info"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load a provied DynamicConfig into the Print / Filament / Printer tabs, thus modifying the active preset.
|
// Load a provied DynamicConfig into the Print / Filament / Printer tabs, thus modifying the active preset.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "GLCanvas3D.hpp"
|
#include "GLCanvas3D.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
#include "GUI_ObjectManipulation.hpp"
|
#include "GUI_ObjectManipulation.hpp"
|
||||||
#include "GUI_ObjectList.hpp"
|
#include "GUI_ObjectList.hpp"
|
||||||
#include "Gizmos/GLGizmoBase.hpp"
|
#include "Gizmos/GLGizmoBase.hpp"
|
||||||
|
@ -1470,7 +1471,7 @@ void Selection::toggle_instance_printable_state()
|
||||||
ModelInstance* instance = model_object->instances[instance_idx];
|
ModelInstance* instance = model_object->instances[instance_idx];
|
||||||
const bool printable = !instance->printable;
|
const bool printable = !instance->printable;
|
||||||
|
|
||||||
wxString snapshot_text = model_object->instances.size() == 1 ? wxString::FromUTF8((boost::format("%1% %2%")
|
wxString snapshot_text = model_object->instances.size() == 1 ? from_u8((boost::format("%1% %2%")
|
||||||
% (printable ? _utf8(L("Set Printable")) : _utf8(L("Set Unprintable")))
|
% (printable ? _utf8(L("Set Printable")) : _utf8(L("Set Unprintable")))
|
||||||
% model_object->name).str()) :
|
% model_object->name).str()) :
|
||||||
(printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance")));
|
(printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance")));
|
||||||
|
|
|
@ -604,7 +604,7 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
(*ctrl)->Append(use_full_item_name
|
(*ctrl)->Append(use_full_item_name
|
||||||
? wxString::FromUTF8((boost::format("%1% %2%") % str % i).str())
|
? Slic3r::GUI::from_u8((boost::format("%1% %2%") % str % i).str())
|
||||||
: wxString::Format("%d", i), *bmp);
|
: wxString::Format("%d", i), *bmp);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -703,8 +703,8 @@ ModeButton::ModeButton( wxWindow* parent,
|
||||||
void ModeButton::Init(const wxString &mode)
|
void ModeButton::Init(const wxString &mode)
|
||||||
{
|
{
|
||||||
std::string mode_str = std::string(mode.ToUTF8());
|
std::string mode_str = std::string(mode.ToUTF8());
|
||||||
m_tt_focused = wxString::FromUTF8((boost::format(_utf8(L("Switch to the %s mode"))) % mode_str).str());
|
m_tt_focused = Slic3r::GUI::from_u8((boost::format(_utf8(L("Switch to the %s mode"))) % mode_str).str());
|
||||||
m_tt_selected = wxString::FromUTF8((boost::format(_utf8(L("Current mode is %s"))) % mode_str).str());
|
m_tt_selected = Slic3r::GUI::from_u8((boost::format(_utf8(L("Current mode is %s"))) % mode_str).str());
|
||||||
|
|
||||||
SetBitmapMargins(3, 0);
|
SetBitmapMargins(3, 0);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ wxString FlashAir::get_test_ok_msg () const
|
||||||
|
|
||||||
wxString FlashAir::get_test_failed_msg (wxString &msg) const
|
wxString FlashAir::get_test_failed_msg (wxString &msg) const
|
||||||
{
|
{
|
||||||
return wxString::FromUTF8((boost::format("%s: %s")
|
return GUI::from_u8((boost::format("%s: %s")
|
||||||
% _utf8(L("Could not connect to FlashAir"))
|
% _utf8(L("Could not connect to FlashAir"))
|
||||||
% std::string(msg.ToUTF8())
|
% std::string(msg.ToUTF8())
|
||||||
% _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str());
|
% _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue