ENH:Optimize the gcode viewer and STEP mesh UI

jira: nojira
Change-Id: Ie8d4f1eace04b2c51d4975c67b9a4deb7d88a56f
This commit is contained in:
Mack 2024-12-23 15:12:34 +08:00 committed by lane.wei
parent b391241a0b
commit b9aa039760
2 changed files with 19 additions and 19 deletions

View File

@ -4609,20 +4609,19 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
auto link_text = [&](const std::string &label) {
ImVec2 wiki_part_size = ImGui::CalcTextSize(label.c_str());
ImColor HyperColor = ImColor(48, 221, 114, 255).Value;
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)) {
// underline
ImVec2 lineEnd = ImGui::GetItemRectMax();
lineEnd.y -= 2.0f;
ImVec2 lineStart = lineEnd;
lineStart.x = ImGui::GetItemRectMin().x;
ImGui::GetWindowDrawList()->AddLine(lineStart, lineEnd, HyperColor);
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
Plater *plater = wxGetApp().plater();
wxCommandEvent evt(EVT_OPEN_FILAMENT_MAP_SETTINGS_DIALOG);
@ -4636,20 +4635,18 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
auto link_text_set_to_optional = [&](const std::string &label) {
ImVec2 wiki_part_size = ImGui::CalcTextSize(label.c_str());
ImColor HyperColor = ImColor(48, 221, 114, 255).Value;
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)) {
// underline
ImVec2 lineEnd = ImGui::GetItemRectMax();
lineEnd.y -= 2.0f;
ImVec2 lineStart = lineEnd;
lineStart.x = ImGui::GetItemRectMin().x;
ImGui::GetWindowDrawList()->AddLine(lineStart, lineEnd, HyperColor);
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
MessageDialog msg_dlg(nullptr, _L("Automatically re-slice according to the optimal filament arrangement, and the arrangement results will be displayed after slicing."), wxEmptyString, wxOK | wxCANCEL);
if (msg_dlg.ShowModal() == wxID_OK) {
@ -4779,6 +4776,8 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
if (!is_optimal_group) {
link_text_set_to_optional(_u8L("Set to Optimal"));
ImGui::SameLine();
ImGui::Dummy({window_padding, window_padding});
ImGui::SameLine();
}
link_text(_u8L("Rearrange filament"));

View File

@ -117,9 +117,10 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line
wxBoxSizer* tips_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText* info = new wxStaticText(this, wxID_ANY, _L("Smaller linear and angular deflections result in higher-quality transformations but increase the processing time."));
wxStaticText *tips = new wxStaticText(this, wxID_ANY, _L("See BambuLab Wiki"));
wxStaticText *tips = new wxStaticText(this, wxID_ANY, _L("View Wiki for more information"));
wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false);
font.SetUnderlined(true);
tips->SetForegroundColour(wxColour(0, 174, 66));
tips->SetFont(font);
tips->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/software/bambu-studio/step");