From 10845e6925978cd9cf5bc9d0961802e06c9b3799 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Mon, 12 Aug 2019 22:49:30 +0200 Subject: Add new parameter of type "path" * Similar to parameter's of type "string": Has a text entry and stores a string preference * Additionally offers a button to show a file chooser dialog * The node's content is the initial (default) file path. * Relative paths will be considered relative to the extension's .inx file. This allows to reference files/folders shipped with the extension in a portable way. The stored value as well as the parameter value passed to the script interpreter will always be absolute, though. * The attribute "mode" controls what type(s) of paths the file chooser allows to select. Valid values: - 'file', 'files', 'folder', 'folder' (pick existing items) - 'file_new', 'folder_new' (create a new file/folder) * Note that manually entered values will be passed as-is without checking for existence. --- src/extension/prefdialog/parameter.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/extension/prefdialog/parameter.cpp') diff --git a/src/extension/prefdialog/parameter.cpp b/src/extension/prefdialog/parameter.cpp index 4519f8b5d..65072f6a8 100644 --- a/src/extension/prefdialog/parameter.cpp +++ b/src/extension/prefdialog/parameter.cpp @@ -25,6 +25,7 @@ #include "parameter-int.h" #include "parameter-notebook.h" #include "parameter-optiongroup.h" +#include "parameter-path.h" #include "parameter-string.h" #include "widget.h" #include "widget-label.h" @@ -79,6 +80,8 @@ InxParameter *InxParameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extensi param = new ParamFloat(in_repr, in_ext); } else if (!strcmp(type, "string")) { param = new ParamString(in_repr, in_ext); + } else if (!strcmp(type, "path")) { + param = new ParamPath(in_repr, in_ext); } else if (!strcmp(type, "description")) { // support deprecated "description" for backwards-compatibility in_repr->setAttribute("gui-text", "description"); // TODO: hack to allow descriptions to be parameters -- cgit v1.2.3