mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 14:51:06 +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.
55 lines
2.4 KiB
C++
55 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <slic3r/GUI/Widgets/WebViewHostDialog.hpp>
|
|
#include <libslic3r/Preset.hpp>
|
|
#include <slic3r/plugin/PluginConfig.hpp>
|
|
|
|
#include <atomic>
|
|
#include <memory>
|
|
#include "slic3r/plugin/PythonPluginInterface.hpp"
|
|
#include <string>
|
|
#include <wx/string.h>
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
// Lists the plugin capabilities the edited preset of `m_type` uses (see capabilities_in_use) and edits
|
|
// each one's config, falling back to the global config where the preset has no override.
|
|
//
|
|
// A pure editor over a JSON document: it never writes to the preset and never writes to the base config
|
|
// file. The caller seeds it with the preset's raw override text and reads the edited text back from
|
|
// overrides_json(); PluginConfigField owns the value and feeds it through the normal field/dirty pipeline.
|
|
class PluginsConfigDialog : public WebViewHostDialog
|
|
{
|
|
public:
|
|
PluginsConfigDialog(wxWindow* parent, Preset::Type type, const std::string& overrides_json);
|
|
~PluginsConfigDialog() override;
|
|
|
|
// The edited overrides as compact JSON text; "" once no override remains.
|
|
std::string overrides_json() const { return serialize_plugin_overrides(m_overrides); }
|
|
|
|
private:
|
|
void on_script_message(const nlohmann::json& payload) override;
|
|
// Runs one web command on a clean main-loop stack; see on_script_message.
|
|
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;
|
|
|
|
Preset::Type m_type = Preset::TYPE_INVALID;
|
|
PresetPluginConfigService m_service;
|
|
// The working copy the dialog edits. Seeded from the preset's raw text, read back by the caller.
|
|
CapabilityConfigDocument m_overrides;
|
|
// Set when the preset's stored text could not be parsed: the rows are shown read-only rather
|
|
// than silently replacing data we did not understand.
|
|
std::string m_parse_error;
|
|
// Guards the deferred command handlers against the dialog being destroyed while one is queued.
|
|
std::shared_ptr<std::atomic<bool>> m_alive = std::make_shared<std::atomic<bool>>(true);
|
|
};
|
|
|
|
}} // namespace Slic3r::GUI
|