From 6dee0833520e06a8e97a85c3c76122d0af38d89f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Oct 2019 12:41:45 +0200 Subject: [PATCH] GRAPHICS: MACGUI: Added debug printout for MacMenu --- graphics/macgui/macmenu.cpp | 24 ++++++++++++++++++++++++ graphics/macgui/macmenu.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index c22e3a08602..81208c0c352 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -276,9 +276,33 @@ MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager } } delete menuData; + + menu->printMenu(); + return menu; } +void MacMenu::printMenu(int level, MacMenuSubMenu *submenu) { + if (!level) { + for (int i = 0; i < _items.size(); i++) { + debug("%s", _items[i]->unicode ? convertFromU32String(_items[i]->unicodeName).c_str() : _items[i]->name.c_str()); + + if (_items[i]->submenu != nullptr) + printMenu(level + 1, _items[i]->submenu); + } + } else { + for (int j = 0; j < level; j++) + debugN(" "); + + for (int i = 0; i < submenu->subitems.size(); i++) { + debug("%s", submenu->subitems[i]->unicode ? convertFromU32String(submenu->subitems[i]->unicodeText).c_str() : submenu->subitems[i]->text.c_str()); + + if (submenu->subitems[i]->submenu != nullptr) + printMenu(level + 1, submenu->subitems[i]->submenu); + } + } +} + void MacMenu::addStaticMenus(const MacMenuData *data) { MacMenuItem *about = new MacMenuItem(_wm->_fontMan->hasBuiltInFonts() ? "\xa9" : "\xf0"); // (c) Symbol as the most resembling apple _items.push_back(about); diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h index 012ea5f6090..1239cebcd7c 100644 --- a/graphics/macgui/macmenu.h +++ b/graphics/macgui/macmenu.h @@ -107,6 +107,8 @@ private: void drawSubMenuArrow(ManagedSurface *dst, int x, int y, int color); + void printMenu(int level = 0, MacMenuSubMenu *submenu = nullptr); + Common::Array _items; const Font *_font;