diff --git a/resources/images/big_bed_cool.png b/resources/images/big_bed_cool.png new file mode 100644 index 000000000..87f292263 Binary files /dev/null and b/resources/images/big_bed_cool.png differ diff --git a/resources/images/big_bed_cool_supertack.png b/resources/images/big_bed_cool_supertack.png new file mode 100644 index 000000000..07f05200c Binary files /dev/null and b/resources/images/big_bed_cool_supertack.png differ diff --git a/resources/images/big_bed_engineering.png b/resources/images/big_bed_engineering.png new file mode 100644 index 000000000..f7d53c658 Binary files /dev/null and b/resources/images/big_bed_engineering.png differ diff --git a/resources/images/big_bed_high_templ.png b/resources/images/big_bed_high_templ.png new file mode 100644 index 000000000..edcf8004a Binary files /dev/null and b/resources/images/big_bed_high_templ.png differ diff --git a/resources/images/big_bed_pei.png b/resources/images/big_bed_pei.png new file mode 100644 index 000000000..e1501a1ab Binary files /dev/null and b/resources/images/big_bed_pei.png differ diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index deb17cfd6..017b2e11c 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -174,6 +174,8 @@ set(SLIC3R_GUI_SOURCES GUI/IMToolbar.cpp GUI/GCodeViewer.hpp GUI/GCodeViewer.cpp + GUI/ImageDPIFrame.cpp + GUI/ImageDPIFrame.hpp GUI/Preferences.cpp GUI/Preferences.hpp GUI/AMSSetting.cpp diff --git a/src/slic3r/GUI/ImageDPIFrame.cpp b/src/slic3r/GUI/ImageDPIFrame.cpp new file mode 100644 index 000000000..0dd781fae --- /dev/null +++ b/src/slic3r/GUI/ImageDPIFrame.cpp @@ -0,0 +1,85 @@ +#include "ImageDPIFrame.hpp" + +#include +#include +#include +#include +#include "GUI_App.hpp" +#include "Tab.hpp" +#include "PartPlate.hpp" +#include "I18N.hpp" +#include "MainFrame.hpp" +#include +#include "wxExtensions.hpp" + +using namespace Slic3r; +using namespace Slic3r::GUI; + +namespace Slic3r { namespace GUI { +#define ANIMATION_REFRESH_INTERVAL 20 +ImageDPIFrame::ImageDPIFrame() + : DPIFrame(static_cast(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE) +{ + m_image_px = 260; + int width = 270; + //SetTransparent(0); + SetMinSize(wxSize(FromDIP(width), -1)); + SetMaxSize(wxSize(FromDIP(width), -1)); + + m_sizer_main = new wxBoxSizer(wxVERTICAL); + auto image_sizer = new wxBoxSizer(wxVERTICAL); + auto imgsize = FromDIP(width); + m_bitmap = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("printer_preview_C13", this, m_image_px), wxDefaultPosition, wxSize(imgsize, imgsize * 0.94), 0); + image_sizer->Add(m_bitmap, 0, wxALIGN_CENTER | wxALL, FromDIP(0)); + + m_sizer_main->Add(image_sizer, FromDIP(0), wxALIGN_CENTER, FromDIP(0)); + + Bind(wxEVT_CLOSE_WINDOW, [this](auto &e) { + on_hide(); + }); + SetSizer(m_sizer_main); + Layout(); + Fit(); +} + +ImageDPIFrame::~ImageDPIFrame() { + +} + +bool ImageDPIFrame::Show(bool show) +{ + Layout(); + return DPIFrame::Show(show); +} + +void ImageDPIFrame::set_bitmap(const wxBitmap &bit_map) { + m_bitmap->SetBitmap(bit_map); +} + +void ImageDPIFrame::on_dpi_changed(const wxRect &suggested_rect) +{ + // m_image->Rescale(); + //m_bitmap->Rescale(); +} + +void ImageDPIFrame::on_show() { + if (IsShown()) { + on_hide(); + } + Show(); + Raise(); +} + +void ImageDPIFrame::on_hide() +{ + if (IsShown()) { + Hide(); + if (wxGetApp().mainframe != nullptr) { + wxGetApp().mainframe->Show(); + wxGetApp().mainframe->Raise(); + } + } +} + +} // namespace GUI +} // namespace Slic3r \ No newline at end of file diff --git a/src/slic3r/GUI/ImageDPIFrame.hpp b/src/slic3r/GUI/ImageDPIFrame.hpp new file mode 100644 index 000000000..b2b9d02f6 --- /dev/null +++ b/src/slic3r/GUI/ImageDPIFrame.hpp @@ -0,0 +1,28 @@ +#ifndef _ImageDPIFrame_H_ +#define _ImageDPIFrame_H_ + +#include "GUI_App.hpp" +#include "GUI_Utils.hpp" + +class wxStaticBitmap; +namespace Slic3r { namespace GUI { +class ImageDPIFrame : public Slic3r::GUI::DPIFrame +{ +public: + ImageDPIFrame(); + ~ImageDPIFrame() override; + void on_dpi_changed(const wxRect &suggested_rect) override; + void on_show(); + void on_hide(); + bool Show(bool show = true) override; + + void set_bitmap(const wxBitmap& bit_map); + int get_image_px() { return m_image_px; } + +private: + wxStaticBitmap *m_bitmap = nullptr; + wxBoxSizer *m_sizer_main{nullptr}; + int m_image_px; +}; +}} // namespace Slic3r::GUI +#endif // _STEP_MESH_DIALOG_H_ diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e5b413cd5..a8bfb5b8c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -116,6 +116,7 @@ #include "BBLStatusBar.hpp" #include "BitmapCache.hpp" #include "ParamsDialog.hpp" +#include "ImageDPIFrame.hpp" #include "Widgets/Label.hpp" #include "Widgets/RoundedRectangle.hpp" #include "Widgets/RadioBox.hpp" @@ -414,6 +415,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 counter_sync_printer = std::make_shared(); @@ -1557,6 +1560,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); @@ -1573,9 +1577,20 @@ Sidebar::Sidebar(Plater *parent) auto select_bed_type = get_cur_select_bed_type(); bool isDual = static_cast(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);