ENH:show big bed image

jira: none
Change-Id: Iaf3529345f688f2dbdc35c16f45253a5b65feb84
(cherry picked from commit 5e2861acca8d86d6e7012f73d3f739877eb05069)
This commit is contained in:
zhou.xu
2025-02-06 09:32:06 +08:00
committed by Noisyfox
parent ec8bcc22d3
commit 87f540b1e5
9 changed files with 130 additions and 0 deletions

View File

@@ -125,6 +125,7 @@
#include "BBLStatusBar.hpp"
#include "BitmapCache.hpp"
#include "ParamsDialog.hpp"
#include "ImageDPIFrame.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Widgets/RadioGroup.hpp"
@@ -413,6 +414,8 @@ struct Sidebar::priv
StaticBox * panel_printer_bed = nullptr;
wxStaticBitmap *image_printer_bed = nullptr;
ComboBox * combo_printer_bed = nullptr;
ImageDPIFrame *big_bed_image_popup = nullptr;
// Printer - sync
Button *btn_sync_printer;
std::shared_ptr<int> counter_sync_printer = std::make_shared<int>();
@@ -1517,6 +1520,7 @@ Sidebar::Sidebar(Plater *parent)
wiki_bed->Bind(wxEVT_BUTTON, [](wxCommandEvent) {
wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/x1/manual/compatibility-and-parameter-settings-of-filaments");
});
p->big_bed_image_popup = new ImageDPIFrame();
ScalableBitmap bitmap_bed(p->panel_printer_bed, "printer_placeholder", 32);
p->image_printer_bed = new wxStaticBitmap(p->panel_printer_bed, wxID_ANY, bitmap_bed.bmp(), wxDefaultPosition, wxDefaultSize, 0);
@@ -1533,9 +1537,20 @@ Sidebar::Sidebar(Plater *parent)
auto select_bed_type = get_cur_select_bed_type();
bool isDual = static_cast<wxBoxSizer *>(p->panel_printer_preset->GetSizer())->GetOrientation() == wxVERTICAL;
p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[select_bed_type], this, isDual ? 48 : 32));
p->big_bed_image_popup->set_bitmap(create_scaled_bitmap("big_" + bed_type_thumbnails[select_bed_type], p->big_bed_image_popup, p->big_bed_image_popup->get_image_px()));
e.Skip(); // fix bug:Event spreads to sidebar
});
p->image_printer_bed->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent &evt) {
auto pos = p->image_printer_bed->GetScreenPosition();
auto rect = p->image_printer_bed->GetRect();
wxPoint temp_pos(pos.x + rect.GetWidth(), pos.y);
p->big_bed_image_popup->SetCanFocus(false);
p->big_bed_image_popup->SetPosition(temp_pos);
p->big_bed_image_popup->on_show();
});
p->image_printer_bed->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent &evt) { p->big_bed_image_popup->on_hide(); });
wxBoxSizer *bed_type_sizer = new wxBoxSizer(wxVERTICAL);
bed_type_sizer->AddStretchSpacer(1);
wxBoxSizer *bed_type_hsizer = new wxBoxSizer(wxHORIZONTAL);