mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-22 04:22:20 -07:00
ENH:show big bed image
jira: none Change-Id: Iaf3529345f688f2dbdc35c16f45253a5b65feb84 (cherry picked from commit 5e2861acca8d86d6e7012f73d3f739877eb05069)
This commit is contained in:
parent
ec8bcc22d3
commit
87f540b1e5
9 changed files with 130 additions and 0 deletions
85
src/slic3r/GUI/ImageDPIFrame.cpp
Normal file
85
src/slic3r/GUI/ImageDPIFrame.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#include "ImageDPIFrame.hpp"
|
||||
|
||||
#include <wx/event.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include "GUI_App.hpp"
|
||||
#include "Tab.hpp"
|
||||
#include "PartPlate.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include <chrono>
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
#define ANIMATION_REFRESH_INTERVAL 20
|
||||
ImageDPIFrame::ImageDPIFrame()
|
||||
: DPIFrame(static_cast<wxWindow *>(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
|
||||
Loading…
Add table
Add a link
Reference in a new issue