diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 8e7de28704..a49feeec60 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -502,43 +502,86 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode } if (properties_shown) { - imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Type") + ":"); - ImGui::SameLine(); - imgui.text(to_string(vertex.type)); - if (vertex.is_extrusion()) { - ImGui::SameLine(); - imgui.text("(" + to_string(vertex.role) + ")"); + auto append_table_row = [&imgui](const std::string& label, std::function value_callback) { + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, label); + ImGui::TableSetColumnIndex(1); + value_callback(); + }; + + ImGui::Separator(); + if (ImGui::BeginTable("Properties", 2)) { + const bool imperial_units = wxGetApp().app_config->get_bool("use_inches"); + char buff[1024]; + + append_table_row(_u8L("Type") + ":", [&imgui, &vertex]() { + std::string text = _u8L(to_string(vertex.type)); + if (vertex.is_extrusion()) + text += " (" + _u8L(to_string(vertex.role)) + ")"; + imgui.text(text); + }); + append_table_row(_u8L("Width") + ":", [&imgui, &vertex, &buff, imperial_units]() { + std::string text; + if (vertex.is_extrusion()) { + sprintf(buff, "%.3f", vertex.width); + text = std::string(buff) + " "; + text += imperial_units ? _u8L("in") : _u8L("mm"); + } + else + text = _u8L("N/A"); + imgui.text(text); + }); + append_table_row(_u8L("Height") + ":", [&imgui, &vertex, &buff, imperial_units]() { + std::string text; + if (vertex.is_extrusion()) { + sprintf(buff, "%.3f", vertex.height); + text = std::string(buff) + " "; + text += imperial_units ? _u8L("in") : _u8L("mm"); + } + else + text = _u8L("N/A"); + imgui.text(text); + }); + append_table_row(_u8L("Layer") + ":", [&imgui, &vertex, &buff]() { + sprintf(buff, "%d", vertex.layer_id + 1); + const std::string text = std::string(buff); + imgui.text(text); + }); + append_table_row(_u8L("Speed") + ":", [&imgui, &vertex, &buff, imperial_units]() { + std::string text; + if (vertex.is_extrusion()) { + sprintf(buff, "%.1f", vertex.feedrate); + text = std::string(buff) + " "; + text += imperial_units ? _u8L("in/s") : _u8L("mm/s"); + } + else + text = _u8L("N/A"); + imgui.text(text); + }); + append_table_row(_u8L("Fan speed") + ":", [&imgui, &vertex, &buff]() { + std::string text; + if (vertex.is_extrusion()) { + sprintf(buff, "%.0f", vertex.fan_speed); + text = std::string(buff) + " " + _u8L("%"); + } + else + text = _u8L("N/A"); + imgui.text(text); + }); + append_table_row(_u8L("Temperature") + ":", [&imgui, &vertex, &buff]() { + sprintf(buff, "%.0f", vertex.temperature); + const std::string text = std::string(buff) + " " + _u8L("°C"); + imgui.text(text); + }); + append_table_row(_u8L("Time") + ":", [viewer, &imgui, &vertex, &buff]() { + sprintf(buff, "%.3f", vertex.times[static_cast(viewer->get_time_mode())]); + const std::string text = std::string(buff) + " " + _u8L("s"); + imgui.text(text); + }); + + ImGui::EndTable(); } - const bool imperial_units = wxGetApp().app_config->get_bool("use_inches"); - imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Width") + ":"); - if (vertex.is_extrusion()) { - sprintf(buf, "%.3f", vertex.width); - ImGui::SameLine(); - imgui.text(std::string(buf)); - ImGui::SameLine(); - imgui.text(imperial_units ? _u8L("in") : _u8L("mm")); - } - else { - ImGui::SameLine(); - imgui.text(_u8L("N/A")); - } - ImGui::SameLine(); - imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Height") + ":"); - if (vertex.is_extrusion()) { - sprintf(buf, "%.3f", vertex.height); - ImGui::SameLine(); - imgui.text(std::string(buf)); - ImGui::SameLine(); - imgui.text(imperial_units ? _u8L("in") : _u8L("mm")); - } - else { - ImGui::SameLine(); - imgui.text(_u8L("N/A")); - } - imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Layer") + ":"); - sprintf(buf, "%d", vertex.layer_id + 1); - ImGui::SameLine(); - imgui.text(std::string(buf)); } // force extra frame to automatically update window size diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index c7197ee8ea..cb5c700f62 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -1058,7 +1058,16 @@ void Preview::on_layers_slider_scroll_changed(wxCommandEvent& event) void Preview::on_moves_slider_scroll_changed(wxCommandEvent& event) { m_canvas->update_gcode_sequential_view_current(static_cast(m_moves_slider->GetLowerValueD() - 1.0), static_cast(m_moves_slider->GetHigherValueD() - 1.0)); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if ENABLE_NEW_GCODE_VIEWER + m_canvas->set_as_dirty(); + m_canvas->request_extra_frame(); +#else +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ m_canvas->render(); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#endif // ENABLE_NEW_GCODE_VIEWER +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ } } // namespace GUI diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index d48fb8d81b..a69f780736 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -748,7 +748,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_MOVE_SLIDERS, [this](wxKeyEvent& evt) { preview->move_layers_slider(evt); preview->move_moves_slider(evt); - }); + }); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_EDIT_COLOR_CHANGE, [this](wxKeyEvent& evt) { preview->edit_layers_slider(evt); }); if (wxGetApp().is_gcode_viewer()) preview->Bind(EVT_GLCANVAS_RELOAD_FROM_DISK, [this](SimpleEvent&) { this->q->reload_gcode_from_disk(); });