14#include <glibmm/i18n.h>
15#include <gtkmm/checkbutton.h>
16#include <gtkmm/separator.h>
44 _button_cancel(nullptr),
45 _button_preview(nullptr),
48 this->set_default_size(0,0);
50 auto hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
51 if (controls ==
nullptr) {
53 std::cerr <<
"AH!!! No controls and no effect!!!" << std::endl;
61 hbox->set_visible(
true);
65 _button_cancel = add_button(
_effect ==
nullptr ? _(
"_Cancel") : _(
"_Close"), Gtk::ResponseType::CANCEL);
66 _button_ok = add_button(
_effect ==
nullptr ? _(
"_OK") : _(
"_Apply"), Gtk::ResponseType::OK);
67 set_default_response(Gtk::ResponseType::OK);
74 std::cerr <<
"Error encountered loading live parameter XML !!!" << std::endl;
81 auto const sep = Gtk::make_managed<Gtk::Separator>();
82 sep->set_visible(
true);
85 hbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::HORIZONTAL);
90 hbox->set_visible(
true);
94 if (
auto const preview_box =
dynamic_cast<Gtk::Box *
>(
_button_preview)) {
133 _exEnv = std::make_unique<ExecutionEnv>(
_effect, SP_ACTIVE_DESKTOP,
nullptr,
false,
false);
161 Glib::PRIORITY_DEFAULT_IDLE);
181 if (signal == Gtk::ResponseType::OK) {
205 if ((signal == Gtk::ResponseType::CANCEL || signal == Gtk::ResponseType::DELETE_EVENT) &&
_effect !=
nullptr) {
212const char *
PrefDialog::live_param_xml =
"<param name=\"__live_effect__\" type=\"bool\" gui-text=\"" N_(
"Live preview")
"\" gui-description=\"" N_(
"Is the effect previewed live on canvas?")
"\">false</param>";
Effects are extensions that take a document and do something to it in place.
void set_pref_dialog(PrefDialog *prefdialog)
void effect(SPDesktop *desktop, SPDocument *document=nullptr)
The function that 'does' the effect itself.
@ STATE_LOADED
The extension has been loaded successfully.
Implementation::Implementation * get_imp()
void set_state(state_t in_state)
A function to set whether the extension should be loaded or unloaded.
bool loaded()
A quick function to test the state of the extension.
virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, SPDesktop *desktop, sigc::signal< void()> *changeSignal, ImplementationDocumentCache *docCache)
Find out information about the file.
static InxParameter * make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext)
Creates a new extension parameter for usage in a prefdialog.
static const char * live_param_xml
XML to define the live effects parameter on the dialog.
void on_response(int signal) override
std::unique_ptr< InxParameter > _param_preview
Parameter to control live preview.
Gtk::CheckButton * _checkbox_preview
Checkbox for the preview.
PrefDialog(Glib::ustring name, Gtk::Widget *controls=nullptr, Effect *effect=nullptr)
Creates a new preference dialog for extension preferences.
sigc::signal< void()> _signal_preview
Signal that the user is changing the live effect state.
Gtk::Button * _button_cancel
A pointer to the CANCEL button.
Gtk::Button * _button_ok
A pointer to the OK button.
sigc::connection _timersig
The timer used to make it so that parameters don't respond directly and allows for changes.
Effect * _effect
If this is the preferences for an effect, the effect that we're working with.
bool param_timer_expire()
Gtk::Widget * _button_preview
Button to control live preview.
std::unique_ptr< ExecutionEnv > _exEnv
If we're executing in preview mode here is the execution environment for the effect.
sigc::signal< void()> _signal_param_change
Signal that one of the parameters change.
virtual Node * root()=0
Get the root node of this node's document.
Typed SVG document implementation.
bool isModifiedSinceSave() const
void setModifiedSinceSave(bool const modified=true)
Indicate to the user if the document has been modified since the last save by displaying a "*" in fro...
A way to clear the N_ macro, which is defined as an inline function.
Event handler for dialog windows.
TODO: insert short description here.
std::vector< Gtk::Widget * > get_children(Gtk::Widget &widget)
Get a vector of the widgetʼs children, from get_first_child() through each get_next_sibling().
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.
Helpers for using Gtk::Boxes, encapsulating large changes between GTK3 & GTK4.
Document * sp_repr_read_mem(const gchar *buffer, gint length, const gchar *default_ns)
Reads and parses XML from a buffer, returning it as an Document.
C facade to Inkscape::XML::Node.
Interface for XML documents.