Improved "Slice All" button in bed selector

This commit is contained in:
YuSanka 2024-12-05 16:53:04 +01:00 committed by Lukas Matena
parent fd43fb6e9b
commit 61730aa97a
5 changed files with 176 additions and 93 deletions

View File

@ -1,4 +1,26 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3 8.9375L6.45062 11.6772C6.67263 11.8535 6.99663 11.8101 7.16447 11.5817L12 5" stroke="white" stroke-linecap="round"/>
<path d="M3 8.9375L6.45062 11.6772C6.67263 11.8535 6.99663 11.8101 7.16447 11.5817L12 5" stroke="white" stroke-opacity="0.2" stroke-linecap="round"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="16.000011"
height="15.994336"
viewBox="0 0 16.000011 15.994336"
fill="none"
version="1.1"
id="svg2"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2" />
<path
d="m 1.000005,7.500005 5.3676312,7.272917 c 0.3453489,0.363651 0.8493489,0.274131 1.1104334,-0.196985 L 15.000005,1.000005"
stroke="white"
stroke-linecap="round"
id="path1"
style="stroke:#00ff00;stroke-width:2.00001;stroke-dasharray:none;stroke-opacity:1" />
<path
d="m 1.000005,7.500005 5.3676312,7.272917 c 0.3453489,0.363651 0.8493489,0.274131 1.1104334,-0.196985 L 15.000005,1.000005"
stroke="white"
stroke-opacity="0.2"
stroke-linecap="round"
id="path2"
style="stroke:#00ff00;stroke-width:2.00001;stroke-dasharray:none;stroke-opacity:1" />
</svg>

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 910 B

View File

