ENH: add tip link for filament group in viewer

1.Also update wiki

jira:STUDIO-9944

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Iaa282054da40b6936dc6c741fe7ef7ca62f868f2
(cherry picked from commit caa51852afcaa207d4204b420612524cb0f7017a)
This commit is contained in:
xun.zhang 2025-01-18 21:29:26 +08:00 committed by Noisyfox
parent c9f2d88cf5
commit 606d28dc26
15 changed files with 2372 additions and 596 deletions

View file

@ -4444,6 +4444,29 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
}
};
auto link_filament_group_wiki = [&](const std::string& label) {
ImVec2 wiki_part_size = ImGui::CalcTextSize(label.c_str());
ImColor HyperColor = ImColor(0, 174, 66, 255).Value;
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
imgui.text(label.c_str());
ImGui::PopStyleColor();
// underline
ImVec2 lineEnd = ImGui::GetItemRectMax();
lineEnd.y -= 2.0f;
ImVec2 lineStart = lineEnd;
lineStart.x = ImGui::GetItemRectMin().x;
ImGui::GetWindowDrawList()->AddLine(lineStart, lineEnd, HyperColor);
// click behavior
if (ImGui::IsMouseHoveringRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), true)) {
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
std::string wiki_path = Slic3r::resources_dir() + "/wiki/filament_group_wiki_zh.html";
wxLaunchDefaultBrowser(wxString(wiki_path.c_str()));
}
}
};
auto draw_dash_line = [&](ImDrawList* draw_list, int dash_length = 5, int gap_length = 3) {
ImVec2 p1 = ImGui::GetCursorScreenPos();
ImVec2 p2 = ImVec2(p1.x + ImGui::GetContentRegionAvail().x, p1.y);
@ -4580,6 +4603,11 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
ImGui::SameLine();
}
link_text(_u8L("Regroup filament"));
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetWindowContentRegionWidth() - window_padding - ImGui::CalcTextSize("Tips").x);
link_filament_group_wiki(_u8L("Tips"));
ImGui::EndChild();
}
ImGui::PopStyleColor(2);