From dd81e79d9e6362e448edcdbe17600180f9df8a48 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 11 Nov 2019 19:35:14 -0500 Subject: [PATCH] Add tag::getTag(). --- include/tag.hpp | 2 ++ src/app/ModuleWidget.cpp | 2 +- src/tag.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/tag.hpp b/include/tag.hpp index 57d37703..d26b6e2e 100644 --- a/include/tag.hpp +++ b/include/tag.hpp @@ -23,6 +23,8 @@ Returns -1 if not found. */ int findId(const std::string& tag); +std::string getTag(int tagId); + } // namespace tag } // namespace rack diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 4a0b525c..e8d9e71a 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -56,7 +56,7 @@ struct ModuleInfoItem : ui::MenuItem { for (int tagId : model->tags) { ui::MenuLabel* tagLabel = new ui::MenuLabel; - tagLabel->text = tag::tagAliases[tagId][0]; + tagLabel->text = tag::getTag(tagId); menu->addChild(tagLabel); } diff --git a/src/tag.cpp b/src/tag.cpp index 3557f915..44ae3422 100644 --- a/src/tag.cpp +++ b/src/tag.cpp @@ -79,5 +79,11 @@ int findId(const std::string& tag) { } +std::string getTag(int tagId) { + assert(0 <= tagId && tagId < (int) tagAliases.size()); + return tagAliases[tagId][0]; +} + + } // namespace tag } // namespace rack