mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 00:26:01 +08:00
DPIDialog as base class WebViewDialog.
This commit is contained in:
parent
c29e70d429
commit
1689918a3e
@ -820,7 +820,7 @@ void PrinterWebViewPanel::sys_color_changed()
|
||||
}
|
||||
|
||||
WebViewDialog::WebViewDialog(wxWindow* parent, const wxString& url, const wxString& dialog_name, const wxSize& size, const std::vector<std::string>& message_handler_names, const std::string& loading_html/* = "loading"*/)
|
||||
: wxDialog(parent, wxID_ANY, dialog_name, wxDefaultPosition, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
: DPIDialog(parent, wxID_ANY, dialog_name, wxDefaultPosition, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
, m_loading_html(loading_html)
|
||||
, m_script_message_hadler_names (message_handler_names)
|
||||
{
|
||||
@ -1313,6 +1313,18 @@ void PrinterPickWebViewDialog::request_compatible_printers_SLA()
|
||||
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
||||
run_script(script);
|
||||
}
|
||||
void PrinterPickWebViewDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
{
|
||||
wxWindow *parent = GetParent();
|
||||
const wxSize &size = wxSize(
|
||||
std::max(parent->GetClientSize().x / 2, 100 * wxGetApp().em_unit()),
|
||||
std::max(parent->GetClientSize().y / 2, 50 * wxGetApp().em_unit())
|
||||
);
|
||||
SetMinSize(size);
|
||||
Fit();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
LoginWebViewDialog::LoginWebViewDialog(wxWindow *parent, std::string &ret_val, const wxString& url)
|
||||
: WebViewDialog(parent
|
||||
, url
|
||||
@ -1332,6 +1344,13 @@ void LoginWebViewDialog::on_navigation_request(wxWebViewEvent &evt)
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
}
|
||||
void LoginWebViewDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
{
|
||||
const wxSize &size = wxSize(50 * wxGetApp().em_unit(), 80 * wxGetApp().em_unit());
|
||||
SetMinSize(size);
|
||||
Fit();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
LogoutWebViewDialog::LogoutWebViewDialog(wxWindow *parent)
|
||||
: WebViewDialog(parent
|
||||
@ -1342,6 +1361,7 @@ LogoutWebViewDialog::LogoutWebViewDialog(wxWindow *parent)
|
||||
{
|
||||
Centre();
|
||||
}
|
||||
|
||||
void LogoutWebViewDialog::on_loaded(wxWebViewEvent &evt)
|
||||
{
|
||||
EndModal(wxID_OK);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <wx/wx.h>
|
||||
#include <wx/event.h>
|
||||
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "UserAccountSession.hpp"
|
||||
|
||||
#ifdef DEBUG_URL_PANEL
|
||||
@ -102,7 +103,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class WebViewDialog : public wxDialog
|
||||
class WebViewDialog : public DPIDialog
|
||||
{
|
||||
public:
|
||||
WebViewDialog(wxWindow* parent, const wxString& url, const wxString& dialog_name, const wxSize& size, const std::vector<std::string>& message_handler_names, const std::string& loading_html = "loading");
|
||||
@ -247,6 +248,7 @@ protected:
|
||||
void request_compatible_printers_FFF();
|
||||
void request_compatible_printers_SLA();
|
||||
void run_script_bridge(const wxString& script) override { run_script(script); }
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
private:
|
||||
std::string& m_ret_val;
|
||||
@ -263,6 +265,7 @@ class LoginWebViewDialog : public WebViewDialog
|
||||
public:
|
||||
LoginWebViewDialog(wxWindow *parent, std::string &ret_val, const wxString& url);
|
||||
void on_navigation_request(wxWebViewEvent &evt) override;
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
private:
|
||||
std::string &m_ret_val;
|
||||
@ -273,6 +276,7 @@ class LogoutWebViewDialog : public WebViewDialog
|
||||
public:
|
||||
LogoutWebViewDialog(wxWindow* parent);
|
||||
void on_loaded(wxWebViewEvent &evt) override;
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override {}
|
||||
};
|
||||
|
||||
} // GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user