Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2018-06-07 23:10:23 +0300
committerbubnikv <bubnikv@gmail.com>2018-06-07 23:10:23 +0300
commit7dfe2e25950f20c305bf5b0c2757cc4eb0d064e4 (patch)
tree4f1a5307d6c87bb47cb51e915bd680ee1c62b0e3 /xs
parent92875709e1881fe3f374cd06321dacc3edbbd4c6 (diff)
Fixed mangling of UTF characters when converted implicitely to
wxString on Windows through the + operator.
Diffstat (limited to 'xs')
-rw-r--r--xs/CMakeLists.txt2
-rw-r--r--xs/src/slic3r/GUI/GUI.cpp10
-rw-r--r--xs/src/slic3r/GUI/GUI.hpp9
-rw-r--r--xs/src/slic3r/GUI/RammingChart.cpp9
-rw-r--r--xs/src/slic3r/GUI/Tab.cpp14
-rw-r--r--xs/src/slic3r/GUI/WipeTowerDialog.cpp13
6 files changed, 30 insertions, 27 deletions
diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt
index 77747cd07..9c61fa729 100644
--- a/xs/CMakeLists.txt
+++ b/xs/CMakeLists.txt
@@ -29,7 +29,7 @@ if(WIN32)
# -D_ITERATOR_DEBUG_LEVEL)
endif()
-add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE)
+add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
add_library(libslic3r STATIC
${LIBDIR}/libslic3r/BoundingBox.cpp
diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp
index d42fd3538..0170c5526 100644
--- a/xs/src/slic3r/GUI/GUI.cpp
+++ b/xs/src/slic3r/GUI/GUI.cpp
@@ -308,6 +308,8 @@ enum ConfigMenuIDs {
ConfigMenuCnt,
};
+static wxString dots("…", wxConvUTF8);
+
void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_language_change)
{
auto local_menu = new wxMenu();
@@ -315,12 +317,12 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
const auto config_wizard_tooltip = wxString::Format(_(L("Run %s")), ConfigWizard::name());
// Cmd+, is standard on OS X - what about other operating systems?
- local_menu->Append(config_id_base + ConfigMenuWizard, ConfigWizard::name() + "\u2026", config_wizard_tooltip);
- local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots"))+"\u2026", _(L("Inspect / activate configuration snapshots")));
+ local_menu->Append(config_id_base + ConfigMenuWizard, ConfigWizard::name() + dots, config_wizard_tooltip);
+ local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots"))+dots, _(L("Inspect / activate configuration snapshots")));
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _(L("Take Configuration Snapshot")), _(L("Capture a configuration snapshot")));
// local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
local_menu->AppendSeparator();
- local_menu->Append(config_id_base + ConfigMenuPreferences, _(L("Preferences"))+"\u2026\tCtrl+,", _(L("Application preferences")));
+ local_menu->Append(config_id_base + ConfigMenuPreferences, _(L("Preferences"))+dots+"\tCtrl+,", _(L("Application preferences")));
local_menu->Append(config_id_base + ConfigMenuLanguage, _(L("Change Application Language")));
local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _(L("Flash printer firmware")), _(L("Upload a firmware image into an Arduino based printer")));
@@ -841,7 +843,7 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl
Line line = { "", "" };
line.widget = [config](wxWindow* parent){
- g_wiping_dialog_button = new wxButton(parent, wxID_ANY, _(L("Purging volumes")) + "\u2026", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
+ g_wiping_dialog_button = new wxButton(parent, wxID_ANY, _(L("Purging volumes")) + dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(g_wiping_dialog_button);
g_wiping_dialog_button->Bind(wxEVT_BUTTON, ([parent](wxCommandEvent& e)
diff --git a/xs/src/slic3r/GUI/GUI.hpp b/xs/src/slic3r/GUI/GUI.hpp
index 4deee1910..90beb8b95 100644
--- a/xs/src/slic3r/GUI/GUI.hpp
+++ b/xs/src/slic3r/GUI/GUI.hpp
@@ -5,6 +5,9 @@
#include <vector>
#include "Config.hpp"
+#include <wx/intl.h>
+#include <wx/string.h>
+
class wxApp;
class wxWindow;
class wxFrame;
@@ -30,6 +33,12 @@ class PresetUpdater;
class DynamicPrintConfig;
class TabIface;
+#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()); }
+
// !!! If you needed to translate some wxString,
// !!! please use _(L(string))
// !!! _() - is a standard wxWidgets macro to translate
diff --git a/xs/src/slic3r/GUI/RammingChart.cpp b/xs/src/slic3r/GUI/RammingChart.cpp
index 97a6b7712..1e7412a4f 100644
--- a/xs/src/slic3r/GUI/RammingChart.cpp
+++ b/xs/src/slic3r/GUI/RammingChart.cpp
@@ -2,12 +2,7 @@
#include <wx/dcbuffer.h>
#include "RammingChart.hpp"
-
-
-//! macro used to mark string used at localization,
-//! return same string
-#define L(s) s
-
+#include "GUI.hpp"
wxDEFINE_EVENT(EVT_WIPE_TOWER_CHART_CHANGED, wxCommandEvent);
@@ -83,7 +78,7 @@ void Chart::draw() {
int text_height = 0;
dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawText(label,wxPoint(0.5*(m_rect.GetRight()+m_rect.GetLeft())-text_width/2.f, m_rect.GetBottom()+25));
- label = _(L("Volumetric speed")) + " (" + _(L("mm")) + "\u00B3/" + _(L("s")) + ")";
+ label = _(L("Volumetric speed")) + " (" + _(L("mm")) + wxString("³", wxConvUTF8) + _(L("s")) + ")";
dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawRotatedText(label,wxPoint(0,0.5*(m_rect.GetBottom()+m_rect.GetTop())+text_width/2.f),90);
}
diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp
index ab5aa2bb0..d4d10e368 100644
--- a/xs/src/slic3r/GUI/Tab.cpp
+++ b/xs/src/slic3r/GUI/Tab.cpp
@@ -32,6 +32,8 @@
namespace Slic3r {
namespace GUI {
+static wxString dots("…", wxConvUTF8);
+
// sub new
void Tab::create_preset_tab(PresetBundle *preset_bundle)
{
@@ -1261,7 +1263,7 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_cost");
- optgroup = page->new_optgroup(_(L("Temperature ")) +" (\u00B0C)"); // degree sign
+ optgroup = page->new_optgroup(_(L("Temperature ")) + wxString("°", wxConvUTF8));
Line line = { _(L("Extruder")), "" };
line.append_option(optgroup->get_option("first_layer_temperature"));
line.append_option(optgroup->get_option("temperature"));
@@ -1319,7 +1321,7 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_toolchange_delay");
line = { _(L("Ramming")), "" };
line.widget = [this](wxWindow* parent){
- auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
+ auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(ramming_dialog_btn);
@@ -1441,7 +1443,7 @@ void TabPrinter::build()
Line line{ _(L("Bed shape")), "" };
line.widget = [this](wxWindow* parent){
- auto btn = new wxButton(parent, wxID_ANY, _(L(" Set "))+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT);
+ auto btn = new wxButton(parent, wxID_ANY, _(L(" Set "))+dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT);
// btn->SetFont(Slic3r::GUI::small_font);
btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("printer_empty.png")), wxBITMAP_TYPE_PNG));
@@ -1540,7 +1542,7 @@ void TabPrinter::build()
optgroup = page->new_optgroup(_(L("OctoPrint upload")));
auto octoprint_host_browse = [this, optgroup] (wxWindow* parent) {
- auto btn = new wxButton(parent, wxID_ANY, _(L(" Browse "))+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
+ auto btn = new wxButton(parent, wxID_ANY, _(L(" Browse "))+dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("zoom.png")), wxBITMAP_TYPE_PNG));
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn);
@@ -1589,7 +1591,7 @@ void TabPrinter::build()
Line cafile_line = optgroup->create_single_option_line("octoprint_cafile");
auto octoprint_cafile_browse = [this, optgroup] (wxWindow* parent) {
- auto btn = new wxButton(parent, wxID_ANY, _(L(" Browse "))+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
+ auto btn = new wxButton(parent, wxID_ANY, _(L(" Browse "))+dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
btn->SetBitmap(wxBitmap(from_u8(Slic3r::var("zoom.png")), wxBITMAP_TYPE_PNG));
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn);
@@ -2211,7 +2213,7 @@ void Tab::update_ui_from_settings()
wxSizer* Tab::compatible_printers_widget(wxWindow* parent, wxCheckBox** checkbox, wxButton** btn)
{
*checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
- *btn = new wxButton(parent, wxID_ANY, _(L(" Set "))+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT);
+ *btn = new wxButton(parent, wxID_ANY, _(L(" Set "))+dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT | wxBU_EXACTFIT);
(*btn)->SetBitmap(wxBitmap(from_u8(Slic3r::var("printer_empty.png")), wxBITMAP_TYPE_PNG));
diff --git a/xs/src/slic3r/GUI/WipeTowerDialog.cpp b/xs/src/slic3r/GUI/WipeTowerDialog.cpp
index 4b25ccd3a..eef4017c1 100644
--- a/xs/src/slic3r/GUI/WipeTowerDialog.cpp
+++ b/xs/src/slic3r/GUI/WipeTowerDialog.cpp
@@ -1,15 +1,10 @@
#include <algorithm>
#include <sstream>
#include "WipeTowerDialog.hpp"
+#include "GUI.hpp"
#include <wx/sizer.h>
-//! macro used to mark string used at localization,
-//! return same string
-#define L(s) s
-
-
-
RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters)
: wxDialog(parent, wxID_ANY, _(L("Ramming customization")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE/* | wxRESIZE_BORDER*/)
{
@@ -81,7 +76,7 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
auto gsizer_param = new wxFlexGridSizer(2, 5, 15);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total ramming time")) + " (" + _(L("s")) + "):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_time);
- gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total rammed volume")) + " (" + _(L("mm")) + "\u00B3):")), 0, wxALIGN_CENTER_VERTICAL);
+ gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total rammed volume")) + " (" + _(L("mm")) + wxString("³):", wxConvUTF8))), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_volume);
gsizer_param->AddSpacer(20);
gsizer_param->AddSpacer(20);
@@ -220,7 +215,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
// collect and format sizer
format_sizer(m_sizer_advanced, m_page_advanced, m_gridsizer_advanced,
- wxString::Format(_(L("Here you can adjust required purging volume (mm%s) for any given pair of tools.")), "\u00B3"),
+ _(L("Here you can adjust required purging volume (mm³) for any given pair of tools.")),
_(L("Extruder changed to")));
// Hide preview page before new page creating
@@ -243,7 +238,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
// collect and format sizer
format_sizer(m_sizer_simple, m_page_simple, gridsizer_simple,
_(L("Total purging volume is calculated by summing two values below, depending on which tools are loaded/unloaded.")),
- wxString::Format(_(L("Volume to purge (mm%s) when the filament is being")), "\u00B3"), 50);
+ _(L("Volume to purge (mm³) when the filament is being")), 50);
m_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer->Add(m_page_simple, 0, wxEXPAND | wxALL, 25);