OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::WebDialog Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/WebDialog.hpp>

Inheritance diagram for Slic3r::GUI::WebDialog:
Collaboration diagram for Slic3r::GUI::WebDialog:

Public Types

using MessageHandler = std::function<void(const nlohmann::json& data)>
using SubmitHandler = std::function<void(const nlohmann::json& data)>
using CloseHandler = std::function<void()>

Public Member Functions

 WebDialog (wxWindow *parent, const wxString &title, const std::string &html, const wxSize &size, MessageHandler on_message, SubmitHandler on_submit, CloseHandler on_close, CloseHandler on_destroyed, long wx_style=wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER)
 ~WebDialog () override
void push_message (const nlohmann::json &data)
bool is_open () const
void use_normal_window_type ()
const std::optional< nlohmann::json > & result () const
bool create_webview (const std::string &resource_path, const wxString &title, const wxSize &dialog_size=wxSize(820, 660), const wxSize &min_size=wxSize(640, 640))
void load_url (const wxString &url)
bool run_script (const wxString &script)
void call_web_handler (const nlohmann::json &payload, const wxString &handler=wxT("HandleStudio"))
void EndModal (int retCode) override
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Static Public Member Functions

static void post_message (WebDialog *dialog, const nlohmann::json &data)
static void request_close (WebDialog *dialog)
static void destroy_silently (WebDialog *dialog)
static std::string document_start_injector (const std::string &markup, const char *dom_id, const char *position, const std::string &prelude={}, const std::string &on_inject={})
static std::string theme_user_script ()
static std::string element_defaults_user_script ()
static std::string theme_apply_script ()
static std::string localized_strings_script (const nlohmann::json &strings)

Protected Member Functions

void on_script_message (const nlohmann::json &payload) override
bool append_language_to_url () const override
void add_user_scripts () override
wxWebView * browser () const
wxString build_resource_url (const std::string &resource_path) const
bool handle_common_script_command (const nlohmann::json &payload, int close_return_code=wxID_CANCEL)
void on_dpi_changed (const wxRect &suggested_rect) override
virtual void on_script_message_parse_error (const wxString &payload, const std::exception &error)
void register_theme_user_scripts ()
virtual nlohmann::json localized_strings () const
void apply_theme_live ()
virtual void on_sys_color_changed ()

Private Member Functions

void on_bootstrap_event (wxWebViewEvent &event)
void on_navigated (wxWebViewEvent &event)
void load_page_html ()
void on_close_window (wxCloseEvent &event)
void fire_submit (const nlohmann::json &data)
void fire_close ()
void finish (bool submitted, const nlohmann::json &data)
void on_script_message_event (wxWebViewEvent &event)
void on_webview_recreated (wxCommandEvent &event)
void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

std::string m_html
bool m_content_loaded {false}
bool m_own_page_load {false}
bool m_content_navigated {false}
bool m_open {true}
bool m_close_fired {false}
std::optional< nlohmann::json > m_result
MessageHandler m_on_message
SubmitHandler m_on_submit
CloseHandler m_on_close
CloseHandler m_on_destroyed
wxWebView * m_browser {nullptr}
float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Detailed Description

Member Typedef Documentation

◆ CloseHandler

using Slic3r::GUI::WebDialog::CloseHandler = std::function<void()>

◆ MessageHandler

using Slic3r::GUI::WebDialog::MessageHandler = std::function<void(const nlohmann::json& data)>

◆ SubmitHandler

using Slic3r::GUI::WebDialog::SubmitHandler = std::function<void(const nlohmann::json& data)>

Constructor & Destructor Documentation

◆ WebDialog()

Slic3r::GUI::WebDialog::WebDialog ( wxWindow * parent,
const wxString & title,
const std::string & html,
const wxSize & size,
MessageHandler on_message,
SubmitHandler on_submit,
CloseHandler on_close,
CloseHandler on_destroyed,
long wx_style = wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER )
32 : WebViewHostDialog(parent, wxID_ANY, title, wxDefaultPosition, size, wx_style)
33 , m_html(html)
34 , m_on_message(std::move(on_message))
35 , m_on_submit(std::move(on_submit))
36 , m_on_close(std::move(on_close))
37 , m_on_destroyed(std::move(on_destroyed))
38{
39 // A tiny bundled bootstrap page brings the webview up; the real plugin HTML
40 // is swapped in via SetPage once the bootstrap finishes loading.
41 create_webview(web_hosting::BOOTSTRAP_PAGE, title, size, wxSize(320, 240));
42
43 // Paint the window/webview in the themed background so there is no white
44 // flash before the (transparent) bootstrap page and plugin HTML render.
45 SetBackgroundColour(wxGetApp().get_window_default_clr());
46
47 if (wxWebView* wv = browser()) {
48 wv->SetBackgroundColour(wxGetApp().get_window_default_clr());
49 // Theme contract + plugin defaults + bridge are registered by the base
50 // create_webview() via add_user_scripts(); nothing to add here.
51 // Swap in the plugin HTML once the bootstrap page settles. Bind ERROR too so a
52 // missing/blocked bootstrap resource (e.g. a packaged build) still triggers it.
53 Bind(wxEVT_WEBVIEW_LOADED, &WebDialog::on_bootstrap_event, this, wv->GetId());
54 Bind(wxEVT_WEBVIEW_ERROR, &WebDialog::on_bootstrap_event, this, wv->GetId());
55 Bind(wxEVT_WEBVIEW_NAVIGATED, &WebDialog::on_navigated, this, wv->GetId());
56 }
57 Bind(wxEVT_CLOSE_WINDOW, &WebDialog::on_close_window, this);
58}
CloseHandler m_on_destroyed
Definition WebDialog.hpp:97
void on_navigated(wxWebViewEvent &event)
Definition WebDialog.cpp:135
CloseHandler m_on_close
Definition WebDialog.hpp:96
SubmitHandler m_on_submit
Definition WebDialog.hpp:95
void on_close_window(wxCloseEvent &event)
Definition WebDialog.cpp:198
MessageHandler m_on_message
Definition WebDialog.hpp:94
void on_bootstrap_event(wxWebViewEvent &event)
Definition WebDialog.cpp:115
std::string m_html
Definition WebDialog.hpp:87
wxWebView * browser() const
Definition WebViewHostDialog.hpp:75
WebViewHostDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT(""), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER)
Definition WebViewHostDialog.cpp:161
bool create_webview(const std::string &resource_path, const wxString &title, const wxSize &dialog_size=wxSize(820, 660), const wxSize &min_size=wxSize(640, 640))
Definition WebViewHostDialog.cpp:172
constexpr const char * BOOTSTRAP_PAGE
Definition WebHosting.hpp:10

References Slic3r::GUI::WebViewHostDialog::WebViewHostDialog(), Slic3r::GUI::web_hosting::BOOTSTRAP_PAGE, Slic3r::GUI::WebViewHostDialog::browser(), Slic3r::GUI::WebViewHostDialog::create_webview(), m_html, m_on_close, m_on_destroyed, m_on_message, m_on_submit, on_bootstrap_event(), on_close_window(), and on_navigated().

Referenced by destroy_silently(), post_message(), and request_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~WebDialog()

Slic3r::GUI::WebDialog::~WebDialog ( )
override
80{
81 // Runs on every destruction path. Deliberately NOT a wxEVT_DESTROY handler:
82 // that event is sent from the base ~wxDialog(), after this subclass's members
83 // are already destroyed. Here the members are still alive, and the callback
84 // only touches the host-side registry (no Python), so this is safe.
87}

References m_on_destroyed.

Member Function Documentation

◆ add_user_scripts()

void Slic3r::GUI::WebDialog::add_user_scripts ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::WebViewHostDialog.

72{
73 if (wxWebView* wv = browser()) {
74 wv->AddUserScript(wxString::FromUTF8(WebViewHostDialog::element_defaults_user_script()));
75 wv->AddUserScript(wxString::FromUTF8(web_hosting::orca_bridge_script()));
76 }
77}
static std::string element_defaults_user_script()
Definition WebViewHostDialog.cpp:102
const char * orca_bridge_script()
Definition WebHosting.cpp:67

References Slic3r::GUI::WebViewHostDialog::browser(), Slic3r::GUI::WebViewHostDialog::element_defaults_user_script(), and Slic3r::GUI::web_hosting::orca_bridge_script().

Here is the call graph for this function:

◆ append_language_to_url()

bool Slic3r::GUI::WebDialog::append_language_to_url ( ) const
inlineoverrideprotectedvirtual

Reimplemented from Slic3r::GUI::WebViewHostDialog.

75{ return false; }

◆ apply_theme_live()

void Slic3r::GUI::WebViewHostDialog::apply_theme_live ( )
protectedinherited
300{
301 if (!m_browser)
302 return;
303 // Update the already-loaded document in place (no reload, no flash) by rewriting the
304 // injected :root variables + data-orca-theme; the whole cascade re-flows from these.
305 // The document-start script keeps the creation-time theme for any later reload, and
306 // these dialogs are not reloaded on a theme toggle (see WebView::RecreateAll).
307 run_script(wxString::FromUTF8(host_theme_apply_js()));
308}
bool run_script(const wxString &script)
Definition WebViewHostDialog.cpp:234
wxWebView * m_browser
Definition WebViewHostDialog.hpp:109
std::string host_theme_apply_js()
Definition WebViewHostDialog.cpp:73

References m_browser, and run_script().

Referenced by on_webview_recreated().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser()

◆ build_resource_url()

wxString Slic3r::GUI::WebViewHostDialog::build_resource_url ( const std::string & resource_path) const
protectedinherited
210{
211 wxString target_url = file_url_from_path(boost::filesystem::path(resources_dir()) / resource_path);
212
214 const wxString lang = wxGetApp().current_language_code_safe();
215 if (!lang.empty()) {
216 target_url += wxT("?lang=");
217 target_url += lang;
218 }
219 }
220
221 return target_url;
222}
virtual bool append_language_to_url() const
Definition WebViewHostDialog.hpp:84
wxString file_url_from_path(const boost::filesystem::path &path)
Definition GUI.cpp:569
const std::string & resources_dir()
Definition utils.cpp:296

References append_language_to_url(), Slic3r::GUI::file_url_from_path(), and Slic3r::resources_dir().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call_web_handler()

void Slic3r::GUI::WebViewHostDialog::call_web_handler ( const nlohmann::json & payload,
const wxString & handler = wxT("HandleStudio") )
inherited
243{
244 const wxString payload_text = wxString::FromUTF8(payload.dump(-1, ' ', false, nlohmann::json::error_handler_t::ignore));
245 const wxString script = handler + wxT("(") + payload_text + wxT(")");
246
247 wxGetApp().CallAfter([this, script] { run_script(script); });
248}

