| 24 | namespace hex::plugin::builtin { |
| 25 | |
| 26 | void registerViews() { |
| 27 | ContentRegistry::Views::add<ViewHexEditor>(); |
| 28 | ContentRegistry::Views::add<ViewPatternEditor>(); |
| 29 | ContentRegistry::Views::add<ViewPatternData>(); |
| 30 | ContentRegistry::Views::add<ViewDataInspector>(); |
| 31 | ContentRegistry::Views::add<ViewInformation>(); |
| 32 | ContentRegistry::Views::add<ViewBookmarks>(); |
| 33 | ContentRegistry::Views::add<ViewTools>(); |
| 34 | ContentRegistry::Views::add<ViewCommandPalette>(); |
| 35 | ContentRegistry::Views::add<ViewAbout>(); |
| 36 | ContentRegistry::Views::add<ViewSettings>(); |
| 37 | ContentRegistry::Views::add<ViewConstants>(); |
| 38 | ContentRegistry::Views::add<ViewProviderSettings>(); |
| 39 | ContentRegistry::Views::add<ViewFind>(); |
| 40 | ContentRegistry::Views::add<ViewThemeManager>(); |
| 41 | ContentRegistry::Views::add<ViewLogs>(); |
| 42 | ContentRegistry::Views::add<ViewHighlightRules>(); |
| 43 | |
| 44 | |
| 45 | LayoutManager::registerLoadCallback([](std::string_view line) { |
| 46 | for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) { |
| 47 | if (!view->shouldStoreWindowState()) |
| 48 | continue; |
| 49 | |
| 50 | std::string format = fmt::format("{}=%d", view->getUnlocalizedName().get()); |
| 51 | sscanf(line.data(), format.c_str(), &view->getWindowOpenState()); |
| 52 | } |
| 53 | }); |
| 54 | |
| 55 | LayoutManager::registerStoreCallback([](ImGuiTextBuffer *buffer) { |
| 56 | for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) { |
| 57 | if (!view->shouldStoreWindowState()) |
| 58 | continue; |
| 59 | |
| 60 | buffer->appendf("%s=%d\n", name.get().c_str(), view->getWindowOpenState()); |
| 61 | } |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | } |