From 8f36429cb5c0b40570e276a832ead7f1c09c59c4 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Thu, 9 Sep 2021 22:17:09 +0200 Subject: [PATCH] ThemeEditor: Save theme metrics and paths to file Prior this change, custom title metrics seen in the Basalt theme and custom icon paths in Redmond themes were dropped when saving a file. Now any entry, even empty, will be saved. This may end up with slightly larger files, but on other hand, users will be able to see every option in a text editor, without a need to look at the code/docs. --- Userland/Applications/ThemeEditor/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index 5ea4e39a0b..54309da4f9 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -145,6 +145,16 @@ int main(int argc, char** argv) theme->write_entry("Colors", to_string(role), preview_widget.preview_palette().color(role).to_string()); } +#define __ENUMERATE_METRIC_ROLE(role) \ + theme->write_num_entry("Metrics", #role, preview_widget.preview_palette().metric(Gfx::MetricRole::role)); + ENUMERATE_METRIC_ROLES(__ENUMERATE_METRIC_ROLE) +#undef __ENUMERATE_METRIC_ROLE + +#define __ENUMERATE_PATH_ROLE(role) \ + theme->write_entry("Paths", #role, preview_widget.preview_palette().path(Gfx::PathRole::role)); + ENUMERATE_PATH_ROLES(__ENUMERATE_PATH_ROLE) +#undef __ENUMERATE_PATH_ROLE + theme->sync(); };