feat: Added setting to enable colored pattern row backgrounds
This commit is contained in:
parent
88032a85cd
commit
8d20277a62
@ -35,6 +35,7 @@ namespace hex::plugin::builtin::ui {
|
||||
|
||||
void setTreeStyle(TreeStyle style) { this->m_treeStyle = style; }
|
||||
void setSelectionCallback(std::function<void(Region)> callback) { this->m_selectionCallback = std::move(callback); }
|
||||
void enableRowColoring(bool enabled) { this->m_rowColoring = enabled; }
|
||||
void reset();
|
||||
|
||||
private:
|
||||
@ -99,6 +100,7 @@ namespace hex::plugin::builtin::ui {
|
||||
u64 m_editingPatternOffset = 0;
|
||||
|
||||
TreeStyle m_treeStyle = TreeStyle::Default;
|
||||
bool m_rowColoring = false;
|
||||
pl::ptrn::Pattern *m_currVisualizedPattern = nullptr;
|
||||
|
||||
std::set<pl::ptrn::Pattern*> m_visualizedPatterns;
|
||||
|
@ -564,10 +564,9 @@
|
||||
"hex.builtin.setting.interface.multi_windows": "Enable Multi Window support",
|
||||
"hex.builtin.setting.interface.scaling": "Scaling",
|
||||
"hex.builtin.setting.interface.scaling.native": "Native",
|
||||
"hex.builtin.setting.interface.scaling.x0_5": "x0.5",
|
||||
"hex.builtin.setting.interface.scaling.x1_0": "x1.0",
|
||||
"hex.builtin.setting.interface.scaling.x1_5": "x1.5",
|
||||
"hex.builtin.setting.interface.scaling.x2_0": "x2.0",
|
||||
"hex.builtin.setting.interface.style": "Styling",
|
||||
"hex.builtin.setting.interface.window": "Window",
|
||||
"hex.builtin.setting.interface.pattern_data_row_bg": "Enable colored pattern background",
|
||||
"hex.builtin.setting.interface.wiki_explain_language": "Wikipedia Language",
|
||||
"hex.builtin.setting.interface.restore_window_pos": "Restore window position",
|
||||
"hex.builtin.setting.proxy": "Proxy",
|
||||
|
@ -341,7 +341,7 @@ namespace hex::plugin::builtin {
|
||||
themeNames.emplace(themeNames.begin(), ThemeManager::NativeTheme);
|
||||
themeJsons.emplace(themeJsons.begin(), ThemeManager::NativeTheme);
|
||||
|
||||
ContentRegistry::Settings::add<Widgets::DropDown>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.color",
|
||||
ContentRegistry::Settings::add<Widgets::DropDown>("hex.builtin.setting.interface", "hex.builtin.setting.interface.style", "hex.builtin.setting.interface.color",
|
||||
themeNames,
|
||||
themeJsons,
|
||||
"Dark").setChangedCallback([](auto &widget) {
|
||||
@ -355,7 +355,9 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
});
|
||||
|
||||
ContentRegistry::Settings::add<ScalingWidget>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.scaling").requiresRestart();
|
||||
ContentRegistry::Settings::add<ScalingWidget>("hex.builtin.setting.interface", "hex.builtin.setting.interface.style", "hex.builtin.setting.interface.scaling").requiresRestart();
|
||||
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "hex.builtin.setting.interface.style", "hex.builtin.setting.interface.pattern_data_row_bg", false);
|
||||
|
||||
std::vector<std::string> languageNames;
|
||||
std::vector<nlohmann::json> languageCodes;
|
||||
@ -365,10 +367,10 @@ namespace hex::plugin::builtin {
|
||||
languageCodes.emplace_back(languageCode);
|
||||
}
|
||||
|
||||
ContentRegistry::Settings::add<Widgets::DropDown>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.language", languageNames, languageCodes, "en-US");
|
||||
ContentRegistry::Settings::add<Widgets::DropDown>("hex.builtin.setting.interface", "hex.builtin.setting.interface.language", "hex.builtin.setting.interface.language", languageNames, languageCodes, "en-US");
|
||||
|
||||
ContentRegistry::Settings::add<Widgets::TextBox>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.wiki_explain_language", "en");
|
||||
ContentRegistry::Settings::add<FPSWidget>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.fps");
|
||||
ContentRegistry::Settings::add<Widgets::TextBox>("hex.builtin.setting.interface", "hex.builtin.setting.interface.language", "hex.builtin.setting.interface.wiki_explain_language", "en");
|
||||
ContentRegistry::Settings::add<FPSWidget>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window", "hex.builtin.setting.interface.fps");
|
||||
|
||||
#if defined (OS_LINUX)
|
||||
constexpr static auto MultiWindowSupportEnabledDefault = 0;
|
||||
@ -376,8 +378,8 @@ namespace hex::plugin::builtin {
|
||||
constexpr static auto MultiWindowSupportEnabledDefault = 1;
|
||||
#endif
|
||||
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.multi_windows", MultiWindowSupportEnabledDefault).requiresRestart();
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "", "hex.builtin.setting.interface.restore_window_pos", false);
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window", "hex.builtin.setting.interface.multi_windows", MultiWindowSupportEnabledDefault).requiresRestart();
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.interface", "hex.builtin.setting.interface.window", "hex.builtin.setting.interface.restore_window_pos", false);
|
||||
|
||||
ContentRegistry::Settings::add<Widgets::ColorPicker>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.highlight_color", ImColor(0x80, 0x80, 0xC0, 0x60));
|
||||
ContentRegistry::Settings::add<Widgets::Checkbox>("hex.builtin.setting.hex_editor", "", "hex.builtin.setting.hex_editor.sync_scrolling", false);
|
||||
|
@ -161,7 +161,7 @@ namespace hex::plugin::builtin {
|
||||
Contributor { "All other amazing contributors", "Being part of the community, opening issues, PRs and donating", "https://github.com/WerWolv/ImHex/graphs/contributors", false }
|
||||
};
|
||||
|
||||
ImGuiExt::TextFormattedWrapped("These amazing people have contributed some incredible things to ImHex in the past.\nConsider opening a PR on the Git Repository to become a part of them!");
|
||||
ImGuiExt::TextFormattedWrapped("These amazing people have contributed some incredible things to ImHex in the past.\nConsider opening a PR on the Git Repository to take your place among them!");
|
||||
ImGui::NewLine();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2());
|
||||
@ -172,8 +172,7 @@ namespace hex::plugin::builtin {
|
||||
for (const auto &contributor : Contributors) {
|
||||
ImGui::TableNextRow();
|
||||
if (contributor.mainContributor) {
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, ImGui::GetColorU32(ImGuiCol_PlotHistogram) & 0x0FFFFFFF);
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, ImGui::GetColorU32(ImGuiCol_PlotHistogram) & 0x0FFFFFFF);
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, ImGui::GetColorU32(ImGuiCol_PlotHistogram) & 0x1FFFFFFF);
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
|
@ -15,6 +15,9 @@ namespace hex::plugin::builtin {
|
||||
EventManager::subscribe<EventSettingsChanged>(this, [this] {
|
||||
auto patternStyle = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.pattern_tree_style", 0);
|
||||
this->m_patternDrawer->setTreeStyle(patternStyle);
|
||||
|
||||
auto rowColoring = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.pattern_data_row_bg", false);
|
||||
this->m_patternDrawer->enableRowColoring(rowColoring);
|
||||
});
|
||||
|
||||
// Reset the pattern drawer when the provider changes
|
||||
|
@ -229,6 +229,9 @@ namespace hex::plugin::builtin::ui {
|
||||
}
|
||||
|
||||
void PatternDrawer::drawFavoriteColumn(const pl::ptrn::Pattern& pattern) {
|
||||
if (this->m_rowColoring)
|
||||
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, pattern.getColor() & 0x4FFFFFFF);
|
||||
|
||||
if (!this->m_showFavoriteStars) {
|
||||
ImGui::TableNextColumn();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user