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

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

Inheritance diagram for Slic3r::GUI::PluginsConfigDialog:
Collaboration diagram for Slic3r::GUI::PluginsConfigDialog:

Public Member Functions

 PluginsConfigDialog (wxWindow *parent, Preset::Type type, const std::string &overrides_json)
 ~PluginsConfigDialog () override
std::string overrides_json () 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 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

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)
virtual bool append_language_to_url () const
void register_theme_user_scripts ()
virtual void add_user_scripts ()
void apply_theme_live ()
virtual void on_sys_color_changed ()

Private Member Functions

void on_script_message (const nlohmann::json &payload) override
nlohmann::json localized_strings () const override
void handle_web_command (const nlohmann::json &payload)
const Preset * current_preset () const
void send_capabilities ()
void send_capability_config (const PluginCapabilityId &id)
void send_save_error (const PluginCapabilityId &id, const std::string &error)
void show_status (const wxString &message, const char *level)
PluginCapabilityId identifier_from (const nlohmann::json &payload) const
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

Preset::Type m_type = Preset::TYPE_INVALID
PresetPluginConfigService m_service
CapabilityConfigDocument m_overrides
std::string m_parse_error
std::shared_ptr< std::atomic< bool > > m_alive = std::make_shared<std::atomic<bool>>(true)
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

Constructor & Destructor Documentation

◆ PluginsConfigDialog()

Slic3r::GUI::PluginsConfigDialog::PluginsConfigDialog ( wxWindow * parent,
Preset::Type type,
const std::string & overrides_json )
44 : WebViewHostDialog(parent, wxID_ANY, preset_type_title(type))
45 , m_type(type)
46{
47 // On failure the document stays empty and every row goes read-only (see m_parse_error), so a preset
48 // we cannot understand is never silently overwritten.
50 BOOST_LOG_TRIVIAL(error) << "Plugins Config dialog: " << m_parse_error;
51
52 create_webview("web/dialog/PluginsConfigDialog/index.html", preset_type_title(type), wxSize(820, 660),
53 wxSize(640, 520));
54}
std::string m_parse_error
Definition PluginsConfigDialog.hpp:53
CapabilityConfigDocument m_overrides
Definition PluginsConfigDialog.hpp:50
Preset::Type m_type
Definition PluginsConfigDialog.hpp:47
std::string overrides_json() const
Definition PluginsConfigDialog.hpp:31
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
wxString preset_type_title(Preset::Type type)
Definition PluginsConfigDialog.cpp:31
bool parse_plugin_overrides(const std::string &raw, CapabilityConfigDocument &document, std::string &error)
Definition PluginConfig.cpp:331

References Slic3r::GUI::WebViewHostDialog::WebViewHostDialog(), Slic3r::GUI::WebViewHostDialog::create_webview(), m_overrides, m_parse_error, m_type, overrides_json(), and Slic3r::parse_plugin_overrides().

Here is the call graph for this function:

◆ ~PluginsConfigDialog()

Slic3r::GUI::PluginsConfigDialog::~PluginsConfigDialog ( )
override
56{ m_alive->store(false, std::memory_order_release); }
std::shared_ptr< std::atomic< bool > > m_alive
Definition PluginsConfigDialog.hpp:55

References m_alive.

Member Function Documentation

◆ add_user_scripts()

virtual void Slic3r::GUI::WebViewHostDialog::add_user_scripts ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::ColorPickerDialog, and Slic3r::GUI::WebDialog.

95{}

Referenced by register_theme_user_scripts().

Here is the caller graph for this function:

◆ append_language_to_url()

virtual bool Slic3r::GUI::WebViewHostDialog::append_language_to_url ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::WebDialog.

84{ return true; }

Referenced by build_resource_url().

Here is the caller graph for this function:

◆ 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:

◆ current_preset()

const Preset * Slic3r::GUI::PluginsConfigDialog::current_preset ( ) const
private
73{
74 const PresetBundle* bundle = wxGetApp().preset_bundle;
75 if (bundle == nullptr)
76 return nullptr;
77
78 switch (m_type) {
79 case Preset::TYPE_PRINT: return &bundle->prints.get_edited_preset();
80 case Preset::TYPE_PRINTER: return &bundle->printers.get_edited_preset();
81 case Preset::TYPE_FILAMENT: return &bundle->filaments.get_edited_preset();
82 default: return nullptr;
83 }
84}
@ TYPE_PRINTER
Definition Preset.hpp:250
@ TYPE_PRINT
Definition Preset.hpp:246
@ TYPE_FILAMENT
Definition Preset.hpp:248

References Slic3r::PresetBundle::filaments, Slic3r::PresetCollection::get_edited_preset(), m_type, Slic3r::PresetBundle::printers, Slic3r::PresetBundle::prints, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, and Slic3r::Preset::TYPE_PRINTER.

Referenced by send_capabilities(), and send_capability_config().

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().

◆ 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}
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305

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:

◆ handle_web_command()

void Slic3r::GUI::PluginsConfigDialog::handle_web_command ( const nlohmann::json & payload)
private
109{
110 const std::string command = payload.value("command", "");
111 if (command == "request_capabilities") {
113 return;
114 }
115
116 const PluginCapabilityId id = identifier_from(payload);
117
118 if (command == "get_capability_config") {
120 } else if (command == "save_capability_config") {
121 if (!m_parse_error.empty()) {
123 return;
124 }
125
126 nlohmann::json value = payload.contains("config") ? payload.at("config") : nlohmann::json::object();
127 if (value.is_string()) {
128 value = nlohmann::json::parse(value.get<std::string>(), nullptr, /* allow_exceptions */ false);
129 if (value.is_discarded()) {
130 send_save_error(id, into_u8(_L("The configuration is not valid JSON. Your changes were not saved.")));
131 return;
132 }
133 }
134
135 const MutationResult result = m_service.set_preset_override(m_overrides, id, value);
136 if (!result.ok) {
137 send_save_error(id, result.error);
138 return;
139 }
141 show_status(_L("Configuration updated. Save the preset to persist it."), "success");
142 } else if (command == "remove_preset_override") {
143 // "Restore defaults" for a preset means holding no override at all: the capability falls back
144 // to the global configuration, not to the plugin's own get_default_config().
145 if (!m_parse_error.empty()) {
147 return;
148 }
149
150 const int rc = wxMessageBox(wxString::Format(_L("Restore the default configuration for \"%s\"?\n\n"
151 "This discards the preset's override and uses the global configuration."),
152 from_u8(id.name)),
153 _L("Restore defaults"), wxYES_NO | wxNO_DEFAULT | wxICON_WARNING, this);
154 if (rc != wxYES)
155 return;
156
157 const MutationResult result = m_service.remove_preset_override(m_overrides, id);
158 if (!result.ok) {
159 send_save_error(id, result.error);
160 return;
161 }
163 show_status(_L("Using global configuration. Save the preset to persist it."), "success");
164 }
165}
#define _L(s)
Definition OBJ.cpp:34
void show_status(const wxString &message, const char *level)
Definition PluginsConfigDialog.cpp:237
PluginCapabilityId identifier_from(const nlohmann::json &payload) const
Definition PluginsConfigDialog.cpp:86
PresetPluginConfigService m_service
Definition PluginsConfigDialog.hpp:48
void send_capabilities()
Definition PluginsConfigDialog.cpp:167
void send_capability_config(const PluginCapabilityId &id)
Definition PluginsConfigDialog.cpp:183
void send_save_error(const PluginCapabilityId &id, const std::string &error)
Definition PluginsConfigDialog.cpp:227
std::string into_u8(const wxString &str)
Definition GUI.cpp:549
wxString from_u8(const std::string &str)
Definition GUI.cpp:544

References _L, Slic3r::MutationResult::error, Slic3r::GUI::from_u8(), identifier_from(), Slic3r::GUI::into_u8(), m_overrides, m_parse_error, m_service, Slic3r::MutationResult::ok, send_capabilities(), send_capability_config(), send_save_error(), and show_status().

Referenced by on_script_message().

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

◆ identifier_from()

PluginCapabilityId Slic3r::GUI::PluginsConfigDialog::identifier_from ( const nlohmann::json & payload) const
private
87{
88 return {plugin_capability_type_from_string(payload.value("capability_type", "")),
89 payload.value("capability_name", ""),
90 payload.value("plugin_key", "")};
91}
PluginCapabilityType plugin_capability_type_from_string(std::string_view value)
Definition PythonPluginInterface.hpp:72

