feat: Fix sub menus, allow recent items to be collapsed
This commit is contained in:
parent
c1561c7b6a
commit
ba7c10f4b1
@ -286,7 +286,7 @@ namespace ImGuiExt {
|
||||
bool BeginBox();
|
||||
void EndBox();
|
||||
|
||||
void BeginSubWindow(const char *label, ImVec2 size = ImVec2(0, 0), ImGuiChildFlags flags = ImGuiChildFlags_None);
|
||||
bool BeginSubWindow(const char *label, bool *collapsed = nullptr, ImVec2 size = ImVec2(0, 0), ImGuiChildFlags flags = ImGuiChildFlags_None);
|
||||
void EndSubWindow();
|
||||
|
||||
void ConfirmButtons(const char *textLeft, const char *textRight, const auto &leftButtonCallback, const auto &rightButtonCallback) {
|
||||
|
@ -1158,17 +1158,38 @@ namespace ImGuiExt {
|
||||
PopStyleVar();
|
||||
}
|
||||
|
||||
void BeginSubWindow(const char *label, ImVec2 size, ImGuiChildFlags flags) {
|
||||
bool BeginSubWindow(const char *label, bool *collapsed, ImVec2 size, ImGuiChildFlags flags) {
|
||||
const bool hasMenuBar = !std::string_view(label).empty();
|
||||
|
||||
bool result = false;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0F);
|
||||
if (ImGui::BeginChild(hex::format("{}##SubWindow", label).c_str(), size, ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY | flags, hasMenuBar ? ImGuiWindowFlags_MenuBar : ImGuiWindowFlags_None)) {
|
||||
result = true;
|
||||
|
||||
if (hasMenuBar && ImGui::BeginMenuBar()) {
|
||||
ImGui::TextUnformatted(label);
|
||||
if (collapsed == nullptr)
|
||||
ImGui::TextUnformatted(label);
|
||||
else {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, ImGui::GetStyle().FramePadding.y));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, 0x00);
|
||||
if (ImGui::Button(label))
|
||||
*collapsed = !*collapsed;
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
if (collapsed != nullptr && *collapsed) {
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - (ImGui::GetStyle().FramePadding.y * 2));
|
||||
ImGui::TextDisabled("...");
|
||||
result = false;
|
||||
ImGui::EndChild();
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void EndSubWindow() {
|
||||
|
@ -269,8 +269,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw telemetry subwindow
|
||||
ImGui::SetCursorPos((windowSize - subWindowSize) / 2);
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.oobe.server_contact"_lang, subWindowSize, ImGuiChildFlags_AutoResizeY);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.oobe.server_contact"_lang, nullptr, subWindowSize, ImGuiChildFlags_AutoResizeY)) {
|
||||
// Draw telemetry information
|
||||
auto yBegin = ImGui::GetCursorPosY();
|
||||
std::string message = "hex.builtin.oobe.server_contact.text"_lang;
|
||||
@ -356,8 +355,9 @@ namespace hex::plugin::builtin {
|
||||
auto yEnd = ImGui::GetCursorPosY();
|
||||
subWindowSize = ImGui::GetWindowSize();
|
||||
subWindowSize.y = (yEnd - yBegin) + 35_scaled;
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -243,8 +243,8 @@ namespace hex::plugin::builtin::recent {
|
||||
if (s_recentEntries.empty() && !s_autoBackupsFound)
|
||||
return;
|
||||
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.start.recent"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
static bool collapsed = false;
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.start.recent"_lang, &collapsed, ImVec2(), ImGuiChildFlags_AutoResizeX)) {
|
||||
if (!s_recentEntriesUpdating) {
|
||||
for (auto it = s_recentEntries.begin(); it != s_recentEntries.end();) {
|
||||
const auto &recentEntry = *it;
|
||||
@ -327,8 +327,9 @@ namespace hex::plugin::builtin::recent {
|
||||
PopupAutoBackups::open();
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
|
||||
void addMenuItems() {
|
||||
|
@ -450,8 +450,7 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Draw toolbar icon box
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.setting.toolbar.icons"_lang, ImGui::GetContentRegionAvail());
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.setting.toolbar.icons"_lang, nullptr, ImGui::GetContentRegionAvail())) {
|
||||
if (ImGui::BeginTable("##icons", 6, ImGuiTableFlags_SizingStretchSame, ImGui::GetContentRegionAvail())) {
|
||||
ImGui::TableNextRow();
|
||||
|
||||
@ -553,8 +552,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
// Handle dropping menu items onto the toolbar box
|
||||
if (ImGui::BeginDragDropTarget()) {
|
||||
|
@ -128,11 +128,11 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiExt::BeginSubWindow("Build Information", ImVec2(450_scaled, 0), ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("Build Information", nullptr, ImVec2(450_scaled, 0), ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY)) {
|
||||
this->drawBuildInformation();
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
@ -243,9 +243,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
static void drawContributorTable(const char *title, const auto &contributors) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2());
|
||||
ImGuiExt::BeginSubWindow(title, ImVec2(ImGui::GetContentRegionAvail().x, 0), ImGuiChildFlags_AutoResizeX);
|
||||
auto result = ImGuiExt::BeginSubWindow(title, nullptr, ImVec2(ImGui::GetContentRegionAvail().x, 0), ImGuiChildFlags_AutoResizeX);
|
||||
ImGui::PopStyleVar();
|
||||
{
|
||||
if (result) {
|
||||
if (ImGui::BeginTable(title, 1, ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders)) {
|
||||
for (const auto &contributor : contributors) {
|
||||
ImGui::TableNextRow();
|
||||
@ -266,8 +266,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
|
||||
void ViewAbout::drawContributorPage() {
|
||||
@ -348,8 +349,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
constexpr static auto drawTable = [](const char *category, const auto &libraries) {
|
||||
const auto width = ImGui::GetContentRegionAvail().x;
|
||||
ImGuiExt::BeginSubWindow(category);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow(category)) {
|
||||
for (const auto &library : libraries) {
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetColorU32(ImGuiCol_TableHeaderBg));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 50);
|
||||
@ -370,8 +370,9 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
ImGui::NewLine();
|
||||
};
|
||||
@ -388,9 +389,10 @@ namespace hex::plugin::builtin {
|
||||
const auto &plugins = PluginManager::getPlugins();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2());
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.view.help.about.plugins"_lang);
|
||||
auto result = ImGuiExt::BeginSubWindow("hex.builtin.view.help.about.plugins"_lang);
|
||||
ImGui::PopStyleVar();
|
||||
{
|
||||
|
||||
if (result) {
|
||||
if (ImGui::BeginTable("plugins", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupScrollFreeze(0, 1);
|
||||
ImGui::TableSetupColumn("hex.builtin.view.help.about.plugins.plugin"_lang);
|
||||
@ -406,8 +408,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
|
||||
void ViewAbout::drawPluginRow(const hex::Plugin& plugin) {
|
||||
@ -479,8 +482,7 @@ namespace hex::plugin::builtin {
|
||||
static_assert(PathTypes.back().first != nullptr, "All path items need to be populated!");
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2());
|
||||
ImGuiExt::BeginSubWindow("Paths", ImGui::GetContentRegionAvail());
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("Paths", nullptr, ImGui::GetContentRegionAvail())) {
|
||||
if (ImGui::BeginTable("##imhex_paths", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupScrollFreeze(0, 1);
|
||||
ImGui::TableSetupColumn("Type");
|
||||
@ -508,8 +510,9 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
}
|
||||
@ -722,12 +725,14 @@ namespace hex::plugin::builtin {
|
||||
if (commits.empty()) return;
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2());
|
||||
ImGuiExt::BeginSubWindow("Commits", ImGui::GetContentRegionAvail());
|
||||
auto result = ImGuiExt::BeginSubWindow("Commits", nullptr, ImGui::GetContentRegionAvail());
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
this->drawCommitsTable(commits);
|
||||
if (result) {
|
||||
this->drawCommitsTable(commits);
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewAbout::drawCommitsTable(const auto& commits) {
|
||||
|
@ -228,8 +228,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
|
||||
void ViewHighlightRules::drawRulesConfig() {
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.view.highlight_rules.config"_lang, ImGui::GetContentRegionAvail());
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.view.highlight_rules.config"_lang, nullptr, ImGui::GetContentRegionAvail())) {
|
||||
if (m_selectedRule != m_rules->end()) {
|
||||
|
||||
// Draw text input field for the rule name
|
||||
@ -297,8 +296,9 @@ namespace hex::plugin::builtin {
|
||||
} else {
|
||||
ImGuiExt::TextFormattedCentered("hex.builtin.view.highlight_rules.no_rule"_lang);
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,8 +102,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
// Draw settings window
|
||||
ImGui::BeginDisabled(analysis.task.isRunning());
|
||||
ImGuiExt::BeginSubWindow("hex.ui.common.settings"_lang);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.ui.common.settings"_lang)) {
|
||||
// Create a table so we can draw global settings on the left and section specific settings on the right
|
||||
if (ImGui::BeginTable("SettingsTable", 2, ImGuiTableFlags_BordersInner | ImGuiTableFlags_SizingStretchProp, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
ImGui::TableSetupColumn("Left", ImGuiTableColumnFlags_WidthStretch, 0.3F);
|
||||
@ -147,8 +146,9 @@ namespace hex::plugin::builtin {
|
||||
ImGui::SetCursorPosX(50_scaled);
|
||||
if (ImGuiExt::DimmedButton("hex.builtin.view.information.analyze"_lang, ImVec2(ImGui::GetContentRegionAvail().x - 50_scaled, 0)))
|
||||
this->analyze();
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (analysis.analyzedProvider != nullptr) {
|
||||
|
@ -97,8 +97,7 @@ namespace hex::plugin::builtin {
|
||||
if (subCategory.entries.empty())
|
||||
continue;
|
||||
|
||||
ImGuiExt::BeginSubWindow(Lang(subCategory.unlocalizedName));
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow(Lang(subCategory.unlocalizedName))) {
|
||||
for (auto &setting : subCategory.entries) {
|
||||
ImGui::BeginDisabled(!setting.widget->isEnabled());
|
||||
ImGui::PushItemWidth(-200_scaled);
|
||||
@ -131,8 +130,9 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGui::NewLine();
|
||||
}
|
||||
}
|
||||
|
@ -55,11 +55,11 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
if (m_selectedTutorial != nullptr) {
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.view.tutorials.description"_lang, ImGui::GetContentRegionAvail() - ImVec2(0, ImGui::GetTextLineHeightWithSpacing() + ImGui::GetStyle().ItemSpacing.y * 2));
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.view.tutorials.description"_lang, nullptr, ImGui::GetContentRegionAvail() - ImVec2(0, ImGui::GetTextLineHeightWithSpacing() + ImGui::GetStyle().ItemSpacing.y * 2))) {
|
||||
ImGuiExt::TextFormattedWrapped(Lang(m_selectedTutorial->getUnlocalizedDescription()));
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
ImGui::BeginDisabled(currTutorial != tutorials.end());
|
||||
if (ImGuiExt::DimmedButton("hex.builtin.view.tutorials.start"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
|
@ -212,8 +212,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
{
|
||||
auto startPos = ImGui::GetCursorPos();
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.start"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.start"_lang, nullptr, ImVec2(), ImGuiChildFlags_AutoResizeX)) {
|
||||
if (ImGuiExt::IconHyperlink(ICON_VS_NEW_FILE, "hex.builtin.welcome.start.create_file"_lang)) {
|
||||
auto newProvider = hex::ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
|
||||
if (newProvider != nullptr && !newProvider->open())
|
||||
@ -227,8 +226,9 @@ namespace hex::plugin::builtin {
|
||||
RequestOpenWindow::post("Open Project");
|
||||
if (ImGuiExt::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
|
||||
otherProvidersVisible = !otherProvidersVisible;
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
auto endPos = ImGui::GetCursorPos();
|
||||
|
||||
if (otherProvidersVisible) {
|
||||
@ -237,14 +237,16 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TextUnformatted(ICON_VS_ARROW_RIGHT);
|
||||
ImGui::SameLine(0, 2_scaled);
|
||||
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.start.open_other"_lang, ImVec2(200_scaled, ImGui::GetTextLineHeightWithSpacing() * 6), ImGuiChildFlags_AutoResizeX);
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::impl::getEntries()) {
|
||||
if (ImGuiExt::Hyperlink(Lang(unlocalizedProviderName))) {
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
otherProvidersVisible = false;
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.start.open_other"_lang, nullptr, ImVec2(200_scaled, ImGui::GetTextLineHeightWithSpacing() * 6), ImGuiChildFlags_AutoResizeX)) {
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::impl::getEntries()) {
|
||||
if (ImGuiExt::Hyperlink(Lang(unlocalizedProviderName))) {
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
otherProvidersVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,13 +258,13 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled);
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.help"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.help"_lang, nullptr, ImVec2(), ImGuiChildFlags_AutoResizeX)) {
|
||||
if (ImGuiExt::IconHyperlink(ICON_VS_GITHUB, "hex.builtin.welcome.help.repo"_lang)) hex::openWebpage("hex.builtin.welcome.help.repo.link"_lang);
|
||||
if (ImGuiExt::IconHyperlink(ICON_VS_ORGANIZATION, "hex.builtin.welcome.help.gethelp"_lang)) hex::openWebpage("hex.builtin.welcome.help.gethelp.link"_lang);
|
||||
if (ImGuiExt::IconHyperlink(ICON_VS_COMMENT_DISCUSSION, "hex.builtin.welcome.help.discord"_lang)) hex::openWebpage("hex.builtin.welcome.help.discord.link"_lang);
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
if (ImHexApi::System::getInitArguments().contains("update-available")) {
|
||||
ImGui::TableNextRow();
|
||||
@ -281,17 +283,16 @@ namespace hex::plugin::builtin {
|
||||
|
||||
auto windowPadding = ImGui::GetStyle().WindowPadding.x * 3;
|
||||
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.customize"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.customize"_lang, nullptr, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX)) {
|
||||
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.customize.settings.title"_lang, "hex.builtin.welcome.customize.settings.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
|
||||
RequestOpenWindow::post("Settings");
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.learn"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.learn"_lang, nullptr, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX)) {
|
||||
const auto size = ImVec2(ImGui::GetContentRegionAvail().x, 0);
|
||||
if (ImGuiExt::DescriptionButton("hex.builtin.welcome.learn.latest.title"_lang, "hex.builtin.welcome.learn.latest.desc"_lang, size))
|
||||
hex::openWebpage("hex.builtin.welcome.learn.latest.link"_lang);
|
||||
@ -314,20 +315,21 @@ namespace hex::plugin::builtin {
|
||||
RequestOpenWindow::post("Achievements");
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
auto extraWelcomeScreenEntries = ContentRegistry::Interface::impl::getWelcomeScreenEntries();
|
||||
if (!extraWelcomeScreenEntries.empty()) {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 5);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.various"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0));
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.various"_lang, nullptr, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0))) {
|
||||
for (const auto &callback : extraWelcomeScreenEntries)
|
||||
callback();
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
|
||||
if (s_infoBannerTexture.isValid()) {
|
||||
@ -335,8 +337,8 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImGui::GetStyleColorVec4(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Border));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.info"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.info"_lang, nullptr, ImVec2(), ImGuiChildFlags_AutoResizeX)) {
|
||||
const auto height = 80_scaled;
|
||||
ImGui::Image(s_infoBannerTexture, ImVec2(height * s_infoBannerTexture.getAspectRatio(), height));
|
||||
hovered = ImGui::IsItemHovered();
|
||||
@ -344,8 +346,9 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::IsItemClicked()) {
|
||||
hex::openWebpage(ImHexApiURL + hex::format("/info/{}/link", hex::toLower(ImHexApi::System::getOSName())));
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
@ -372,8 +375,12 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowShadow, 0x00);
|
||||
if (ImGui::Begin("ImHexDockSpace")) {
|
||||
if (!ImHexApi::Provider::isValid()) {
|
||||
static std::array<char, 256> title;
|
||||
ImFormatString(title.data(), title.size(), "%s/DockSpace_%08X", ImGui::GetCurrentWindowRead()->Name, ImGui::GetID("ImHexMainDock"));
|
||||
static auto title = []{
|
||||
std::array<char, 256> title = {};
|
||||
ImFormatString(title.data(), title.size(), "%s/DockSpace_%08X", ImGui::GetCurrentWindowRead()->Name, ImGui::GetID("ImHexMainDock"));
|
||||
return title;
|
||||
}();
|
||||
|
||||
if (ImGui::Begin(title.data(), nullptr, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus)) {
|
||||
ImGui::Dummy({});
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, scaled({ 10, 10 }));
|
||||
@ -398,14 +405,14 @@ namespace hex::plugin::builtin {
|
||||
const ImVec2 windowSize = scaled({ 150, 60 });
|
||||
ImGui::SetCursorScreenPos(ImGui::GetWindowPos() + ImGui::GetWindowSize() - windowSize - ImGui::GetStyle().WindowPadding);
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg));
|
||||
ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.quick_settings"_lang, windowSize, ImGuiChildFlags_AutoResizeY);
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.quick_settings"_lang, nullptr, windowSize, ImGuiChildFlags_AutoResizeY)) {
|
||||
if (ImGuiExt::ToggleSwitch("hex.builtin.welcome.quick_settings.simplified"_lang, &s_simplifiedWelcomeScreen)) {
|
||||
ContentRegistry::Settings::write<bool>("hex.builtin.setting.interface", "hex.builtin.setting.interface.simplified_welcome_screen", s_simplifiedWelcomeScreen);
|
||||
WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default");
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
ImGui::PopStyleColor();
|
||||
hovered = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
|
||||
|
||||
|
@ -75,14 +75,14 @@ namespace hex::plugin::yara {
|
||||
continue;
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGuiExt::BeginSubWindow(categoryName.c_str());
|
||||
{
|
||||
if (ImGuiExt::BeginSubWindow(categoryName.c_str())) {
|
||||
for (const auto &match : category.matchedRules) {
|
||||
const auto &ruleName = match.metadata.contains("name") ? match.metadata.at("name") : match.identifier;
|
||||
ImGui::TextUnformatted(ruleName.c_str());
|
||||
}
|
||||
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
|
Loading…
x
Reference in New Issue
Block a user