-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathviews.cpp
More file actions
63 lines (54 loc) · 2.53 KB
/
Copy pathviews.cpp
File metadata and controls
63 lines (54 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "content/views/view_hex_editor.hpp"
#include "content/views/view_pattern_editor.hpp"
#include "content/views/view_pattern_data.hpp"
#include "content/views/view_information.hpp"
#include "content/views/view_about.hpp"
#include "content/views/view_tools.hpp"
#include "content/views/view_data_inspector.hpp"
#include "content/views/view_bookmarks.hpp"
#include "content/views/view_patches.hpp"
#include "content/views/view_command_palette.hpp"
#include "content/views/view_settings.hpp"
#include "content/views/view_store.hpp"
#include "content/views/view_provider_settings.hpp"
#include "content/views/view_find.hpp"
#include "content/views/view_theme_manager.hpp"
#include "content/views/view_logs.hpp"
#include "content/views/view_achievements.hpp"
#include "content/views/view_highlight_rules.hpp"
#include "content/views/view_tutorials.hpp"
#include <hex/api/layout_manager.hpp>
namespace hex::plugin::builtin {
void registerViews() {
ContentRegistry::Views::add<ViewHexEditor>();
ContentRegistry::Views::add<ViewPatternEditor>();
ContentRegistry::Views::add<ViewPatternData>();
ContentRegistry::Views::add<ViewDataInspector>();
ContentRegistry::Views::add<ViewInformation>();
ContentRegistry::Views::add<ViewBookmarks>();
ContentRegistry::Views::add<ViewTools>();
ContentRegistry::Views::add<ViewCommandPalette>();
ContentRegistry::Views::add<ViewAbout>();
ContentRegistry::Views::add<ViewSettings>();
ContentRegistry::Views::add<ViewProviderSettings>();
ContentRegistry::Views::add<ViewFind>();
ContentRegistry::Views::add<ViewThemeManager>();
ContentRegistry::Views::add<ViewLogs>();
ContentRegistry::Views::add<ViewHighlightRules>();
LayoutManager::registerLoadCallback([](std::string_view line) {
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
if (!view->shouldStoreWindowState())
continue;
std::string format = fmt::format("{}=%d", view->getUnlocalizedName().get());
sscanf(line.data(), format.c_str(), &view->getWindowOpenState());
}
});
LayoutManager::registerStoreCallback([](ImGuiTextBuffer *buffer) {
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
if (!view->shouldStoreWindowState())
continue;
buffer->appendf("%s=%d\n", name.get().c_str(), view->getWindowOpenState());
}
});
}
}