From f7414de1bfeb11007f6cb02ce730c38b660bcc73 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Sun, 11 Aug 2019 22:12:00 +0200 Subject: Add new widget "image" which allows to display an image file * The node's content is the file path. Absolute paths should work, the preferred way is to specify a relative path, though, which will be interpreted relatively to the .inx file's location * The attributes "width/height" allows to override the native size of the image. --- src/extension/prefdialog/widget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/extension/prefdialog/widget.cpp') diff --git a/src/extension/prefdialog/widget.cpp b/src/extension/prefdialog/widget.cpp index da4b6545d..d4f33f7af 100644 --- a/src/extension/prefdialog/widget.cpp +++ b/src/extension/prefdialog/widget.cpp @@ -13,6 +13,7 @@ #include "parameter.h" #include "widget.h" #include "widget-box.h" +#include "widget-image.h" #include "widget-label.h" #include "widget-separator.h" #include "widget-spacer.h" @@ -48,6 +49,8 @@ InxWidget *InxWidget::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex g_warning("InxWidget without name in extension '%s'.", in_ext->get_id()); } else if (!strcmp(name, "hbox") || !strcmp(name, "vbox")) { widget = new WidgetBox(in_repr, in_ext); + } else if (!strcmp(name, "image")) { + widget = new WidgetImage(in_repr, in_ext); } else if (!strcmp(name, "label")) { widget = new WidgetLabel(in_repr, in_ext); } else if (!strcmp(name, "separator")) { @@ -67,7 +70,8 @@ InxWidget *InxWidget::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex bool InxWidget::is_valid_widget_name(const char *name) { // keep in sync with names supported in InxWidget::make() above - static const std::vector valid_names = {"hbox", "vbox", "label", "separator", "spacer", "param"}; + static const std::vector valid_names = + {"hbox", "vbox", "image", "label", "separator", "spacer", "param"}; if (std::find(valid_names.begin(), valid_names.end(), name) != valid_names.end()) { return true; -- cgit v1.2.3