Localization. Next update

This commit is contained in:
Oleksandra Yushchenko 2023-05-26 13:56:34 +02:00 committed by GitHub
commit 89c5b30210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 24230 additions and 22664 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -98,7 +98,7 @@ src/slic3r/Utils/Process.cpp
src/slic3r/Utils/Repetier.cpp src/slic3r/Utils/Repetier.cpp
src/slic3r/Config/Snapshot.cpp src/slic3r/Config/Snapshot.cpp
src/libslic3r/GCode.cpp src/libslic3r/GCode.cpp
src/libslic3r/ExtrusionEntity.cpp src/libslic3r/ExtrusionRole.cpp
src/libslic3r/Flow.cpp src/libslic3r/Flow.cpp
src/libslic3r/Format/3mf.cpp src/libslic3r/Format/3mf.cpp
src/libslic3r/Format/AMF.cpp src/libslic3r/Format/AMF.cpp
@ -111,6 +111,7 @@ src/libslic3r/SLA/Pad.cpp
src/libslic3r/SLA/Hollowing.cpp src/libslic3r/SLA/Hollowing.cpp
src/libslic3r/SLAPrint.cpp src/libslic3r/SLAPrint.cpp
src/libslic3r/SLAPrintSteps.cpp src/libslic3r/SLAPrintSteps.cpp
src/libslic3r/Utils.cpp
src/libslic3r/PrintBase.cpp src/libslic3r/PrintBase.cpp
src/libslic3r/PrintConfig.cpp src/libslic3r/PrintConfig.cpp
src/libslic3r/Zipper.cpp src/libslic3r/Zipper.cpp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -568,9 +568,9 @@ namespace ImGui
// - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. // - Note that in C++ a 'float v[X]' function argument is the _same_ as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible.
// - You can pass the address of a first float element out of a contiguous structure, e.g. &myvector.x // - You can pass the address of a first float element out of a contiguous structure, e.g. &myvector.x
IMGUI_API bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);
IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const char* current_label = NULL, const char* original_label = NULL);
IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);
IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL); IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL, const char* current_label = NULL, const char* original_label = NULL);
IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0)); // display a color square/button, hover for details, return true when pressed. IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0)); // display a color square/button, hover for details, return true when pressed.
IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.

View File

