Skip to content

Commit

Permalink
feat: add getter for parameter tooltip/description
Browse files Browse the repository at this point in the history
Also collapse consecutive whitespace in parameter description into single space

Signed-off-by: Christopher Arndt <[email protected]>
  • Loading branch information
SpotlightKid committed Nov 25, 2024
1 parent 006f898 commit 779e572
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions faustdoctor/architectures/generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ const char *{{Identifier}}::parameter_short_label(unsigned index) noexcept
}
}

const char *{{Identifier}}::parameter_description(unsigned index) noexcept
{
switch (index) {
{% for w in active + passive %}{% if w.tooltip %}
case {{loop.index0}}:
return {{cstr(w.tooltip)}};
{%- endif %}{% endfor %}
default:
return 0;
}
}

const char *{{Identifier}}::parameter_style(unsigned index) noexcept
{
switch (index) {
Expand Down
1 change: 1 addition & 0 deletions faustdoctor/architectures/generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class {{Identifier}} {
static const char *parameter_group_symbol(unsigned group_id) noexcept;
static const char *parameter_label(unsigned index) noexcept;
static const char *parameter_short_label(unsigned index) noexcept;
static const char *parameter_description(unsigned index) noexcept;
static const char *parameter_style(unsigned index) noexcept;
static const char *parameter_symbol(unsigned index) noexcept;
static const char *parameter_unit(unsigned index) noexcept;
Expand Down
2 changes: 1 addition & 1 deletion faustdoctor/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def extract_widget(node: ET.Element, is_active: bool, md: Metadata) -> Widget:
elif key == "symbol":
w.symbol = mangle(value)
elif key == "tooltip":
w.tooltip = value
w.tooltip = re.sub(r'\s+', ' ', value)
elif key == "unit":
w.unit = value

Expand Down

0 comments on commit 779e572

Please sign in to comment.