References run_script().

Referenced by Slic3r::GUI::SpeedDialWebDialog::handle_web_command(), Slic3r::GUI::PresetBundleDialog::ListBundles(), Slic3r::GUI::ExportPresetBundleDialog::OnRequestPresets(), Slic3r::GUI::WebDialog::push_message(), Slic3r::GUI::TerminalDialog::resolve_and_run(), Slic3r::GUI::PluginsDialog::restore_capability_config(), Slic3r::GUI::PluginsDialog::save_capability_config(), Slic3r::GUI::SpeedDialWebDialog::search_tabs(), Slic3r::GUI::SpeedDialWebDialog::send_actions(), Slic3r::GUI::PluginsConfigDialog::send_capabilities(), Slic3r::GUI::PluginsConfigDialog::send_capability_config(), Slic3r::GUI::PluginsDialog::send_capability_config(), Slic3r::GUI::PluginsDialog::send_plugins(), Slic3r::GUI::PluginsConfigDialog::send_save_error(), Slic3r::GUI::PluginsConfigDialog::show_status(), and Slic3r::GUI::PluginsDialog::show_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_webview()

bool Slic3r::GUI::WebViewHostDialog::create_webview ( const std::string & resource_path,
const wxString & title,
const wxSize & dialog_size = wxSize(820, 660),
const wxSize & min_size = wxSize(640, 640) )
inherited
176{
177 SetTitle(title);
178 SetMinSize(FromDIP(min_size));
179
180 const wxString target_url = build_resource_url(resource_path);
181 wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
182
183 // Created empty and loaded below, after the user scripts are added, so the first load already has them.
184 m_browser = WebView::CreateWebView(this, wxEmptyString);
185 if (m_browser == nullptr) {
186 wxLogError("Could not init m_browser");
187 delete topsizer;
188 return false;
189 }
190
191 SetSizer(topsizer);
192 topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
193
194 SetSize(FromDIP(dialog_size));
195 CenterOnParent();
196
197 Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, &WebViewHostDialog::on_script_message_event, this, m_browser->GetId());
198
199 // Inject the shared host theme contract BEFORE the first load so the page paints in
200 // the app theme with no flash, and re-theme live when the app theme toggles.
202 m_browser->Bind(EVT_WEBVIEW_RECREATED, &WebViewHostDialog::on_webview_recreated, this);
203
204 load_url(target_url);
205 wxGetApp().UpdateDlgDarkUI(this);
206 return true;
207}
void on_webview_recreated(wxCommandEvent &event)
Definition WebViewHostDialog.cpp:310
wxString build_resource_url(const std::string &resource_path) const
Definition WebViewHostDialog.cpp:209
void register_theme_user_scripts()
Definition WebViewHostDialog.cpp:285
void on_script_message_event(wxWebViewEvent &event)
Definition WebViewHostDialog.cpp:274
void load_url(const wxString &url)
Definition WebViewHostDialog.cpp:224
static wxWebView * CreateWebView(wxWindow *parent, wxString const &url)
Definition WebView.cpp:313

References build_resource_url(), WebView::CreateWebView(), load_url(), m_browser, on_script_message_event(), on_webview_recreated(), and register_theme_user_scripts().

Referenced by Slic3r::GUI::ColorPickerDialog::ColorPickerDialog(), Slic3r::GUI::PluginsConfigDialog::PluginsConfigDialog(), Slic3r::GUI::PluginsDialog::PluginsDialog(), Slic3r::GUI::SpeedDialWebDialog::SpeedDialWebDialog(), Slic3r::GUI::TerminalDialog::TerminalDialog(), Slic3r::GUI::WebDialog::WebDialog(), Slic3r::GUI::PresetBundleDialog::create(), and Slic3r::GUI::ExportPresetBundleDialog::Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy_silently()

void Slic3r::GUI::WebDialog::destroy_silently ( WebDialog * dialog)
static
102{
103 if (dialog == nullptr)
104 return;
105
106 // Forced plugin teardown must not invoke Python close callbacks. End a modal
107 // loop first, otherwise destroying the window can leave ShowModal() running.
108 if (dialog->IsModal()) {
109 dialog->m_open = false;
110 dialog->EndModal(wxID_CANCEL);
111 }
112 dialog->Destroy();
113}

References WebDialog(), Slic3r::GUI::DPIDialog::EndModal(), and m_open.

Referenced by Slic3r::PluginHostUi::close_windows_for_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ document_start_injector()

std::string Slic3r::GUI::WebViewHostDialog::document_start_injector ( const std::string & markup,
const char * dom_id,
const char * position,
const std::string & prelude = {},
const std::string & on_inject = {} )
staticinherited
135{
136 const std::string literal = nlohmann::json(markup).dump();
137 std::string s;
138 s += "(function(){";
139 // wxWebView's AddUserScript runs in child frames too (including cross-origin
140 // frames on WebView2). Host theme state belongs only to the top-level page.
141 s += "if(window.top!==window.self)return;";
142 s += prelude;
143 s += "var css=" + literal + ";";
144 s += "function inject(){";
145 s += "var root=document.head||document.documentElement;if(!root)return false;";
146 s += "if(!document.getElementById('" + std::string(dom_id) + "'))root.insertAdjacentHTML('" +
147 std::string(position) + "',css);";
148 s += on_inject;
149 s += "return true;}";
150 s += "if(inject())return;";
151 s += "var obs=new MutationObserver(function(){if(inject())obs.disconnect();});";
152 s += "obs.observe(document,{childList:true});})();";
153 return s;
154}

