Add estimated printing time for first layer in legend

This commit is contained in:
enricoturri1966 2021-05-12 11:21:18 +02:00
parent de1d36cc9a
commit ebe762f177

View file

@ -3395,27 +3395,27 @@ void GCodeViewer::render_legend() const
ImGui::Spacing(); ImGui::Spacing();
#endif // ENABLE_SCROLLABLE_LEGEND #endif // ENABLE_SCROLLABLE_LEGEND
ImGui::Spacing(); ImGui::Spacing();
ImGui::PushStyleColor(ImGuiCol_Separator, { 1.0f, 1.0f, 1.0f, 1.0f }); std::string time_title = _u8L("Estimated printing times");
ImGui::Separator();
ImGui::PopStyleColor();
ImGui::Spacing();
ImGui::AlignTextToFramePadding();
switch (m_time_estimate_mode) switch (m_time_estimate_mode)
{ {
case PrintEstimatedStatistics::ETimeMode::Normal: case PrintEstimatedStatistics::ETimeMode::Normal: { time_title += " [" + _u8L("Normal mode") + "]:"; break; }
{ case PrintEstimatedStatistics::ETimeMode::Stealth: { time_title += " [" + _u8L("Stealth mode") + "]:"; break; }
imgui.text(_u8L("Estimated printing time") + " [" + _u8L("Normal mode") + "]:"); default: { assert(false); break; }
break;
} }
case PrintEstimatedStatistics::ETimeMode::Stealth:
{ imgui.title(time_title);
imgui.text(_u8L("Estimated printing time") + " [" + _u8L("Stealth mode") + "]:");
break; std::string first_str = _u8L("First layer");
} std::string total_str = _u8L("Total");
default : { assert(false); break; }
} float max_len = 10.0f + ImGui::GetStyle().ItemSpacing.x + std::max(ImGui::CalcTextSize(first_str.c_str()).x, ImGui::CalcTextSize(total_str.c_str()).x);
ImGui::SameLine();
imgui.text(first_str + ":");
ImGui::SameLine(max_len);
imgui.text(short_time(get_time_dhms(time_mode.layers_times.front())));
imgui.text(total_str + ":");
ImGui::SameLine(max_len);
imgui.text(short_time(get_time_dhms(time_mode.time))); imgui.text(short_time(get_time_dhms(time_mode.time)));
auto show_mode_button = [this, &imgui](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) { auto show_mode_button = [this, &imgui](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) {