Merge remote-tracking branch 'remotes/origin/machine-limits-config' into add_kinematics
This commit is contained in:
commit
b5f97baa28
8 changed files with 32 additions and 21 deletions
|
@ -21,6 +21,7 @@ xs/src/slic3r/GUI/UpdateDialogs.cpp
|
|||
xs/src/slic3r/GUI/WipeTowerDialog.cpp
|
||||
xs/src/slic3r/Utils/OctoPrint.cpp
|
||||
xs/src/slic3r/Utils/PresetUpdater.cpp
|
||||
xs/src/libslic3r/Print.cpp
|
||||
xs/src/libslic3r/PrintConfig.cpp
|
||||
xs/src/libslic3r/GCode/PreviewData.cpp
|
||||
lib/Slic3r/GUI.pm
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
#include "PreviewData.hpp"
|
||||
#include <float.h>
|
||||
#include <wx/intl.h>
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include <I18N.hpp>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
//! macro used to mark string used at localization,
|
||||
#define L(s) (s)
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -405,7 +410,7 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
|||
items.reserve(last_valid - first_valid + 1);
|
||||
for (unsigned int i = (unsigned int)first_valid; i <= (unsigned int)last_valid; ++i)
|
||||
{
|
||||
items.emplace_back(_CHB(extrusion.role_names[i].c_str()).data(), extrusion.role_colors[i]);
|
||||
items.emplace_back(Slic3r::I18N::translate(extrusion.role_names[i]), extrusion.role_colors[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -436,13 +441,9 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
|||
items.reserve(tools_colors_count);
|
||||
for (unsigned int i = 0; i < tools_colors_count; ++i)
|
||||
{
|
||||
char buf[MIN_BUF_LENGTH_FOR_L];
|
||||
sprintf(buf, _CHB(L("Extruder %d")), i + 1);
|
||||
|
||||
GCodePreviewData::Color color;
|
||||
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + i * 4), 4 * sizeof(float));
|
||||
|
||||
items.emplace_back(buf, color);
|
||||
items.emplace_back((boost::format(Slic3r::I18N::translate(L("Extruder %d"))) % (i + 1)).str(), color);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
typedef std::string (*translate_fn_type)(const char*);
|
||||
extern translate_fn_type translate_fn;
|
||||
inline void set_translate_callback(translate_fn_type fn) { translate_fn = fn; }
|
||||
inline std::string translate(const std::string &s) { return (translate_fn == nullptr) ? s : (*translate_fn)(s.c_str()); }
|
||||
inline std::string translate(const char *ptr) { return (translate_fn == nullptr) ? std::string(ptr) : (*translate_fn)(ptr); }
|
||||
namespace I18N {
|
||||
typedef std::string (*translate_fn_type)(const char*);
|
||||
extern translate_fn_type translate_fn;
|
||||
inline void set_translate_callback(translate_fn_type fn) { translate_fn = fn; }
|
||||
inline std::string translate(const std::string &s) { return (translate_fn == nullptr) ? s : (*translate_fn)(s.c_str()); }
|
||||
inline std::string translate(const char *ptr) { return (translate_fn == nullptr) ? std::string(ptr) : (*translate_fn)(ptr); }
|
||||
} // namespace I18N
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
//! macro used to mark string used at localization,
|
||||
//! return same string
|
||||
#define L(s) translate(s)
|
||||
#define L(s) Slic3r::I18N::translate(s)
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Slic3r {
|
|||
|
||||
//! macro used to mark string used at localization,
|
||||
//! return same string
|
||||
#define L(s) translate(s)
|
||||
#define L(s) Slic3r::I18N::translate(s)
|
||||
|
||||
PrintConfigDef::PrintConfigDef()
|
||||
{
|
||||
|
|
|
@ -125,7 +125,7 @@ const std::string& localization_dir()
|
|||
}
|
||||
|
||||
// Translate function callback, to call wxWidgets translate function to convert non-localized UTF8 string to a localized one.
|
||||
translate_fn_type translate_fn = nullptr;
|
||||
Slic3r::I18N::translate_fn_type Slic3r::I18N::translate_fn = nullptr;
|
||||
|
||||
static std::string g_data_dir;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "../Utils/PresetUpdater.hpp"
|
||||
#include "../Config/Snapshot.hpp"
|
||||
#include "3DScene.hpp"
|
||||
|
||||
#include "libslic3r/I18N.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
|
@ -164,9 +164,13 @@ static void init_fonts()
|
|||
#endif /*__WXMAC__*/
|
||||
}
|
||||
|
||||
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str().data(); }
|
||||
|
||||
void set_wxapp(wxApp *app)
|
||||
{
|
||||
g_wxApp = app;
|
||||
// Let the libslic3r know the callback, which will translate messages on demand.
|
||||
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
|
||||
init_label_colours();
|
||||
init_fonts();
|
||||
}
|
||||
|
|
|
@ -34,11 +34,14 @@ class DynamicPrintConfig;
|
|||
class TabIface;
|
||||
class _3DScene;
|
||||
|
||||
#define _(s) Slic3r::translate((s))
|
||||
inline wxString translate(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)); }
|
||||
inline wxString translate(const wchar_t *s) { return wxGetTranslation(s); }
|
||||
inline wxString translate(const std::string &s) { return wxGetTranslation(wxString(s.c_str(), wxConvUTF8)); }
|
||||
inline wxString translate(const std::wstring &s) { return wxGetTranslation(s.c_str()); }
|
||||
#define _(s) Slic3r::GUI::I18N::translate((s))
|
||||
|
||||
namespace GUI { namespace I18N {
|
||||
inline wxString translate(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)); }
|
||||
inline wxString translate(const wchar_t *s) { return wxGetTranslation(s); }
|
||||
inline wxString translate(const std::string &s) { return wxGetTranslation(wxString(s.c_str(), wxConvUTF8)); }
|
||||
inline wxString translate(const std::wstring &s) { return wxGetTranslation(s.c_str()); }
|
||||
} }
|
||||
|
||||
// !!! If you needed to translate some wxString,
|
||||
// !!! please use _(L(string))
|
||||
|
|
Loading…
Reference in a new issue