commit de41f458
Add option to switch board back
Changed files
| M | source/code/menudef_themes.cpp before |
| M | source/code/themes.cpp before |
| M | source/code/themes.hpp before |
diff --git a/source/code/menudef_themes.cpp b/source/code/menudef_themes.cpp
index d5140f5..87e328c 100644
--- a/source/code/menudef_themes.cpp
+++ b/source/code/menudef_themes.cpp
@@ -84,6 +84,11 @@ static void themesEditSwitchBackground() {
globalData.theme = themeToEdit;
}
+static void themesEditSwitchBoardBackground() {
+ themeToEdit.back_board = ThemesGetNextBoardBackground(themeToEdit.back_board);
+ globalData.theme = themeToEdit;
+}
+
static void themesEditSlot1() {
ThemesMenu tem(globalData.screen, _("Edit custom theme 1"), true);
size_t theme_index = ThemeGetNumber("custom_slot_1");
@@ -95,6 +100,10 @@ static void themesEditSlot1() {
bSwitchBackground.setLabel(_("Switch background"));
bSwitchBackground.setAction(&themesEditSwitchBackground);
tem.addButton(&bSwitchBackground);
+ Button bSwitchBoardBackground;
+ bSwitchBoardBackground.setLabel(_("Switch board background"));
+ bSwitchBoardBackground.setAction(&themesEditSwitchBoardBackground);
+ tem.addButton(&bSwitchBoardBackground);
themeBackup = globalData.theme;
themeToEdit = ThemesGet(theme_index);
globalData.theme = themeToEdit;
diff --git a/source/code/themes.cpp b/source/code/themes.cpp
index 4bd860c..4899875 100644
--- a/source/code/themes.cpp
+++ b/source/code/themes.cpp
@@ -296,3 +296,16 @@ BackGroundData ThemesGetNextBackground(const std::string& current) {
}
return ret;
}
+
+std::string ThemesGetNextBoardBackground(const std::string& current) {
+ ThemesInit();
+ std::vector<std::string> back_boards = {"back_board", "back_board_sample_snow", "trans_cover"};
+ std::string ret = "back_board";
+ for (size_t i = 0; i < back_boards.size(); ++i) {
+ if (back_boards[i] == current) {
+ ret = back_boards[(i + 1) % back_boards.size()];
+ break;
+ }
+ }
+ return ret;
+}
diff --git a/source/code/themes.hpp b/source/code/themes.hpp
index fd04a03..397e098 100644
--- a/source/code/themes.hpp
+++ b/source/code/themes.hpp
@@ -90,4 +90,6 @@ void ThemesSaveCustomSlots();
*/
size_t ThemeGetNumber(const std::string& name);
-BackGroundData ThemesGetNextBackground(const std::string& current);
\ No newline at end of file
+BackGroundData ThemesGetNextBackground(const std::string& current);
+
+std::string ThemesGetNextBoardBackground(const std::string& current);
\ No newline at end of file