References Slic3r::plugin_capability_type_from_string().

Referenced by handle_web_command().

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; }

◆ 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
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()

nlohmann::json Slic3r::GUI::PluginsConfigDialog::localized_strings ( ) const
overrideprivatevirtual

Reimplemented from Slic3r::GUI::WebViewHostDialog.

59{
60 return {
61 {"no_capabilities", _u8L("This preset does not use any plugin capabilities")},
62 {"capabilities_label", _u8L("Capabilities used by this preset")},
63 {"config_json_label", _u8L("Capability configuration (JSON)")},
64 {"config_frame_title", _u8L("Plugin configuration")},
65 {"restore_title", _u8L("Discard this preset's override and use the global configuration again")},
66 {"restore_defaults", _u8L("Restore defaults")},
67 {"save", _u8L("Save")},
68 {"invalid_json", _u8L("Invalid JSON")},
69 };
70}
#define _u8L(s)
Definition I18N.hpp:11

References _u8L.

◆ 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_dpi_changed()

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

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

265{
266 Refresh();
267}

◆ on_script_message()

void Slic3r::GUI::PluginsConfigDialog::on_script_message ( const nlohmann::json & payload)
overrideprivatevirtual

Implements Slic3r::GUI::WebViewHostDialog.

94{
96 return;
97
98 // Defer command handling out of the webview script-message callback, exactly as PluginsDialog
99 // does: GTK and macOS deliver it synchronously inside the native webview callback, and window
100 // work on that stack is the crash class fixed in b779a7bfed/f2ccbfc8b5. remove_preset_override
101 // puts a modal message box on that stack, which is the same bug.
102 wxGetApp().CallAfter([this, alive = m_alive, payload]() {
103 if (alive->load(std::memory_order_acquire))
104 handle_web_command(payload);
105 });
106}
void handle_web_command(const nlohmann::json &payload)
Definition PluginsConfigDialog.cpp:108
bool handle_common_script_command(const nlohmann::json &payload, int close_return_code=wxID_CANCEL)
Definition WebViewHostDialog.cpp:250

References Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), handle_web_command(), and m_alive.

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:

◆ overrides_json()

std::string Slic3r::GUI::PluginsConfigDialog::overrides_json ( ) const
inline
std::string serialize_plugin_overrides(const CapabilityConfigDocument &document)
Definition PluginConfig.cpp:353

References m_overrides, and Slic3r::serialize_plugin_overrides().

Referenced by PluginsConfigDialog(), and Slic3r::GUI::PluginConfigField::open_dialog().

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; }

◆ 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:

◆ 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

◆ 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; }

◆ send_capabilities()

void Slic3r::GUI::PluginsConfigDialog::send_capabilities ( )
private
168{
169 const Preset* preset = current_preset();
170 if (preset == nullptr)
171 return;
172
173 nlohmann::json response;
174 response["command"] = "list_capabilities";
175 response["preset_type"] = static_cast<int>(m_type);
176 response["preset_name"] = preset->name;
178
179 BOOST_LOG_TRIVIAL(info) << "Prepared " << response["data"].size() << " capability rows for the Plugins Config dialog";
180 call_web_handler(response);
181}
const Preset * current_preset() const
Definition PluginsConfigDialog.cpp:72
void call_web_handler(const nlohmann::json &payload, const wxString &handler=wxT("HandleStudio"))
Definition WebViewHostDialog.cpp:242
static nlohmann::json capabilities_payload(const std::vector< PluginCapabilityId > &caps)
Definition PluginConfig.cpp:538
@ Preset
Definition calib.hpp:39
std::vector< PluginCapabilityId > capabilities_in_use(const PresetBundle &preset_bundle, Preset::Type type)
Definition PluginResolver.cpp:162

References Slic3r::GUI::WebViewHostDialog::call_web_handler(), Slic3r::capabilities_in_use(), Slic3r::PluginConfig::capabilities_payload(), current_preset(), m_type, and Slic3r::Preset::name.

Referenced by handle_web_command().

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

◆ send_capability_config()

