diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-08-11 20:12:00 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-08-31 14:50:39 +0000 |
| commit | f7414de1bfeb11007f6cb02ce730c38b660bcc73 (patch) | |
| tree | 2258e60484b5a8cde5095d149b6d152b17085426 /src/extension/prefdialog/widget.cpp | |
| parent | Add base_directory for extensions loaded from a file. (diff) | |
| download | inkscape-f7414de1bfeb11007f6cb02ce730c38b660bcc73.tar.gz inkscape-f7414de1bfeb11007f6cb02ce730c38b660bcc73.zip | |
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.
Diffstat (limited to 'src/extension/prefdialog/widget.cpp')
| -rw-r--r-- | src/extension/prefdialog/widget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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<std::string> valid_names = {"hbox", "vbox", "label", "separator", "spacer", "param"}; + static const std::vector<std::string> valid_names = + {"hbox", "vbox", "image", "label", "separator", "spacer", "param"}; if (std::find(valid_names.begin(), valid_names.end(), name) != valid_names.end()) { return true; |