@ -4689,7 +4689,7 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag
// Edit colors components (each component in 0.0f..1.0f range). // Edit colors components (each component in 0.0f..1.0f range).
// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. // See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.
// With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item. // With typical options: Left-click on color square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.
bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags) bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags, const char* current_label/* = NULL*/, const char* original_label/* = NULL*/)
{ {
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems) if (window->SkipItems)
@ -4859,7 +4859,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags__InputMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar; ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags__InputMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;
ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__DisplayMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf; ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__DisplayMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes? SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x); value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x, current_label, original_label);
EndPopup(); EndPopup();
} }
} }
@ -4952,7 +4952,7 @@ static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2
// (In C++ the 'float col[4]' notation for a function argument is equivalent to 'float* col', we only specify a size to facilitate understanding of the code.) // (In C++ the 'float col[4]' notation for a function argument is equivalent to 'float* col', we only specify a size to facilitate understanding of the code.)
// FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..) // FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..)
// FIXME: this is trying to be aware of style.Alpha but not fully correct. Also, the color wheel will have overlapping glitches with (style.Alpha < 1.0) // FIXME: this is trying to be aware of style.Alpha but not fully correct. Also, the color wheel will have overlapping glitches with (style.Alpha < 1.0)
bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags, const float* ref_col) bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags, const float* ref_col, const char* current_label/*=NULL*/, const char* original_label/*=NULL*/)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
@ -5126,13 +5126,13 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
PushItemFlag(ImGuiItemFlags_NoNavDefaultFocus, true); PushItemFlag(ImGuiItemFlags_NoNavDefaultFocus, true);
ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]); ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
if ((flags & ImGuiColorEditFlags_NoLabel)) if ((flags & ImGuiColorEditFlags_NoLabel))
Text("Current"); Text(current_label ? current_label : "Current");
ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags__InputMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf | ImGuiColorEditFlags_NoTooltip; ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags__InputMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf | ImGuiColorEditFlags_NoTooltip;
ColorButton("##current", col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)); ColorButton("##current", col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2));
if (ref_col != NULL) if (ref_col != NULL)
{ {
Text("Original"); Text(original_label ? original_label : "Original");
ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]); ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);
if (ColorButton("##original", ref_col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2))) if (ColorButton("##original", ref_col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)))
{ {

View File

@ -307,43 +307,9 @@ public:
// Shorten the dhms time by removing the seconds, rounding the dhm to full minutes // Shorten the dhms time by removing the seconds, rounding the dhm to full minutes
// and removing spaces. // and removing spaces.
inline std::string short_time(const std::string &time) std::string short_time(const std::string& time, bool force_localization = false);
{ // localized short_time used on UI
// Parse the dhms time format. inline std::string short_time_ui(const std::string& time) { return short_time(time, true); }
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
if (time.find('d') != std::string::npos)
::sscanf(time.c_str(), "%dd %dh %dm %ds", &days, &hours, &minutes, &seconds);
else if (time.find('h') != std::string::npos)
::sscanf(time.c_str(), "%dh %dm %ds", &hours, &minutes, &seconds);
else if (time.find('m') != std::string::npos)
::sscanf(time.c_str(), "%dm %ds", &minutes, &seconds);
else if (time.find('s') != std::string::npos)
::sscanf(time.c_str(), "%ds", &seconds);
// Round to full minutes.
if (days + hours + minutes > 0 && seconds >= 30) {
if (++minutes == 60) {
minutes = 0;
if (++hours == 24) {
hours = 0;
++days;
}
}
}
// Format the dhm time.
char buffer[64];
if (days > 0)
::sprintf(buffer, "%dd%dh%dm", days, hours, minutes);
else if (hours > 0)
::sprintf(buffer, "%dh%dm", hours, minutes);
else if (minutes > 0)
::sprintf(buffer, "%dm", minutes);
else
::sprintf(buffer, "%ds", seconds);
return buffer;
}
// Returns the given time is seconds in format DDd HHh MMm SSs // Returns the given time is seconds in format DDd HHh MMm SSs
inline std::string get_time_dhms(float time_in_secs) inline std::string get_time_dhms(float time_in_secs)

View File

@ -983,6 +983,61 @@ std::string xml_escape_double_quotes_attribute_value(std::string text)
return text; return text;
} }
std::string short_time(const std::string &time, bool force_localization /*= false*/)
{
// Parse the dhms time format.
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
if (time.find('d') != std::string::npos)
::sscanf(time.c_str(), "%dd %dh %dm %ds", &days, &hours, &minutes, &seconds);
else if (time.find('h') != std::string::npos)
::sscanf(time.c_str(), "%dh %dm %ds", &hours, &minutes, &seconds);
else if (time.find('m') != std::string::npos)
::sscanf(time.c_str(), "%dm %ds", &minutes, &seconds);
else if (time.find('s') != std::string::npos)
::sscanf(time.c_str(), "%ds", &seconds);
// Round to full minutes.
if (days + hours + minutes > 0 && seconds >= 30) {
if (++minutes == 60) {
minutes = 0;
if (++hours == 24) {
hours = 0;
++days;
}
}
}
// Format the dhm time
if (force_localization) {
auto get_d = [days]() { return format(_u8L("%1%d"), days); };
auto get_h = [hours]() { return format(_u8L("%1%h"), hours); };
// TRN "m" means "minutes"
auto get_m = [minutes]() { return format(_u8L("%1%m"), minutes); };
if (days > 0)
return get_d() + get_h() + get_m();
if (hours > 0)
return get_h() + get_m();
if (minutes > 0)
return get_m();
return format(_u8L("%1%s"), seconds);
}
char buffer[64];
if (days > 0)
::sprintf(buffer, "%dd%dh%dm", days, hours, minutes);
else if (hours > 0)
::sprintf(buffer, "%dh%dm", hours, minutes);
else if (minutes > 0)
::sprintf(buffer, "%dm", minutes);
else
::sprintf(buffer, "%ds", seconds);
return buffer;
}
std::string format_memsize_MB(size_t n) std::string format_memsize_MB(size_t n)
{ {
std::string out; std::string out;

View File

@ -708,28 +708,28 @@ static wxString short_and_splitted_time(const std::string& time)
::sscanf(time.c_str(), "%ds", &seconds); ::sscanf(time.c_str(), "%ds", &seconds);
// Format the dhm time. // Format the dhm time.
char buffer[64]; auto get_d = [days]() { return format(_u8L("%1%d"), days); };
auto get_h = [hours]() { return format(_u8L("%1%h"), hours); };
auto get_m = [minutes](){ return format(_u8L("%1%m"), minutes); };
auto get_s = [seconds](){ return format(_u8L("%1%s"), seconds); };
if (days > 0) if (days > 0)
::sprintf(buffer, "%dd%dh\n%dm", days, hours, minutes); return format_wxstr("%1%%2%\n%3%", get_d(), get_h(), get_m());
else if (hours > 0) { if (hours > 0) {
if (hours < 10 && minutes < 10 && seconds < 10) if (hours < 10 && minutes < 10 && seconds < 10)
::sprintf(buffer, "%dh%dm%ds", hours, minutes, seconds); return format_wxstr("%1%%2%%3%", get_h(), get_m(), get_s());
else if (hours > 10 && minutes > 10 && seconds > 10) if (hours > 10 && minutes > 10 && seconds > 10)
::sprintf(buffer, "%dh\n%dm\n%ds", hours, minutes, seconds); return format_wxstr("%1%\n%2%\n%3%", get_h(), get_m(), get_s());
else if ((minutes < 10 && seconds > 10) || (minutes > 10 && seconds < 10)) if ((minutes < 10 && seconds > 10) || (minutes > 10 && seconds < 10))
::sprintf(buffer, "%dh\n%dm%ds", hours, minutes, seconds); return format_wxstr("%1%\n%2%%3%", get_h(), get_m(), get_s());
else return format_wxstr("%1%%2%\n%3%", get_h(), get_m(), get_s());
::sprintf(buffer, "%dh%dm\n%ds", hours, minutes, seconds);
} }
else if (minutes > 0) { if (minutes > 0) {
if (minutes > 10 && seconds > 10) if (minutes > 10 && seconds > 10)
::sprintf(buffer, "%dm\n%ds", minutes, seconds); return format_wxstr("%1%\n%2%", get_m(), get_s());
else return format_wxstr("%1%%2%", get_m(), get_s());
::sprintf(buffer, "%dm%ds", minutes, seconds);
} }
else return from_u8(get_s());
::sprintf(buffer, "%ds", seconds);
return wxString::FromUTF8(buffer);
} }
wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer*/) const wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer*/) const