void Slic3r::GUI::PluginsConfigDialog::send_capability_config ( const PluginCapabilityId & id)
private
184{
185 const Preset* preset = current_preset();
186
187 nlohmann::json response;
188 response["command"] = "capability_config";
189 response["plugin_key"] = id.plugin_key;
190 response["capability_name"] = id.name;
191 response["capability_type"] = plugin_capability_type_to_string(id.type);
192 response["config"] = nlohmann::json::object();
193 response["custom_html"] = "";
194 response["error"] = "";
195
196 const auto cap = PluginManager::instance().get_plugin_capability(id, false);
197 if (!cap || preset == nullptr) {
198 response["error"] = into_u8(_L("This capability is no longer available."));
199 call_web_handler(response);
200 return;
201 }
202
203 const EffectiveCapabilityConfig effective = m_service.get_effective_config(m_overrides, id);
204 response["config"] = effective.config;
205 response["has_preset_override"] = effective.has_preset_override;
206 response["has_base_config"] = effective.has_base_config;
207 response["stored_plugin_version"] = effective.stored_plugin_version;
208 response["running_plugin_version"] = effective.running_plugin_version;
209 response["read_only"] = !m_parse_error.empty();
210 if (!m_parse_error.empty())
211 response["error"] = m_parse_error;
212
213 if (cap->config_ui_available()) {
214 try {
215 wxBusyCursor busy;
216 PythonGILState gil;
217 response["custom_html"] = cap->get_config_ui();
218 } catch (const std::exception& ex) {
219 response["error"] = into_u8(GUI::format_wxstr(_L("The plugin's configuration UI failed to load (%1%). Showing the default editor."),
220 from_u8(ex.what())));
221 }
222 }
223
224 call_web_handler(response);
225}
static PluginManager & instance()
Definition PluginManager.cpp:74
std::shared_ptr< PluginCapabilityInterface > get_plugin_capability(const PluginCapabilityId &id, bool only_enabled=true) const
Definition PluginManager.cpp:616
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:22
std::string plugin_capability_type_to_string(PluginCapabilityType type)
Definition PythonPluginInterface.hpp:40

References _L, Slic3r::GUI::WebViewHostDialog::call_web_handler(), Slic3r::EffectiveCapabilityConfig::config, current_preset(), Slic3r::GUI::format_wxstr(), Slic3r::GUI::from_u8(), Slic3r::PluginManager::get_plugin_capability(), Slic3r::EffectiveCapabilityConfig::has_base_config, Slic3r::EffectiveCapabilityConfig::has_preset_override, Slic3r::PluginManager::instance(), Slic3r::GUI::into_u8(), m_overrides, m_parse_error, m_service, Slic3r::plugin_capability_type_to_string(), Slic3r::EffectiveCapabilityConfig::running_plugin_version, and Slic3r::EffectiveCapabilityConfig::stored_plugin_version.

Referenced by handle_web_command().

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

◆ send_save_error()

void Slic3r::GUI::PluginsConfigDialog::send_save_error ( const PluginCapabilityId & id,
const std::string & error )
private
228{
229 call_web_handler({{"command", "capability_config_saved"},
230 {"plugin_key", id.plugin_key},
231 {"capability_name", id.name},
232 {"capability_type", plugin_capability_type_to_string(id.type)},
233 {"ok", false},
234 {"error", error}});
235}

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

Referenced by handle_web_command().

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

◆ 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; }

◆ show_status()

void Slic3r::GUI::PluginsConfigDialog::show_status ( const wxString & message,
const char * level )
private
238{
239 nlohmann::json payload;
240 payload["command"] = "status_message";
241 payload["level"] = level;
242 payload["message"] = into_u8(message);
243 call_web_handler(payload);
244}

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

Referenced by handle_web_command().

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

◆ 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 }

Member Data Documentation

◆ m_alive

std::shared_ptr<std::atomic<bool> > Slic3r::GUI::PluginsConfigDialog::m_alive = std::make_shared<std::atomic<bool>>(true)
private

◆ 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_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_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_overrides

CapabilityConfigDocument Slic3r::GUI::PluginsConfigDialog::m_overrides
private

◆ m_parse_error

std::string Slic3r::GUI::PluginsConfigDialog::m_parse_error
private

◆ m_prev_scale_factor

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

◆ m_scale_factor

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

◆ m_service

PresetPluginConfigService Slic3r::GUI::PluginsConfigDialog::m_service
private

◆ m_type

Preset::Type Slic3r::GUI::PluginsConfigDialog::m_type = Preset::TYPE_INVALID
private

The documentation for this class was generated from the following files: