mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 07:11:10 +00:00
* Add Missing Includes Across src/slic3r/GUI Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained. * Drop the OS-Specific Includes Added Outside Their Platform Guards GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build. * Add the clang-tidy Configuration That Generated These Includes Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly. * Match Windows Paths in the clang-tidy Ignore List Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "WebPanel.hpp"
|
|
|
|
#include <functional>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
// Stable across sessions so the saved layout finds the pane; free of wxAuiManager layout delimiters.
|
|
std::string plugin_pane_name(const std::string& plugin_key, const std::string& title);
|
|
|
|
// A WebPanel docked in the Plater, on the plugin-window bridge minus submit. It can be destroyed
|
|
// without the GIL, so its hooks must not capture pybind11 objects.
|
|
class DockPanel : public WebPanel
|
|
{
|
|
public:
|
|
using MessageHandler = std::function<void(const nlohmann::json& data)>;
|
|
using CloseHandler = std::function<void()>;
|
|
|
|
// on_close fires once, on a user or page close. on_destroyed runs on every destruction and must
|
|
// touch host-side state only.
|
|
DockPanel(wxWindow* parent,
|
|
const std::string& html,
|
|
MessageHandler on_message,
|
|
CloseHandler on_close,
|
|
CloseHandler on_destroyed);
|
|
~DockPanel() override;
|
|
|
|
// Main thread only.
|
|
void push_message(const nlohmann::json& data);
|
|
// Fires on_close, then removes the pane.
|
|
void request_close();
|
|
// Removes the pane without on_close, for plugin unload. Destroys at once: unload always comes from
|
|
// the host, never from this panel's own callbacks.
|
|
void destroy_silently();
|
|
// Fires on_close at most once; also run by the pane's own close button.
|
|
void fire_close();
|
|
|
|
protected:
|
|
std::optional<std::string> page_html() override { return m_html; }
|
|
bool on_page_message(const std::string& kind, const nlohmann::json& data) override;
|
|
|
|
private:
|
|
void remove_pane();
|
|
|
|
std::string m_html;
|
|
bool m_closing{false};
|
|
MessageHandler m_on_message;
|
|
CloseHandler m_on_close;
|
|
CloseHandler m_on_destroyed;
|
|
};
|
|
|
|
}} // namespace Slic3r::GUI
|