summaryrefslogtreecommitdiffstats
path: root/src/extension/prefdialog/parameter.cpp
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-08-12 20:49:30 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-08-31 14:50:39 +0000
commit10845e6925978cd9cf5bc9d0961802e06c9b3799 (patch)
treed9c6493e7198f1f8c6e94b010e7f03cb5401a893 /src/extension/prefdialog/parameter.cpp
parentAdjust <print> extensions for previous commit. (diff)
downloadinkscape-10845e6925978cd9cf5bc9d0961802e06c9b3799.tar.gz
inkscape-10845e6925978cd9cf5bc9d0961802e06c9b3799.zip
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.
Diffstat (limited to 'src/extension/prefdialog/parameter.cpp')
-rw-r--r--src/extension/prefdialog/parameter.cpp3
1 files changed, 3 insertions, 0 deletions
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