Improvements for Sliced Plates Toolbar (#9313)
* initial * fix scaling related issues * Update GLCanvas3D.cpp * update * Update GLCanvas3D.cpp * Update GLCanvas3D.cpp * Update GLCanvas3D.cpp * Update GLCanvas3D.cpp * Update GLCanvas3D.cpp * update * Update GLCanvas3D.cpp * Update GLCanvas3D.cpp --------- Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
1
resources/images/im_all_plates_failed.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1c0-.55.45-1,1-1h17c.55,0,1,.45,1,1v17c0,.55-.45,1-1,1h-1" style="fill:none; stroke:gray; stroke-linecap:round; stroke-linejoin:round;"/><path d="M16.5,9.5v-1c0-.55.45-1,1-1h17c.55,0,1,.45,1,1v17c0,.55-.45,1-1,1h-1" style="fill:none; stroke:gray; stroke-linecap:round; stroke-linejoin:round;"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" ry="1" style="fill:none; stroke:gray; stroke-linecap:round; stroke-linejoin:round;"/><path d="M31,19c0,3.87-3.13,7-7,7s-7-3.13-7-7,3.13-7,7-7,7,3.13,7,7ZM23,23c0,.55.45,1,1,1s1-.45,1-1-.45-1-1-1-1,.45-1,1ZM24,14c-.55,0-1,.45-1,1v5c0,.55.45,1,1,1s1-.45,1-1v-5c0-.55-.45-1-1-1Z" style="fill:#e14747;"/></svg>
|
After Width: | Height: | Size: 801 B |
1
resources/images/im_all_plates_failed_dark.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1c0-.55.45-1,1-1h17c.55,0,1,.45,1,1v17c0,.55-.45,1-1,1h-1" style="fill:none; stroke:#c4c4c4; stroke-linecap:round; stroke-linejoin:round;"/><path d="M16.5,9.5v-1c0-.55.45-1,1-1h17c.55,0,1,.45,1,1v17c0,.55-.45,1-1,1h-1" style="fill:none; stroke:#c4c4c4; stroke-linecap:round; stroke-linejoin:round;"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" ry="1" style="fill:none; stroke:#c4c4c4; stroke-linecap:round; stroke-linejoin:round;"/><path d="M31,19c0,3.87-3.13,7-7,7s-7-3.13-7-7,3.13-7,7-7,7,3.13,7,7ZM23,23c0,.55.45,1,1,1s1-.45,1-1-.45-1-1-1-1,.45-1,1ZM24,14c-.55,0-1,.45-1,1v5c0,.55.45,1,1,1s1-.45,1-1v-5c0-.55-.45-1-1-1Z" style="fill:#e14747;"/></svg>
|
After Width: | Height: | Size: 810 B |
1
resources/images/im_all_plates_idle.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><circle cx="18" cy="19" r="1" style="fill:#009688"/><circle cx="24" cy="19" r="1" style="fill:#009688"/><circle cx="30" cy="19" r="1" style="fill:#009688"/></svg>
|
After Width: | Height: | Size: 668 B |
1
resources/images/im_all_plates_idle_dark.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><circle cx="18" cy="19" r="1" style="fill:#009688"/><circle cx="24" cy="19" r="1" style="fill:#009688"/><circle cx="30" cy="19" r="1" style="fill:#009688"/></svg>
|
After Width: | Height: | Size: 677 B |
1
resources/images/im_all_plates_slicing.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><circle cx="18" cy="19" r="1" style="fill:#009688"/><circle cx="30" cy="19" r="1" style="fill:#009688"/><circle cx="19.757" cy="14.757" r="1" style="fill:#009688"/><circle cx="28.243" cy="23.243" r="1" style="fill:#009688"/><circle cx="24" cy="13" r="1" style="fill:#009688"/><circle cx="24" cy="25" r="1" style="fill:#009688"/><circle cx="28.243" cy="14.757" r="1" style="fill:#009688"/><circle cx="19.757" cy="23.243" r="1" style="fill:#009688"/></svg>
|
After Width: | Height: | Size: 960 B |
1
resources/images/im_all_plates_slicing_dark.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><circle cx="18" cy="19" r="1" style="fill:#009688"/><circle cx="30" cy="19" r="1" style="fill:#009688"/><circle cx="19.757" cy="14.757" r="1" style="fill:#009688"/><circle cx="28.243" cy="23.243" r="1" style="fill:#009688"/><circle cx="24" cy="13" r="1" style="fill:#009688"/><circle cx="24" cy="25" r="1" style="fill:#009688"/><circle cx="28.243" cy="14.757" r="1" style="fill:#009688"/><circle cx="19.757" cy="23.243" r="1" style="fill:#009688"/></svg>
|
After Width: | Height: | Size: 969 B |
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><rect width="50" height="50" style="fill:#e9e9e9"/><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><line x1="16.5" y1="11.5" x2="16.5" y2="26.5" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><line x1="31.5" y1="26.5" x2="16.5" y2="26.5" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><rect x="18.406" y="17.281" width="2" height="7" rx="1" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><rect x="23.406" y="13.281" width="2" height="11" rx="1" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><rect x="28.406" y="15.281" width="2" height="9" rx="1" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><polyline points="30.5 25.5 17.5 25.5 17.5 12.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="20.5" y1="22.5" x2="20.5" y2="18.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="24.5" y1="22.5" x2="24.5" y2="14.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="28.5" y1="22.5" x2="28.5" y2="16.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/></svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1007 B |
1
resources/images/im_all_plates_stats_dark.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:#c4c4c4;stroke-linecap:round;stroke-linejoin:round"/><polyline points="30.5 25.5 17.5 25.5 17.5 12.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="20.5" y1="22.5" x2="20.5" y2="18.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="24.5" y1="22.5" x2="24.5" y2="14.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/><line x1="28.5" y1="22.5" x2="28.5" y2="16.5" style="fill:none;stroke:#009688;stroke-linecap:round;stroke-linejoin:round"/></svg>
|
After Width: | Height: | Size: 1016 B |
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><rect width="50" height="50" style="fill:#e9e9e9"/><rect width="50" height="50" style="fill:#e9e9e9"/><path d="M18.5,7.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><path d="M16.5,9.5v-1a1,1,0,0,1,1-1h17a1,1,0,0,1,1,1v17a1,1,0,0,1-1,1h-1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><rect x="14.5" y="9.5" width="19" height="19" rx="1" style="fill:none;stroke:gray;stroke-linecap:round;stroke-linejoin:round"/><circle cx="24" cy="14" r="1" style="fill:#009688"/><circle cx="29" cy="19" r="1" style="fill:#009688"/><circle cx="24" cy="24" r="1" style="fill:#009688"/><circle cx="27.536" cy="15.464" r="1" style="fill:#009688"/><circle cx="20.464" cy="22.536" r="1" style="fill:#009688"/><circle cx="19" cy="19" r="1" style="fill:#009688"/><circle cx="27.536" cy="22.536" r="1" style="fill:#009688"/><circle cx="20.464" cy="15.464" r="1" style="fill:#009688"/></svg>
|
Before Width: | Height: | Size: 1.0 KiB |
@ -1160,7 +1160,7 @@ bool ImGui::ImageButtonEx2(ImGuiID id, ImTextureID texture_id, const ImVec2& siz
|
||||
const float border_size = g.Style.FrameBorderSize;
|
||||
if (border_size > 0.0f)
|
||||
{
|
||||
window->DrawList->AddRect(bb.Min + ImVec2(1, 1), bb.Max + ImVec2(1, 1), col, g.Style.FrameRounding, 0, border_size);
|
||||
//window->DrawList->AddRect(bb.Min + ImVec2(1, 1), bb.Max + ImVec2(1, 1), col, g.Style.FrameRounding, 0, border_size); // ORCA adds a secondary border without reason that causes wrong framesize
|
||||
window->DrawList->AddRect(bb.Min, bb.Max, col, g.Style.FrameRounding, 0, border_size);
|
||||
}
|
||||
|
||||
|
@ -1267,6 +1267,8 @@ void GLCanvas3D::on_change_color_mode(bool is_dark, bool reinit) {
|
||||
m_moves_slider->on_change_color_mode(is_dark);
|
||||
// Partplate
|
||||
wxGetApp().plater()->get_partplate_list().on_change_color_mode(is_dark);
|
||||
// Plates toolbar - Reload All Stats button images
|
||||
_init_select_plate_toolbar();
|
||||
|
||||
// Toolbar
|
||||
if (m_canvas_type == CanvasView3D) {
|
||||
@ -6542,8 +6544,12 @@ bool GLCanvas3D::_init_select_plate_toolbar()
|
||||
{
|
||||
std::string path = resources_dir() + "/images/";
|
||||
IMToolbarItem* item = new IMToolbarItem();
|
||||
bool result = item->image_texture.load_from_svg_file(path + "im_all_plates_stats.svg", false, false, false, 128);
|
||||
result = result && item->image_texture_transparent.load_from_svg_file(path + "im_all_plates_stats_transparent.svg", false, false, false, 128);
|
||||
// ORCA add dark mode support and load images with 2x resolution to prevent blurry image on hi-dpi screens
|
||||
std::string ext = m_is_dark ? "_dark.svg" : ".svg";
|
||||
bool result = item->image_stats.load_from_svg_file( path + "im_all_plates_stats" + ext, false, false, false, 200);
|
||||
result = result && item->image_idle.load_from_svg_file( path + "im_all_plates_idle" + ext, false, false, false, 200);
|
||||
result = result && item->image_slicing.load_from_svg_file( path + "im_all_plates_slicing" + ext, false, false, false, 200);
|
||||
result = result && item->image_failed.load_from_svg_file( path + "im_all_plates_failed" + ext, false, false, false, 200);
|
||||
m_sel_plate_toolbar.m_all_plates_stats_item = item;
|
||||
|
||||
return result;
|
||||
@ -7827,6 +7833,8 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
IMToolbarItem* all_plates_stats_item = m_sel_plate_toolbar.m_all_plates_stats_item;
|
||||
|
||||
PartPlateList& plate_list = wxGetApp().plater()->get_partplate_list();
|
||||
size_t sliced_plates_cnt = 0; // ORCA make it accesable for other conditions
|
||||
|
||||
for (int i = 0; i < plate_list.get_plate_count(); i++) {
|
||||
if (i < m_sel_plate_toolbar.m_items.size()) {
|
||||
if (i == plate_list.get_curr_plate_index() && !all_plates_stats_item->selected)
|
||||
@ -7857,7 +7865,6 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
if (m_sel_plate_toolbar.show_stats_item) {
|
||||
all_plates_stats_item->percent = 0.0f;
|
||||
|
||||
size_t sliced_plates_cnt = 0;
|
||||
for (auto plate : plate_list.get_nonempty_plate_list()) {
|
||||
if (plate->is_slice_result_valid() && plate->is_slice_result_ready_for_print())
|
||||
sliced_plates_cnt++;
|
||||
@ -7901,7 +7908,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
#if ENABLE_RETINA_GL
|
||||
float f_scale = m_retina_helper->get_scale_factor();
|
||||
#else
|
||||
float f_scale = 1.0;
|
||||
float f_scale = wxGetApp().em_unit() / 10; // ORCA add scaling support
|
||||
#endif
|
||||
Size cnv_size = get_canvas_size();
|
||||
auto canvas_w = float(cnv_size.get_width());
|
||||
@ -7930,17 +7937,22 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
window_height_max -= (128 * sc + 5);
|
||||
}
|
||||
|
||||
// ORCA simplify and correct window size and margin calculations and get values from style
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
int item_count = m_sel_plate_toolbar.m_items.size() + (m_sel_plate_toolbar.show_stats_item ? 1 : 0);
|
||||
bool show_scroll = item_count * (button_height + frame_padding * 2.0f + button_margin) - button_margin + 22.0f * f_scale > window_height_max ? true: false;
|
||||
show_scroll = m_sel_plate_toolbar.is_display_scrollbar && show_scroll;
|
||||
float window_height = std::min(item_count * (button_height + (frame_padding + margin_size) * 2.0f + button_margin) - button_margin + 28.0f * f_scale, window_height_max);
|
||||
float window_width = m_sel_plate_toolbar.icon_width + margin_size * 2 + (show_scroll ? 28.0f * f_scale : 20.0f * f_scale);
|
||||
int item_count = m_sel_plate_toolbar.m_items.size() + (m_sel_plate_toolbar.show_stats_item ? 1 : 0);
|
||||
float window_height_calc = (item_count * (button_height + (margin_size + button_margin) * 2.0f) + (item_count - 1) * ImGui::GetStyle().ItemSpacing.y + ImGui::GetStyle().WindowPadding.y * 2.0f);
|
||||
bool show_scroll = m_sel_plate_toolbar.is_display_scrollbar && (window_height_calc > window_height_max);
|
||||
float scrollbar_size = 10.0f * f_scale ;
|
||||
float window_height = std::min(window_height_calc, window_height_max);
|
||||
float window_width = button_width + (margin_size + button_margin + ImGui::GetStyle().WindowPadding.x) * 2 + (show_scroll ? scrollbar_size : 0);
|
||||
|
||||
ImVec4 window_bg = ImVec4(0.82f, 0.82f, 0.82f, 0.5f);
|
||||
ImVec4 window_bg = m_is_dark ? ImVec4(.13f, .13f, .15f, .5f) : ImVec4(1.f, 1.f, 1.f, .7f);
|
||||
ImVec4 button_active = ImGuiWrapper::COL_ORCA; // ORCA: Use orca color for selected sliced plate border
|
||||
ImVec4 button_hover = ImVec4(0.67f, 0.67f, 0.67, 1.0f);
|
||||
ImVec4 scroll_col = ImVec4(0.77f, 0.77f, 0.77f, 1.0f);
|
||||
ImVec4 button_hover = ImVec4(0.67f, 0.67f, 0.67, m_is_dark ? .6f : 1.0f);
|
||||
ImVec4 scroll_col = ImVec4(0.77f, 0.77f, 0.77f, m_is_dark ? .6f : 1.0f);
|
||||
ImU32 plate_bg = m_is_dark ? IM_COL32(255, 255, 255, 10) : IM_COL32(0, 0, 0, 10);
|
||||
ImU32 plate_dim = m_is_dark ? IM_COL32(30, 30, 30, 100) : IM_COL32(0, 0, 0, 50);
|
||||
float button_radius = 1.0f * f_scale;
|
||||
//ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.f, 0.f, 0.f, 1.0f));
|
||||
//use white text as the background switch to black
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_is_dark ? ImVec4(.9f, .9f, .9f, 1) : ImVec4(.3f, .3f, .3f, 1)); // ORCA Plate number text > Add support for dark mode
|
||||
@ -7952,12 +7964,12 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, button_active);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, button_hover);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 10.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, scrollbar_size);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, show_scroll ? (4.0f * f_scale) : (button_radius + margin_size + frame_padding + ImGui::GetStyle().WindowPadding.x));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, button_radius + margin_size);
|
||||
|
||||
imgui.set_next_window_pos(canvas_w * 0, canvas_h * 0 + y_offset, ImGuiCond_Always, 0, 0);
|
||||
imgui.set_next_window_pos(canvas_w * 0 + 5.0f * f_scale, canvas_h * 0 + y_offset, ImGuiCond_Always, 0, 0); // ORCA Add slight gap on left edge so toolbar looks like floating and it creates separation with sidebar
|
||||
imgui.set_next_window_size(window_width, window_height, ImGuiCond_Always);
|
||||
|
||||
if (show_scroll)
|
||||
@ -7966,7 +7978,7 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
imgui.begin(_L("Select Plate"), ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
|
||||
ImGui::SetWindowFontScale(1.2f);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * f_scale);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 2.0f * f_scale);
|
||||
|
||||
ImVec2 size = ImVec2(button_width, button_height); // Size of the image we want to make visible
|
||||
ImVec4 bg_col = ImVec4(128.0f, 128.0f, 128.0f, 0.0f);
|
||||
@ -7995,17 +8007,14 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
}
|
||||
}
|
||||
|
||||
ImVec4 text_clr;
|
||||
ImVec4 text_clr = m_is_dark ? ImVec4(.9f, .9f, .9f, 1) : ImVec4(.3f, .3f, .3f, 1);;
|
||||
ImTextureID btn_texture_id;
|
||||
if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::UNSLICED || all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICING || all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED)
|
||||
{
|
||||
text_clr = ImVec4(0.0f, 150.f / 255.0f, 136.0f / 255, 0.2f); // ORCA: All plates slicing NOT complete - Text color
|
||||
btn_texture_id = (ImTextureID)(intptr_t)(all_plates_stats_item->image_texture_transparent.get_id());
|
||||
}
|
||||
else
|
||||
{
|
||||
text_clr = ImGuiWrapper::COL_ORCA; // ORCA: All plates slicing complete - Text color
|
||||
btn_texture_id = (ImTextureID)(intptr_t)(all_plates_stats_item->image_texture.get_id());
|
||||
if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::UNSLICED || all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICING){
|
||||
btn_texture_id = (ImTextureID)(intptr_t)(m_process->running() ? all_plates_stats_item->image_slicing.get_id() : all_plates_stats_item->image_idle.get_id());
|
||||
} else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
|
||||
btn_texture_id = (ImTextureID)(intptr_t)(all_plates_stats_item->image_failed.get_id());
|
||||
} else {
|
||||
btn_texture_id = (ImTextureID)(intptr_t)(all_plates_stats_item->image_stats.get_id());
|
||||
}
|
||||
|
||||
if (ImGui::ImageButton2(btn_texture_id, size, {0,0}, {1,1}, frame_padding, bg_col, tint_col, margin)) {
|
||||
@ -8025,39 +8034,55 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
ImVec2 start_pos = ImVec2(button_start_pos.x + frame_padding + margin.x, button_start_pos.y + frame_padding + margin.y);
|
||||
if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::UNSLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 80));
|
||||
}
|
||||
else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICING) {
|
||||
ImVec2 size = ImVec2(button_width, button_height * all_plates_stats_item->percent / 100.0f);
|
||||
ImVec2 rect_start_pos = ImVec2(start_pos.x, start_pos.y + size.y);
|
||||
ImVec2 rect_end_pos = ImVec2(start_pos.x + button_width, start_pos.y + button_height);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, rect_end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, IM_COL32(0, 0, 0, 80));
|
||||
|
||||
// ORCA add more useful information about slicing process and use progress bar on stats button
|
||||
std::string text_top;
|
||||
std::string text_bottom;
|
||||
ImVec2 bar_size = ImVec2(size.x - margin.x * 2, 5.0f * f_scale);
|
||||
ImVec2 bar_bg_bgn = start_pos + ImVec2(margin.x, size.y - bar_size.y - margin.y);
|
||||
ImVec2 bar_bg_end = bar_bg_bgn + bar_size;
|
||||
int total_plates_cnt = plate_list.get_nonempty_plate_list().size();
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, start_pos + size, plate_bg, button_radius); // Button background
|
||||
|
||||
if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::UNSLICED || all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICING) {
|
||||
float bar_current_perc_pos = 0;
|
||||
float bar_total_perc_pos = all_plates_stats_item->percent * (bar_size.x / 100.0f);
|
||||
int current_slicing_plate = 0;
|
||||
if (m_process->running()) {
|
||||
for (int i = 0; i < total_plates_cnt; i++) {
|
||||
if (m_sel_plate_toolbar.m_items[i]->slice_state == IMToolbarItem::SliceState::SLICING) {
|
||||
current_slicing_plate = i;
|
||||
bar_current_perc_pos = m_sel_plate_toolbar.m_items[i]->percent * (bar_size.x / total_plates_cnt / 100.0f);
|
||||
}
|
||||
}
|
||||
text_top = _u8L("Slicing") + ": " + std::to_string(current_slicing_plate + 1);
|
||||
} else {
|
||||
text_top = _u8L("Slice all");
|
||||
}
|
||||
text_bottom = std::to_string(sliced_plates_cnt) + " / " + std::to_string(total_plates_cnt);
|
||||
ImVec2 bar_fg_end = ImVec2(bar_bg_bgn.x + bar_total_perc_pos + bar_current_perc_pos, bar_bg_end.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(bar_bg_bgn, bar_bg_end, IM_COL32(128, 128, 128, 255), bar_size.y); // BAR BACKGROUND
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(bar_bg_bgn, bar_fg_end, IM_COL32(0, 150, 136, 255), bar_size.y); // BAR PROGRESS
|
||||
}
|
||||
else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(40, 1, 1, 64));
|
||||
ImGui::GetWindowDrawList()->AddRect(start_pos, end_pos, IM_COL32(208, 27, 27, 255), 0.0f, 0, 1.0f);
|
||||
text_top = _u8L("Failed");
|
||||
text_bottom = std::to_string(sliced_plates_cnt) + " / " + std::to_string(total_plates_cnt);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(bar_bg_bgn, bar_bg_end, IM_COL32(225, 74, 74, 255), bar_size.y);
|
||||
}
|
||||
else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 10));
|
||||
text_top = _u8L("All Plates");
|
||||
text_bottom = _u8L("Stats");
|
||||
}
|
||||
|
||||
// draw text
|
||||
GImGui->FontSize = 15.0f;
|
||||
GImGui->FontSize = 15.0f * f_scale;
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, text_clr);
|
||||
ImVec2 text_size = ImGui::CalcTextSize(("All Plates"));
|
||||
ImVec2 text_size = ImGui::CalcTextSize(text_top.c_str());
|
||||
ImVec2 text_start_pos = ImVec2(start_pos.x + (button_width - text_size.x) / 2, start_pos.y + 3.0f * button_height / 5.0f);
|
||||
ImGui::RenderText(text_start_pos, ("All Plates"));
|
||||
text_size = ImGui::CalcTextSize(("Stats"));
|
||||
ImGui::RenderText(text_start_pos, text_top.c_str());
|
||||
text_size = ImGui::CalcTextSize(text_bottom.c_str());
|
||||
text_start_pos = ImVec2(start_pos.x + (button_width - text_size.x) / 2, text_start_pos.y + ImGui::GetTextLineHeight());
|
||||
ImGui::RenderText(text_start_pos, ("Stats"));
|
||||
ImGui::RenderText(text_start_pos, text_bottom.c_str());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::SetWindowFontScale(1.2f);
|
||||
}
|
||||
@ -8116,27 +8141,34 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||
if (item->slice_state == IMToolbarItem::SliceState::UNSLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 80));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, plate_dim, button_radius);
|
||||
} else if (item->slice_state == IMToolbarItem::SliceState::SLICING) {
|
||||
ImVec2 size = ImVec2(button_width, button_height * item->percent / 100.0f);
|
||||
ImVec2 rect_start_pos = ImVec2(start_pos.x, start_pos.y + size.y);
|
||||
ImVec2 rect_end_pos = ImVec2(start_pos.x + button_width, start_pos.y + button_height);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, rect_end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, IM_COL32(0, 0, 0, 80));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, rect_end_pos, plate_bg, button_radius);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, plate_dim, button_radius);
|
||||
} else if (item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(40, 1, 1, 64));
|
||||
ImGui::GetWindowDrawList()->AddRect(start_pos, end_pos, IM_COL32(208, 27, 27, 255), 0.0f, 0, 1.0f);
|
||||
// Draw exclamation mark that matches with icon
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + button_width, start_pos.y + button_height);
|
||||
ImVec2 center = ImVec2(start_pos.x + button_width/2, start_pos.y + button_height/2);
|
||||
auto draw_list =ImGui::GetWindowDrawList();
|
||||
auto clr = m_is_dark ? IM_COL32(60, 44, 48, 255) : IM_COL32(202, 186, 186, 255);
|
||||
draw_list->AddRectFilled(start_pos, end_pos, IM_COL32(64, 1, 1, 64), button_radius);
|
||||
draw_list->AddCircleFilled(center, 14.f * f_scale,IM_COL32(225, 74, 74, 255));
|
||||
draw_list->AddRectFilled(center - ImVec2(2.f, 10.f) * f_scale, center + ImVec2(2.f, 4.f) * f_scale, clr, 2.f * f_scale);
|
||||
draw_list->AddCircleFilled(center + ImVec2(0, 8.f * f_scale),2.f * f_scale, clr);
|
||||
} else if (item->slice_state == IMToolbarItem::SliceState::SLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, plate_bg, button_radius);
|
||||
}
|
||||
|
||||
// draw text
|
||||
ImVec2 text_start_pos = ImVec2(start_pos.x + 4.0f, start_pos.y + 2.0f); // ORCA move close to corner to prevent overlapping with preview
|
||||
GImGui->FontSize = 18.0f * f_scale; // ORCA fix font scaling
|
||||
ImVec2 text_start_pos = ImVec2(start_pos.x + 4.0f * f_scale, start_pos.y + 2.0f * f_scale); // ORCA move close to corner to prevent overlapping with preview
|
||||
ImGui::RenderText(text_start_pos, std::to_string(i + 1).c_str());
|
||||
ImGui::SetWindowFontScale(1.2f); // ORCA fix font scaling
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
@ -27,8 +27,10 @@ public:
|
||||
|
||||
bool selected{ false };
|
||||
float percent;
|
||||
GLTexture image_texture;
|
||||
GLTexture image_texture_transparent;
|
||||
GLTexture image_stats;
|
||||
GLTexture image_slicing;
|
||||
GLTexture image_idle;
|
||||
GLTexture image_failed;
|
||||
SliceState slice_state;
|
||||
|
||||
ImTextureID texture_id { 0 };
|
||||
|
@ -3876,7 +3876,8 @@ std::vector<PartPlate*> PartPlateList::get_nonempty_plate_list()
|
||||
{
|
||||
std::vector<PartPlate*> nonempty_plate_list;
|
||||
for (auto plate : m_plate_list){
|
||||
if (plate->get_extruders().size() != 0) {
|
||||
//if (plate->get_extruders().size() != 0) {
|
||||
if (!plate->empty()) { // ORCA counts failed slices as non empty because they have model and should be calculated on total count
|
||||
nonempty_plate_list.push_back(plate);
|
||||
}
|
||||
}
|
||||
|