aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorv-rob <robinsonvincent89@gmail.com>2020-03-01 06:39:57 -0800
committerGitHub <noreply@github.com>2020-03-01 14:39:57 +0000
commit7dffd08c1a068e5e0748a046fd8a1e884947b597 (patch)
tree867a61698d93c6b107d4432059b8245cabd5f3f3 /src/gui
parent0c08f948d7014e66d5a79d7584c03164af2edd93 (diff)
downloadminetest-7dffd08c1a068e5e0748a046fd8a1e884947b597.tar.gz
minetest-7dffd08c1a068e5e0748a046fd8a1e884947b597.tar.bz2
minetest-7dffd08c1a068e5e0748a046fd8a1e884947b597.zip
Add multiple element selection to `style` and `style_type` (#9380)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/guiFormSpecMenu.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 40c3bbdae..d892555b3 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -2450,13 +2450,6 @@ bool GUIFormSpecMenu::parseStyle(parserData *data, const std::string &element, b
return false;
}
- std::string selector = trim(parts[0]);
- if (selector.empty()) {
- errorstream << "Invalid style element (Selector required): '" << element
- << "'" << std::endl;
- return false;
- }
-
StyleSpec spec;
for (size_t i = 1; i < parts.size(); i++) {
@@ -2486,10 +2479,21 @@ bool GUIFormSpecMenu::parseStyle(parserData *data, const std::string &element, b
spec.set(prop, value);
}
- if (style_type) {
- theme_by_type[selector] |= spec;
- } else {
- theme_by_name[selector] |= spec;
+ std::vector<std::string> selectors = split(parts[0], ',');
+ for (size_t sel = 0; sel < selectors.size(); sel++) {
+ std::string selector = trim(selectors[sel]);
+
+ if (selector.empty()) {
+ errorstream << "Invalid style element (Empty selector): '" << element
+ << "'" << std::endl;
+ continue;
+ }
+
+ if (style_type) {
+ theme_by_type[selector] |= spec;
+ } else {
+ theme_by_name[selector] |= spec;
+ }
}
return true;