Referenced by element_defaults_user_script(), and theme_user_script().

Here is the caller graph for this function:

◆ element_defaults_user_script()

std::string Slic3r::GUI::WebViewHostDialog::element_defaults_user_script ( )
staticinherited
103{
104 std::string css;
105 css += "<style id=\"orca-plugin-defaults\">";
106 css += "html,body{background:var(--orca-bg);color:var(--orca-fg);"
107 "font-family:var(--orca-font);font-size:13px;}";
108 css += "body{margin:0;}";
109 css += "h1,h2,h3,h4,h5,h6{color:var(--orca-fg);font-weight:600;}";
110 css += "a{color:var(--orca-accent);}";
111 css += "hr{border:0;border-top:1px solid var(--orca-border);}";
112 css += "button{font:inherit;color:var(--orca-accent-fg);background:var(--orca-accent);"
113 "border:1px solid var(--orca-accent);border-radius:4px;padding:5px 14px;cursor:pointer;}";
114 css += "button:hover{filter:brightness(1.1);}";
115 css += "button:disabled{opacity:.5;cursor:default;}";
116 css += "input,select,textarea{font:inherit;color:var(--orca-fg);"
117 "background:var(--orca-bg);border:1px solid var(--orca-border);"
118 "border-radius:4px;padding:4px 8px;}";
119 css += "input:focus,select:focus,textarea:focus{outline:none;border-color:var(--orca-accent);}";
120 css += "table{border-collapse:collapse;}";
121 css += "th,td{text-align:left;padding:6px 10px;border-bottom:1px solid var(--orca-border);}";
122 css += "th{color:var(--orca-muted);font-weight:600;}";
123 css += "::-webkit-scrollbar{width:12px;height:12px;}";
124 css += "::-webkit-scrollbar-thumb{background:var(--orca-border);border-radius:6px;}";
125 css += "::-webkit-scrollbar-track{background:transparent;}";
126 css += "</style>";
127 return document_start_injector(css, "orca-plugin-defaults", "beforeend");
128}
static std::string document_start_injector(const std::string &markup, const char *dom_id, const char *position, const std::string &prelude={}, const std::string &on_inject={})
Definition WebViewHostDialog.cpp:130

References document_start_injector().

Referenced by Slic3r::GUI::WebPanel::WebPanel(), and Slic3r::GUI::WebDialog::add_user_scripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::DPIDialog::EndModal ( int retCode)
inlineoverrideinherited
306 {
307 if (!dialogStack.empty() && dialogStack.front() != this) {
308 // This is a bug in wxWidgets
309 // when the dialog is not top modal dialog, EndModal() just hide dialog without quit
310 // the modal event loop. And the modal event loop blocks us from bottom widgets.
311 // Solution: let user click it manually or close outside. FIXME
312 BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode;
313 return;
314 }
315
316 return wxDialog::EndModal(retCode);
317 }
std::deque< wxDialog * > dialogStack
Definition GUI_Utils.cpp:549

References Slic3r::GUI::dialogStack.