View File

@ -3271,6 +3271,11 @@ void GCodeViewer::render_legend(float& legend_height)
// draw text // draw text
ImGui::Dummy({ icon_size, icon_size }); ImGui::Dummy({ icon_size, icon_size });
ImGui::SameLine(); ImGui::SameLine();
// localize "g" and "m" units
const std::string& grams = _u8L("g");
const std::string& inches = _u8L("in");
const std::string& metres = _CTX_utf8(L_CONTEXT("m", "Metre"), "Metre");
if (callback != nullptr) { if (callback != nullptr) {
if (ImGui::MenuItem(label.c_str())) if (ImGui::MenuItem(label.c_str()))
callback(); callback();
@ -3306,11 +3311,9 @@ void GCodeViewer::render_legend(float& legend_height)
::sprintf(buf, "%.1f%%", 100.0f * percent); ::sprintf(buf, "%.1f%%", 100.0f * percent);
ImGui::TextUnformatted((percent > 0.0f) ? buf : ""); ImGui::TextUnformatted((percent > 0.0f) ? buf : "");
ImGui::SameLine(offsets[2]); ImGui::SameLine(offsets[2]);
::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", used_filament_m); imgui.text(format("%1$.2f %2%", used_filament_m, (imperial_units ? inches : metres)));
imgui.text(buf);
ImGui::SameLine(offsets[3]); ImGui::SameLine(offsets[3]);
::sprintf(buf, "%.2f g", used_filament_g); imgui.text(format("%1$.2f %2%", used_filament_g, grams));
imgui.text(buf);
} }
} }
else { else {
@ -3330,13 +3333,10 @@ void GCodeViewer::render_legend(float& legend_height)
ImGui::TextUnformatted((percent > 0.0f) ? buf : ""); ImGui::TextUnformatted((percent > 0.0f) ? buf : "");
} }
else if (used_filament_m > 0.0) { else if (used_filament_m > 0.0) {
char buf[64];
ImGui::SameLine(offsets[0]); ImGui::SameLine(offsets[0]);
::sprintf(buf, imperial_units ? "%.2f in" : "%.2f m", used_filament_m); imgui.text(format("%1$.2f %2%", used_filament_m, (imperial_units ? inches : metres)));
imgui.text(buf);
ImGui::SameLine(offsets[1]); ImGui::SameLine(offsets[1]);
::sprintf(buf, "%.2f g", used_filament_g); imgui.text(format("%1$.2f %2%", used_filament_g, grams));
imgui.text(buf);
} }
} }
@ -3506,7 +3506,7 @@ void GCodeViewer::render_legend(float& legend_height)
if (role < GCodeExtrusionRole::Count) { if (role < GCodeExtrusionRole::Count) {
labels.push_back(_u8L(gcode_extrusion_role_to_string(role))); labels.push_back(_u8L(gcode_extrusion_role_to_string(role)));
auto [time, percent] = role_time_and_percent(role); auto [time, percent] = role_time_and_percent(role);
times.push_back((time > 0.0f) ? short_time(get_time_dhms(time)) : ""); times.push_back((time > 0.0f) ? short_time_ui(get_time_dhms(time)) : "");
percents.push_back(percent); percents.push_back(percent);
max_time_percent = std::max(max_time_percent, percent); max_time_percent = std::max(max_time_percent, percent);
auto [used_filament_m, used_filament_g] = used_filament_per_role(role); auto [used_filament_m, used_filament_g] = used_filament_per_role(role);
@ -3630,7 +3630,7 @@ void GCodeViewer::render_legend(float& legend_height)
} }
if (m_buffers[buffer_id(EMoveType::Travel)].visible) if (m_buffers[buffer_id(EMoveType::Travel)].visible)
append_item(EItemType::Line, Travel_Colors[0], _u8L("Travel"), true, short_time(get_time_dhms(time_mode.travel_time)), append_item(EItemType::Line, Travel_Colors[0], _u8L("Travel"), true, short_time_ui(get_time_dhms(time_mode.travel_time)),
time_mode.travel_time / time_mode.time, max_time_percent, offsets, 0.0f, 0.0f); time_mode.travel_time / time_mode.time, max_time_percent, offsets, 0.0f, 0.0f);
break; break;
@ -3807,7 +3807,7 @@ void GCodeViewer::render_legend(float& legend_height)
ImGuiWrapper::to_ImU32(color2)); ImGuiWrapper::to_ImU32(color2));
ImGui::SameLine(offsets[0]); ImGui::SameLine(offsets[0]);
imgui.text(short_time(get_time_dhms(times.second - times.first))); imgui.text(short_time_ui(get_time_dhms(times.second - times.first)));
}; };
auto append_print = [&imgui, imperial_units](const ColorRGBA& color, const std::array<float, 4>& offsets, const Times& times, std::pair<double, double> used_filament) { auto append_print = [&imgui, imperial_units](const ColorRGBA& color, const std::array<float, 4>& offsets, const Times& times, std::pair<double, double> used_filament) {
@ -3823,9 +3823,9 @@ void GCodeViewer::render_legend(float& legend_height)
ImGuiWrapper::to_ImU32(color)); ImGuiWrapper::to_ImU32(color));
ImGui::SameLine(offsets[0]); ImGui::SameLine(offsets[0]);
imgui.text(short_time(get_time_dhms(times.second))); imgui.text(short_time_ui(get_time_dhms(times.second)));
ImGui::SameLine(offsets[1]); ImGui::SameLine(offsets[1]);
imgui.text(short_time(get_time_dhms(times.first))); imgui.text(short_time_ui(get_time_dhms(times.first)));
if (used_filament.first > 0.0f) { if (used_filament.first > 0.0f) {
char buffer[64]; char buffer[64];
ImGui::SameLine(offsets[2]); ImGui::SameLine(offsets[2]);
@ -3850,7 +3850,7 @@ void GCodeViewer::render_legend(float& legend_height)
case PartialTime::EType::Pause: { labels.push_back(_u8L("Pause")); break; } case PartialTime::EType::Pause: { labels.push_back(_u8L("Pause")); break; }
case PartialTime::EType::ColorChange: { labels.push_back(_u8L("Color change")); break; } case PartialTime::EType::ColorChange: { labels.push_back(_u8L("Color change")); break; }
} }
times.push_back(short_time(get_time_dhms(item.times.second))); times.push_back(short_time_ui(get_time_dhms(item.times.second)));
} }
@ -3883,7 +3883,7 @@ void GCodeViewer::render_legend(float& legend_height)
case PartialTime::EType::Pause: { case PartialTime::EType::Pause: {
imgui.text(_u8L("Pause")); imgui.text(_u8L("Pause"));
ImGui::SameLine(offsets[0]); ImGui::SameLine(offsets[0]);
imgui.text(short_time(get_time_dhms(item.times.second - item.times.first))); imgui.text(short_time_ui(get_time_dhms(item.times.second - item.times.first)));
break; break;
} }
case PartialTime::EType::ColorChange: { case PartialTime::EType::ColorChange: {
@ -4001,11 +4001,11 @@ void GCodeViewer::render_legend(float& legend_height)
if (ImGui::BeginTable("Times", 2)) { if (ImGui::BeginTable("Times", 2)) {
if (!time_mode.layers_times.empty()) { if (!time_mode.layers_times.empty()) {
add_strings_row_to_table(_u8L("First layer") + ":", ImGuiWrapper::COL_ORANGE_LIGHT, add_strings_row_to_table(_u8L("First layer") + ":", ImGuiWrapper::COL_ORANGE_LIGHT,
short_time(get_time_dhms(time_mode.layers_times.front())), ImGuiWrapper::to_ImVec4(ColorRGBA::WHITE())); short_time_ui(get_time_dhms(time_mode.layers_times.front())), ImGuiWrapper::to_ImVec4(ColorRGBA::WHITE()));
} }
add_strings_row_to_table(_u8L("Total") + ":", ImGuiWrapper::COL_ORANGE_LIGHT, add_strings_row_to_table(_u8L("Total") + ":", ImGuiWrapper::COL_ORANGE_LIGHT,
short_time(get_time_dhms(time_mode.time)), ImGuiWrapper::to_ImVec4(ColorRGBA::WHITE())); short_time_ui(get_time_dhms(time_mode.time)), ImGuiWrapper::to_ImVec4(ColorRGBA::WHITE()));
ImGui::EndTable(); ImGui::EndTable();
} }

View File

@ -335,7 +335,11 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
const ColorRGBA& select_first_color = m_modified_extruders_colors[m_first_selected_extruder_idx]; const ColorRGBA& select_first_color = m_modified_extruders_colors[m_first_selected_extruder_idx];
ImVec4 first_color = ImGuiWrapper::to_ImVec4(select_first_color); ImVec4 first_color = ImGuiWrapper::to_ImVec4(select_first_color);
const std::string first_label = into_u8(m_desc.at("first_color")) + "##color_picker"; const std::string first_label = into_u8(m_desc.at("first_color")) + "##color_picker";
if (ImGui::ColorEdit4(first_label.c_str(), (float*)&first_color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) if (ImGui::ColorEdit4(first_label.c_str(), (float*)&first_color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel,
// TRN Means "current color"
_u8L("Current").c_str(),
// TRN Means "original color"
_u8L("Original").c_str()))
m_modified_extruders_colors[m_first_selected_extruder_idx] = ImGuiWrapper::from_ImVec4(first_color); m_modified_extruders_colors[m_first_selected_extruder_idx] = ImGuiWrapper::from_ImVec4(first_color);
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
@ -348,7 +352,8 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
const ColorRGBA& select_second_color = m_modified_extruders_colors[m_second_selected_extruder_idx]; const ColorRGBA& select_second_color = m_modified_extruders_colors[m_second_selected_extruder_idx];
ImVec4 second_color = ImGuiWrapper::to_ImVec4(select_second_color); ImVec4 second_color = ImGuiWrapper::to_ImVec4(select_second_color);
const std::string second_label = into_u8(m_desc.at("second_color")) + "##color_picker"; const std::string second_label = into_u8(m_desc.at("second_color")) + "##color_picker";
if (ImGui::ColorEdit4(second_label.c_str(), (float*)&second_color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) if (ImGui::ColorEdit4(second_label.c_str(), (float*)&second_color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel,
_u8L("Current").c_str(), _u8L("Original").c_str()))
m_modified_extruders_colors[m_second_selected_extruder_idx] = ImGuiWrapper::from_ImVec4(second_color); m_modified_extruders_colors[m_second_selected_extruder_idx] = ImGuiWrapper::from_ImVec4(second_color);
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f; const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;

View File

@ -1370,7 +1370,7 @@ void Sidebar::update_sliced_info_sizer()
} }
p->sliced_info->SetTextAndShow(siCost, str_total_cost, "Cost"); p->sliced_info->SetTextAndShow(siCost, str_total_cost, "Cost");
wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : get_time_dhms(float(ps.estimated_print_time)); wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : from_u8(short_time_ui(get_time_dhms(float(ps.estimated_print_time))));
p->sliced_info->SetTextAndShow(siEstimatedTime, t_est, _L("Estimated printing time") + ":"); p->sliced_info->SetTextAndShow(siEstimatedTime, t_est, _L("Estimated printing time") + ":");
p->plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + boost::nowide::narrow(t_est), p->plater->is_sidebar_collapsed()); p->plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + boost::nowide::narrow(t_est), p->plater->is_sidebar_collapsed());
@ -1459,14 +1459,14 @@ void Sidebar::update_sliced_info_sizer()
new_label = _L("Estimated printing time") + ":"; new_label = _L("Estimated printing time") + ":";
if (ps.estimated_normal_print_time != "N/A") { if (ps.estimated_normal_print_time != "N/A") {
new_label += format_wxstr("\n - %1%", _L("normal mode")); new_label += format_wxstr("\n - %1%", _L("normal mode"));
info_text += format_wxstr("\n%1%", short_time(ps.estimated_normal_print_time)); info_text += format_wxstr("\n%1%", short_time_ui(ps.estimated_normal_print_time));
p->plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + ps.estimated_normal_print_time, p->plater->is_sidebar_collapsed()); p->plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + ps.estimated_normal_print_time, p->plater->is_sidebar_collapsed());
} }
if (ps.estimated_silent_print_time != "N/A") { if (ps.estimated_silent_print_time != "N/A") {
new_label += format_wxstr("\n - %1%", _L("stealth mode")); new_label += format_wxstr("\n - %1%", _L("stealth mode"));
info_text += format_wxstr("\n%1%", short_time(ps.estimated_silent_print_time)); info_text += format_wxstr("\n%1%", short_time_ui(ps.estimated_silent_print_time));
} }
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label); p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
} }