@ -1,91 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!-- Generator: Adobe Illustrator 23.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.1"
id="Capa_1"
version="1.0"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 348.882 348.882"
style="enable-background:new 0 0 348.882 348.882;"
viewBox="0 0 15.999318 16.00075"
enable-background="new 0 0 16 16"
xml:space="preserve"
sodipodi:docname="edit_button - Copy.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
width="15.999318"
height="16.00075"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs209">
</defs><sodipodi:namedview
id="namedview207"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="2.3274346"
inkscape:cx="89.583613"
inkscape:cy="139.85355"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="3191"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1" />
<path
d="m 333.988,11.758 -0.42,-0.383 C 325.538,4.04 315.129,0 304.258,0 292.071,0 280.37,5.159 272.154,14.153 L 116.803,184.231 c -1.416,1.55 -2.49,3.379 -3.154,5.37 l -18.267,54.762 c -2.112,6.331 -1.052,13.333 2.835,18.729 3.918,5.438 10.23,8.685 16.886,8.685 0,0 0.001,0 0.001,0 2.879,0 5.693,-0.592 8.362,-1.76 l 52.89,-23.138 c 1.923,-0.841 3.648,-2.076 5.063,-3.626 L 336.771,73.176 C 352.937,55.479 351.69,27.929 333.988,11.758 Z m -203.607,222.489 10.719,-32.134 0.904,-0.99 20.316,18.556 -0.904,0.99 z M 314.621,52.943 182.553,197.53 162.237,178.974 294.305,34.386 c 2.583,-2.828 6.118,-4.386 9.954,-4.386 3.365,0 6.588,1.252 9.082,3.53 l 0.419,0.383 c 5.484,5.009 5.87,13.546 0.861,19.03 z"
id="path170"
style="fill:#ed6b21;fill-opacity:1" /><path
d="m 303.85,138.388 c -8.284,0 -15,6.716 -15,15 v 127.347 c 0,21.034 -17.113,38.147 -38.147,38.147 H 68.904 c -21.035,0 -38.147,-17.113 -38.147,-38.147 V 100.413 c 0,-21.034 17.113,-38.147 38.147,-38.147 h 131.587 c 8.284,0 15,-6.716 15,-15 0,-8.284 -6.716,-15 -15,-15 H 68.904 c -37.577,0 -68.147,30.571 -68.147,68.147 v 180.321 c 0,37.576 30.571,68.147 68.147,68.147 h 181.798 c 37.576,0 68.147,-30.571 68.147,-68.147 V 153.388 c 0.001,-8.284 -6.715,-15 -14.999,-15 z"
id="path172"
style="fill:#ed6b21;fill-opacity:1" />
id="defs2" />
<g
id="g176">
</g>
<g
id="g178">
</g>
<g
id="g180">
</g>
<g
id="g182">
</g>
<g
id="g184">
</g>
<g
id="g186">
</g>
<g
id="g188">
</g>
<g
id="g190">
</g>
<g
id="g192">
</g>
<g
id="g194">
</g>
<g
id="g196">
</g>
<g
id="g198">
</g>
<g
id="g200">
</g>
<g
id="g202">
</g>
<g
id="g204">
id="cross"
transform="matrix(1.1666174,0,0,1.1667218,-1.3332804,-1.3333997)"
style="stroke-width:0.85714">
<g
id="g1"
style="stroke-width:0.85714">
<line
fill="none"
stroke="#ed6b21"
stroke-width="1.71428"
stroke-linecap="round"
stroke-miterlimit="10"
x1="14"
y1="2"
x2="2"
y2="14"
id="line1" />
</g>
<g
id="g2"
style="stroke-width:0.85714">
<line
fill="none"
stroke="#ed6b21"
stroke-width="1.71428"
stroke-linecap="round"
stroke-miterlimit="10"
x1="2"
y1="2"
x2="14"
y2="14"
id="line2" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1,3 +1,87 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1 0 16 16">
<path d="M 2 2 L 4 4 L 6 1 M 2 7 L 4 9 L 6 6 M 2 12 L 4 14 L 6 11 M 7 12 L 9 14 L 11 11 M 12 12 L 14 14 L 16 11 M 7 7 L 9 9 L 11 6 M 12 7 L 14 9 L 16 6" stroke="#ED6B21" stroke-width="0.95" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.0"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 128 128"
enable-background="new 0 0 128 128"
xml:space="preserve"
sodipodi:docname="arrange_current.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs943" /><sodipodi:namedview
id="namedview941"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="2.8085938"
inkscape:cx="6.5869263"
inkscape:cy="71.744089"
inkscape:window-width="1916"
inkscape:window-height="1032"
inkscape:window-x="0"
inkscape:window-y="46"
inkscape:window-maximized="1"
inkscape:current-layer="arrange" />
<g
id="arrange">
<g
id="g933"
transform="translate(-16,16)">
<path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931"
sodipodi:nodetypes="sssssssssccccc" />
</g><g
id="g933-9"
transform="translate(-16,-25)"><path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931-1"
sodipodi:nodetypes="sssssssssccccc" /></g><g
id="g933-9-2"
transform="translate(-16,-66)"><path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931-1-7"
sodipodi:nodetypes="sssssssssccccc" /></g><g
id="g933-9-2-3"
transform="translate(66,-25)"><path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931-1-7-6"
sodipodi:nodetypes="sssssssssccccc" /></g><g
id="g933-9-2-0"
transform="translate(25,-25)"><path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931-1-7-9"
sodipodi:nodetypes="sssssssssccccc" /></g><g
id="g933-3"
transform="translate(25,16)"><path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931-5"
sodipodi:nodetypes="sssssssssccccc" /></g><g
id="g933-3-6"
transform="translate(66,16)"><path
fill="#ed6b21"
d="M 54,106.5 H 24 c -1.38,0 -2.5,-1.12 -2.5,-2.5 V 74 c 0,-1.38 1.12,-2.5 2.5,-2.5 h 30 c 1.38,0 2.5,1.12 2.5,2.5 v 30 c 0,1.38 -1.12,2.5 -2.5,2.5 z m -27.5,-5 h 25 v -25 h -25 z"
id="path931-5-2"
sodipodi:nodetypes="sssssssssccccc" /></g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -6604,7 +6604,7 @@ bool bed_selector_thumbnail(
) {
ImGuiWindow* window = GImGui->CurrentWindow;
const ImVec2 current_position = GImGui->CurrentWindow->DC.CursorPos;
const ImVec2 state_pos = current_position + ImVec2(border, side - 20.f - border);
const ImVec2 state_pos = current_position + ImVec2(3.f * border, side - 20.f) * wxGetApp().imgui()->get_style_scaling();
const bool clicked{ImGui::ImageButton(
(void*)(int64_t)texture_id,
@ -6628,6 +6628,21 @@ bool bed_selector_thumbnail(
return clicked;
}
bool slice_all_beds_button(bool is_active, const ImVec2 size, const ImVec2 padding)
{
ImGui::PushStyleColor(ImGuiCol_Button, ImGuiPureWrap::COL_GREY_DARK);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGuiPureWrap::COL_ORANGE_DARK);
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGuiPureWrap::COL_ORANGE_DARK);
ImGui::PushStyleColor(ImGuiCol_Border, is_active ? ImGuiPureWrap::COL_BUTTON_ACTIVE : ImGuiPureWrap::COL_GREY_DARK);
std::string slice_all_btn_name = boost::nowide::narrow(std::wstring{ ImGui::SliceAllBtnIcon });
bool clicked = ImGui::Button(slice_all_btn_name.c_str(), size + padding);
ImGui::PopStyleColor(4);
return clicked;
}
void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
{
static float btn_side = 80.f;
@ -6639,7 +6654,8 @@ void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
static std::array<std::optional<PrintStatus>, MAX_NUMBER_OF_BEDS> previous_print_status;
if (s_multiple_beds.get_number_of_beds() != 1 && wxGetApp().plater()->is_preview_shown()) {
auto render_bed_button = [btn_size, this, &extra_frame](int i)
ImVec2 btn_padding = ImVec2(btn_border, btn_border);
auto render_bed_button = [btn_size, btn_padding, this, &extra_frame](int i)
{
bool empty = ! s_multiple_beds.is_bed_occupied(i);
bool inactive = i != s_multiple_beds.get_active_bed() || s_multiple_beds.is_autoslicing();
@ -6651,7 +6667,6 @@ void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
bool clicked = false;
ImVec2 btn_padding = ImVec2(btn_border, btn_border);
PrintStatus print_status{PrintStatus::idle};
if (wxGetApp().plater()->get_fff_prints()[i]->finished()) {
@ -6714,8 +6729,9 @@ void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2());
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2());
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, btn_border);
if (imgui.image_button(ImGui::SliceAllBtnIcon, "Slice All")) {
if (slice_all_beds_button(s_multiple_beds.is_autoslicing(), btn_size, btn_padding)) {
if (!s_multiple_beds.is_autoslicing()) {
s_multiple_beds.start_autoslice([this](int i, bool user) { this->select_bed(i, user); });
wxGetApp().sidebar().switch_to_autoslicing_mode();
@ -6725,8 +6741,6 @@ void Slic3r::GUI::GLCanvas3D::_render_bed_selector()
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, btn_border);
int beds_num = s_multiple_beds.get_number_of_beds();
for (int i = 0; i < beds_num; ++i) {

View File

@ -112,7 +112,6 @@ static const std::map<const wchar_t, std::string> font_icons = {
{ImGui::SnapMarker , "snap" },
{ImGui::HorizontalHide , "horizontal_hide" },
{ImGui::HorizontalShow , "horizontal_show" },
{ImGui::SliceAllBtnIcon , "slice_all" },
{ImGui::PrintIdle , "print_idle" },
{ImGui::PrintRunning , "print_running" },
{ImGui::PrintFinished , "print_finished" },
@ -155,6 +154,7 @@ static const std::map<const wchar_t, std::string> font_icons_large = {
{ImGui::OpenHoverButton , "notification_open_hover" },
{ImGui::SlaViewOriginal , "sla_view_original" },
{ImGui::SlaViewProcessed , "sla_view_processed" },
{ImGui::SliceAllBtnIcon , "slice_all" },
};
static const std::map<const wchar_t, std::string> font_icons_medium = {