Referenced by Slic3r::GUI::CloneDialog::CloneDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(), Slic3r::GUI::DeleteConfirmDialog::DeleteConfirmDialog(), Slic3r::GUI::DesignVariableDialog::DesignVariableDialog(), Slic3r::GUI::anonymous_namespace{PrintHostDialogs.cpp}::FlashforgeSlotDialog::FlashforgeSlotDialog(), Slic3r::GUI::GuideFrame::GuideFrame(), Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::ManualNozzleCountDialog::ManualNozzleCountDialog(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MultiChoiceDialog::MultiChoiceDialog(), Slic3r::GUI::NetworkErrorDialog::NetworkErrorDialog(), Slic3r::GUI::NetworkPluginRestartDialog::NetworkPluginRestartDialog(), Slic3r::GUI::PartSkipConfirmDialog::PartSkipConfirmDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::PlateNameEditDialog::PlateNameEditDialog(), Slic3r::GUI::PlateSettingsDialog::PlateSettingsDialog(), Slic3r::GUI::PublishSettingsDialog::PublishSettingsDialog(), Slic3r::GUI::SelectMachineDialog::SelectMachineDialog(), Slic3r::GUI::SendFailedConfirm::SendFailedConfirm(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SingleChoiceDialog::SingleChoiceDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::SyncAmsInfoDialog::SyncAmsInfoDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), Slic3r::GUI::UpdatePluginDialog::UpdatePluginDialog(), Slic3r::GUI::UpdateVersionDialog::UpdateVersionDialog(), Slic3r::GUI::wgtDeviceNozzleRackUpgradeDlg::wgtDeviceNozzleRackUpgradeDlg(), Slic3r::GUI::SavePresetDialog::accept(), Slic3r::GUI::MsgDialog::add_button(), Slic3r::GUI::TipsDialog::add_button(), Slic3r::GUI::FilamentPickerDialog::BindEvents(), Slic3r::GUI::PluginPickerDialog::build_capability_ui(), Slic3r::GUI::BedShapeDialog::build_dialog(), Slic3r::GUI::PluginPickerDialog::build_ui(), Slic3r::GUI::UnsavedChangesDialog::close(), Slic3r::GUI::FileArchiveDialog::create_btn_sizer(), Slic3r::GUI::ColorDecomposeDialog::create_button_panel(), Slic3r::GUI::MixedFilamentDialog::create_button_panel(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::create_dialog_buttons(), Slic3r::GUI::PreferencesDialog::create_item_language_combobox(), Slic3r::GUI::PreferencesDialog::create_item_region_combobox(), Slic3r::GUI::PreferencesDialog::create_items(), Slic3r::GUI::CreatePrinterPresetDialog::create_page1_dialog_buttons(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::data_init(), Slic3r::GUI::WebDialog::destroy_silently(), Slic3r::GUI::EditFilamentPresetDialog::edit_preset(), Slic3r::GUI::ConnectPrinterDialog::end_modal(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::GUI::ColorPickerDialog::finish(), Slic3r::GUI::WebDialog::finish(), Slic3r::GUI::Newer3mfVersionDialog::get_btn_sizer(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), Slic3r::GUI::BindMachineDialog::on_bind_success(), Slic3r::GUI::ConnectPrinterDialog::on_button_confirm(), Slic3r::GUI::RecenterDialog::on_button_confirm(), Slic3r::GUI::BindMachineDialog::on_cancel(), Slic3r::GUI::EditCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::InputIpAddressDialog::on_cancel(), Slic3r::GUI::NewCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::OAuthDialog::on_cancel(), Slic3r::GUI::PingCodeBindDialog::on_cancel(), Slic3r::GUI::SelectMachineDialog::on_cancel(), Slic3r::GUI::SendToPrinterDialog::on_cancel(), Slic3r::GUI::SyncAmsInfoDialog::on_cancel(), Slic3r::GUI::UnBindMachineDialog::on_cancel(), Slic3r::GUI::WebDialog::on_close_window(), Slic3r::GUI::NetworkPluginDownloadDialog::on_dont_ask(), Slic3r::GUI::NetworkPluginDownloadDialog::on_download(), Slic3r::GUI::EditDevNameDialog::on_edit_name(), Slic3r::GUI::ConfirmBeforeSendDialog::on_hide(), Slic3r::GUI::PrivacyUpdateDialog::on_hide(), Slic3r::GUI::ShortcutCaptureDialog::on_key(), Slic3r::GUI::TextureImportDialog::on_ok_clicked(), Slic3r::GUI::FileArchiveDialog::on_open_button(), Slic3r::GUI::NetworkPluginDownloadDialog::on_remind_later(), Slic3r::GUI::ProjectDropDialog::on_select_cancel(), Slic3r::GUI::SavePresetDialog::on_select_cancel(), Slic3r::GUI::ProjectDropDialog::on_select_ok(), Slic3r::GUI::SendMultiMachinePage::on_send(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip(), Slic3r::GUI::TextureImportDialog::on_skip_clicked(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip_version(), Slic3r::GUI::Cornering_Test_Dlg::on_start(), Slic3r::GUI::FlowRateCalibrationDialog::on_start(), Slic3r::GUI::Input_Shaping_Damp_Test_Dlg::on_start(), Slic3r::GUI::Input_Shaping_Freq_Test_Dlg::on_start(), Slic3r::GUI::MaxVolumetricSpeed_Test_Dlg::on_start(), Slic3r::GUI::PA_Calibration_Dlg::on_start(), Slic3r::GUI::Retraction_Test_Dlg::on_start(), Slic3r::GUI::Temp_Calibration_Dlg::on_start(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::CalibrationDialog::on_start_calibration(), Slic3r::GUI::UnBindMachineDialog::on_unbind_printer(), Slic3r::GUI::PartSkipDialog::OnApplyDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::OnCancel(), Slic3r::GUI::AboutDialog::onCloseDialog(), Slic3r::GUI::CopyrightsDialog::onCloseDialog(), Slic3r::GUI::MultiNozzleSyncDialog::OnRackStatusReadingFinished(), Slic3r::GUI::GuideFrame::OnScriptMessage(), Slic3r::GUI::InputIpAddressDialog::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::TroubleshootDialog::PackAll(), Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles(), Slic3r::GUI::SpeedDialWebDialog::run_action(), Slic3r::GUI::OAuthDialog::Show(), Slic3r::GUI::MultiNozzleSyncDialog::UpdateButton(), and Slic3r::GUI::CreatePrinterPresetDialog::validate_input_valid().

◆ finish()

void Slic3r::GUI::WebDialog::finish ( bool submitted,
const nlohmann::json & data )
private
180{
181 if (!m_open)
182 return;
183 m_open = false;
184 if (submitted) {
185 m_result = data;
186 fire_submit(data);
187 } else {
188 m_result.reset();
189 fire_close();
190 }
191
192 if (IsModal())
193 EndModal(submitted ? wxID_OK : wxID_CANCEL);
194 else
195 Close();
196}
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305
bool m_open
Definition WebDialog.hpp:91
void fire_submit(const nlohmann::json &data)
Definition WebDialog.cpp:218
std::optional< nlohmann::json > m_result
Definition WebDialog.hpp:93
void fire_close()
Definition WebDialog.cpp:226

References Slic3r::GUI::DPIDialog::EndModal(), fire_close(), fire_submit(), m_open, and m_result.

Referenced by on_script_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fire_close()

void Slic3r::GUI::WebDialog::fire_close ( )
private
227{
228 if (m_close_fired)
229 return;
230 m_close_fired = true;
231 if (m_on_close) {
233 m_on_close = nullptr;
234 cb();
235 }
236}
std::function< void()> CloseHandler
Definition WebDialog.hpp:38
bool m_close_fired
Definition WebDialog.hpp:92

References m_close_fired, and m_on_close.

Referenced by finish(), and on_close_window().

Here is the caller graph for this function:

◆ fire_submit()

void Slic3r::GUI::WebDialog::fire_submit ( const nlohmann::json & data)
private
219{
220 if (m_on_submit) {
221 SubmitHandler cb = std::move(m_on_submit);
222 cb(data);
223 }
224}
std::function< void(const nlohmann::json &data)> SubmitHandler
Definition WebDialog.hpp:37

References m_on_submit.

Referenced by finish().

Here is the caller graph for this function:

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ handle_common_script_command()

bool Slic3r::GUI::WebViewHostDialog::handle_common_script_command ( const nlohmann::json & payload,
int close_return_code = wxID_CANCEL )
protectedinherited
251{
252 const std::string command = payload.value("command", "");
253 if (command == "close_page") {
254 if (IsModal())
255 EndModal(close_return_code);
256 else
257 Close();
258 return true;
259 }
260
261 return false;
262}

References Slic3r::GUI::DPIDialog::EndModal().

Referenced by Slic3r::GUI::ExportPresetBundleDialog::on_script_message(), Slic3r::GUI::PluginsConfigDialog::on_script_message(), Slic3r::GUI::PluginsDialog::on_script_message(), Slic3r::GUI::PresetBundleDialog::on_script_message(), Slic3r::GUI::SpeedDialWebDialog::on_script_message(), Slic3r::GUI::TerminalDialog::on_script_message(), and Slic3r::GUI::WebDialog::on_script_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ is_open()

bool Slic3r::GUI::WebDialog::is_open ( ) const
inline
63{ return m_open; }

References m_open.

Referenced by post_message().

Here is the caller graph for this function:

◆ load_page_html()

void Slic3r::GUI::WebDialog::load_page_html ( )
private
142{
143 m_content_loaded = true;
144 if (wxWebView* wv = browser()) {
145 m_own_page_load = true;
146 wv->SetPage(wxString::FromUTF8(m_html), web_hosting::content_base_url());
147 }
148}
bool m_own_page_load
Definition WebDialog.hpp:89
bool m_content_loaded
Definition WebDialog.hpp:88
wxString content_base_url()
Definition WebHosting.cpp:55

References Slic3r::GUI::WebViewHostDialog::browser(), Slic3r::GUI::web_hosting::content_base_url(), m_content_loaded, m_html, and m_own_page_load.

Referenced by on_bootstrap_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_url()

void Slic3r::GUI::WebViewHostDialog::load_url ( const wxString & url)
inherited
225{
226 if (!m_browser)
227 return;
228
229 BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << " enter, url=" << into_u8(url);
231 m_browser->SetFocus();
232}
static void LoadUrl(wxWebView *webView, wxString const &url)
Definition WebView.cpp:480
std::string into_u8(const wxString &str)
Definition GUI.cpp:549
void trace(unsigned int level, const char *message)
Definition utils.cpp:247

References Slic3r::GUI::into_u8(), WebView::LoadUrl(), m_browser, and Slic3r::trace().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ localized_strings()

virtual nlohmann::json Slic3r::GUI::WebViewHostDialog::localized_strings ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::ExportPresetBundleDialog, Slic3r::GUI::PluginsConfigDialog, Slic3r::GUI::PluginsDialog, Slic3r::GUI::PresetBundleDialog, Slic3r::GUI::SpeedDialWebDialog, and Slic3r::GUI::TerminalDialog.

99{ return nullptr; }

Referenced by register_theme_user_scripts().

Here is the caller graph for this function:

◆ localized_strings_script()

std::string Slic3r::GUI::WebViewHostDialog::localized_strings_script ( const nlohmann::json & strings)
staticinherited
157{
158 return "window.ORCA_UI_STRINGS = " + strings.dump(-1, ' ', false, nlohmann::json::error_handler_t::ignore) + ";";
159}

Referenced by Slic3r::GUI::GuideFrame::GuideFrame(), WipingDialog::WipingDialog(), Slic3r::GUI::add_page_strings(), Slic3r::GUI::ProjectPanel::create_browser(), Slic3r::GUI::WebViewPanel::create_browser(), and register_theme_user_scripts().

Here is the caller graph for this function:

◆ normal_font()

◆ on_bootstrap_event()

void Slic3r::GUI::WebDialog::on_bootstrap_event ( wxWebViewEvent & event)
private
116{
117 const bool loaded = event.GetEventType() == wxEVT_WEBVIEW_LOADED;
118 // The first bootstrap load (or its error) triggers the swap to plugin HTML.
119 if (!m_content_loaded)
121 // WebKit reloads the SetPage base URL, so a committed load of it that we did not start is a reload.
122 // A failed navigation is reported against the page that stayed but never commits. Edge ignores the
123 // base URL and restores SetPage content itself, so nothing matches there.
124 else if (web_hosting::is_content_url(event.GetURL())) {
125 if (m_own_page_load)
126 m_own_page_load = false;
127 else if (loaded && m_content_navigated)
129 }
130 if (loaded)
131 m_content_navigated = false;
132 event.Skip();
133}
void load_page_html()
Definition WebDialog.cpp:141
bool m_content_navigated
Definition WebDialog.hpp:90
bool is_content_url(const wxString &url)
Definition WebHosting.cpp:60

References Slic3r::GUI::web_hosting::is_content_url(), load_page_html(), m_content_loaded, m_content_navigated, and m_own_page_load.

Referenced by WebDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_close_window()

void Slic3r::GUI::WebDialog::on_close_window ( wxCloseEvent & event)
private
199{
200 if (!m_open) {
201 // finish() already dispatched submit/close and requested the close.
202 // Modeless windows still need to be destroyed after that request.
203 if (!IsModal())
204 Destroy();
205 return;
206 }
207
208 m_open = false;
209 m_result.reset();
210 fire_close();
211 if (IsModal()) {
212 EndModal(wxID_CANCEL);
213 return;
214 }
215 Destroy();
216}

References Slic3r::GUI::DPIDialog::EndModal(), fire_close(), m_open, and m_result.

Referenced by WebDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_dpi_changed()

void Slic3r::GUI::WebViewHostDialog::on_dpi_changed ( const wxRect & suggested_rect)
overrideprotectedvirtualinherited

Implements Slic3r::GUI::DPIAware< wxDialog >.

265{
266 Refresh();
267}

◆ on_navigated()

void Slic3r::GUI::WebDialog::on_navigated ( wxWebViewEvent & event)
private
136{
138 event.Skip();
139}

References Slic3r::GUI::web_hosting::is_content_url(), and m_content_navigated.

Referenced by WebDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_script_message()

void Slic3r::GUI::WebDialog::on_script_message ( const nlohmann::json & payload)
overrideprotectedvirtual

Implements Slic3r::GUI::WebViewHostDialog.

151{
152 if (payload.value("channel", std::string()) == "orca") {
153 const std::string kind = payload.value("kind", std::string());
154 const nlohmann::json data = payload.contains("data") ? payload["data"] : nlohmann::json();
155 if (kind == "message") {
156 if (m_on_message)
157 m_on_message(data);
158 } else if (kind == "submit") {
159 finish(true, data);
160 } else if (kind == "close") {
161 finish(false, nlohmann::json());
162 }
163 return;
164 }
165
166 // Fall back to the shared shell commands (e.g. "close_page").
168}
void finish(bool submitted, const nlohmann::json &data)
Definition WebDialog.cpp:179
bool handle_common_script_command(const nlohmann::json &payload, int close_return_code=wxID_CANCEL)
Definition WebViewHostDialog.cpp:250

References finish(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), and m_on_message.

Here is the call graph for this function:

◆ on_script_message_event()

void Slic3r::GUI::WebViewHostDialog::on_script_message_event ( wxWebViewEvent & event)
privateinherited
275{
276 const wxString payload = event.GetString();
277
278 try {
279 on_script_message(nlohmann::json::parse(payload.utf8_string()));
280 } catch (const std::exception& e) {
282 }
283}
virtual void on_script_message_parse_error(const wxString &payload, const std::exception &error)
Definition WebViewHostDialog.cpp:269
virtual void on_script_message(const nlohmann::json &payload)=0

References on_script_message(), and on_script_message_parse_error().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_script_message_parse_error()

void Slic3r::GUI::WebViewHostDialog::on_script_message_parse_error ( const wxString & payload,
const std::exception & error )
protectedvirtualinherited
270{
271 BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << "; payload=" << into_u8(payload) << "; error=" << error.what();
272}

References Slic3r::GUI::into_u8(), and Slic3r::trace().

Referenced by on_script_message_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_sys_color_changed()

◆ on_webview_recreated()

void Slic3r::GUI::WebViewHostDialog::on_webview_recreated ( wxCommandEvent & event)
privateinherited
311{
312 // Handled: do NOT Skip(), so WebView::RecreateAll skips the redundant reload.
314}
void apply_theme_live()
Definition WebViewHostDialog.cpp:299

References apply_theme_live().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ post_message()

void Slic3r::GUI::WebDialog::post_message ( WebDialog * dialog,
const nlohmann::json & data )
static
90{
91 if (dialog != nullptr && dialog->is_open())
92 dialog->push_message(data);
93}

References WebDialog(), is_open(), and push_message().

Referenced by Slic3r::anonymous_namespace{PluginHostUi.cpp}::handle_post().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ push_message()

void Slic3r::GUI::WebDialog::push_message ( const nlohmann::json & data)
171{
172 if (!m_open)
173 return;
174 nlohmann::json envelope;
175 envelope["data"] = data;
176 call_web_handler(envelope, wxT("__orcaDispatch"));
177}
void call_web_handler(const nlohmann::json &payload, const wxString &handler=wxT("HandleStudio"))
Definition WebViewHostDialog.cpp:242

References Slic3r::GUI::WebViewHostDialog::call_web_handler(), and m_open.

Referenced by post_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_theme_user_scripts()

void Slic3r::GUI::WebViewHostDialog::register_theme_user_scripts ( )
protectedinherited
286{
287 if (!m_browser)
288 return;
289 // Added once, at creation. Deliberately no RemoveAllUserScripts() here: the "wx"
290 // script message handler is registered separately (AddScriptMessageHandler), but on
291 // some backends RemoveAllUserScripts() drops it too, which would break
292 // window.wx.postMessage / HandleStudio. Live re-theme goes through apply_theme_live().
293 m_browser->AddUserScript(wxString::FromUTF8(theme_user_script()));
294 if (const nlohmann::json strings = localized_strings(); !strings.is_null())
295 m_browser->AddUserScript(wxString::FromUTF8(localized_strings_script(strings)));
297}
static std::string theme_user_script()
Definition WebViewHostDialog.cpp:93
static std::string localized_strings_script(const nlohmann::json &strings)
Definition WebViewHostDialog.cpp:156
virtual void add_user_scripts()
Definition WebViewHostDialog.hpp:95
virtual nlohmann::json localized_strings() const
Definition WebViewHostDialog.hpp:99

References add_user_scripts(), localized_strings(), localized_strings_script(), m_browser, and theme_user_script().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_close()

void Slic3r::GUI::WebDialog::request_close ( WebDialog * dialog)
static
96{
97 if (dialog != nullptr)
98 dialog->Close();
99}

References WebDialog().

Referenced by Slic3r::anonymous_namespace{PluginHostUi.cpp}::handle_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ result()

const std::optional< nlohmann::json > & Slic3r::GUI::WebDialog::result ( ) const
inline
70{ return m_result; }

References m_result.

◆ run_script()

bool Slic3r::GUI::WebViewHostDialog::run_script ( const wxString & script)
inherited
235{
236 if (!m_browser)
237 return false;
238
239 return WebView::RunScript(m_browser, script);
240}
static bool RunScript(wxWebView *webView, wxString const &msg)
Definition WebView.cpp:491

References m_browser, and WebView::RunScript().

Referenced by apply_theme_live(), call_web_handler(), Slic3r::GUI::ColorPickerDialog::focus_webview(), Slic3r::GUI::ColorPickerDialog::handle_web_command(), and Slic3r::GUI::ColorPickerDialog::send_initial_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ ShowModal()

◆ theme_apply_script()

std::string Slic3r::GUI::WebViewHostDialog::theme_apply_script ( )
staticinherited
88{ return host_theme_apply_js(); }

Referenced by Slic3r::GUI::WebPanel::apply_theme().

Here is the caller graph for this function:

◆ theme_user_script()

std::string Slic3r::GUI::WebViewHostDialog::theme_user_script ( )
staticinherited
94{
95 const std::string style = "<style id=\"orca-host-theme-vars\">" + host_theme_vars_css() + "</style>";
97 style, "orca-host-theme-vars", "afterbegin",
98 "window.__orcaHostThemed=true;var theme=\"" + host_theme_name() + "\";",
99 "if(document.documentElement)document.documentElement.setAttribute('data-orca-theme',theme);");
100}
#define style
Definition WipeTowerDialog.cpp:101
std::string host_theme_vars_css()
Definition WebViewHostDialog.cpp:40
std::string host_theme_name()
Definition WebViewHostDialog.cpp:35

References document_start_injector(), and style.

Referenced by Slic3r::GUI::WebPanel::WebPanel(), and register_theme_user_scripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

◆ use_normal_window_type()

void Slic3r::GUI::WebDialog::use_normal_window_type ( )
61{
62#ifdef __WXGTK__
63 // wxGTK types every wxDialog as a dialog, and Mutter offers no maximize for anything but a
64 // normal window. Mutter also stops hiding a normal window from the taskbar, so keep it hidden
65 // as a dialog with a parent is everywhere else.
66 gtk_window_set_type_hint(GTK_WINDOW(m_widget), GDK_WINDOW_TYPE_HINT_NORMAL);
67 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), TRUE);
68#endif
69}

Member Data Documentation

◆ m_browser

wxWebView* Slic3r::GUI::WebViewHostDialog::m_browser {nullptr}
privateinherited

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_close_fired

bool Slic3r::GUI::WebDialog::m_close_fired {false}
private
92{false};

Referenced by fire_close().

◆ m_content_loaded

bool Slic3r::GUI::WebDialog::m_content_loaded {false}
private
88{false};

Referenced by load_page_html(), and on_bootstrap_event().

◆ m_content_navigated

bool Slic3r::GUI::WebDialog::m_content_navigated {false}
private
90{false}; // a navigation to the base URL has committed

Referenced by on_bootstrap_event(), and on_navigated().

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_html

std::string Slic3r::GUI::WebDialog::m_html
private

Referenced by WebDialog(), and load_page_html().

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_on_close

CloseHandler Slic3r::GUI::WebDialog::m_on_close
private

Referenced by WebDialog(), and fire_close().

◆ m_on_destroyed

CloseHandler Slic3r::GUI::WebDialog::m_on_destroyed
private

Referenced by WebDialog(), and ~WebDialog().

◆ m_on_message

MessageHandler Slic3r::GUI::WebDialog::m_on_message
private

Referenced by WebDialog(), and on_script_message().

◆ m_on_submit

SubmitHandler Slic3r::GUI::WebDialog::m_on_submit
private

Referenced by WebDialog(), and fire_submit().

◆ m_open

bool Slic3r::GUI::WebDialog::m_open {true}
private

◆ m_own_page_load

bool Slic3r::GUI::WebDialog::m_own_page_load {false}
private
89{false}; // a SetPage of the plugin HTML is in flight

Referenced by load_page_html(), and on_bootstrap_event().

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_result

std::optional<nlohmann::json> Slic3r::GUI::WebDialog::m_result
private

Referenced by finish(), on_close_window(), and result().

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/WebDialog.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/WebDialog.cpp