mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
impr: More Welcome Screen UI improvements
This commit is contained in:
@@ -115,6 +115,7 @@
|
||||
"hex.builtin.common.range.entire_data": "Entire Data",
|
||||
"hex.builtin.common.range.selection": "Selection",
|
||||
"hex.builtin.common.region": "Region",
|
||||
"hex.builtin.common.remove": "Remove",
|
||||
"hex.builtin.common.reset": "Reset",
|
||||
"hex.builtin.common.set": "Set",
|
||||
"hex.builtin.common.settings": "Settings",
|
||||
@@ -1065,6 +1066,8 @@
|
||||
"hex.builtin.welcome.help.gethelp.link": "https://github.com/WerWolv/ImHex/discussions/categories/get-help",
|
||||
"hex.builtin.welcome.help.repo": "GitHub Repository",
|
||||
"hex.builtin.welcome.help.repo.link": "https://imhex.werwolv.net/git",
|
||||
"hex.builtin.welcome.learn.achievements.title": "Achievement Progress",
|
||||
"hex.builtin.welcome.learn.achievements.desc": "Learn how to use ImHex by completing all achievements",
|
||||
"hex.builtin.welcome.learn.latest.desc": "Read ImHex's current changelog",
|
||||
"hex.builtin.welcome.learn.latest.link": "https://github.com/WerWolv/ImHex/releases/latest",
|
||||
"hex.builtin.welcome.learn.latest.title": "Latest Release",
|
||||
|
||||
@@ -178,19 +178,23 @@ namespace hex::plugin::builtin::recent {
|
||||
const auto &recentEntry = *it;
|
||||
bool shouldRemove = false;
|
||||
|
||||
const bool isProject = recentEntry.type == "project";
|
||||
|
||||
ImGui::PushID(&recentEntry);
|
||||
ON_SCOPE_EXIT { ImGui::PopID(); };
|
||||
|
||||
const char* icon;
|
||||
if (recentEntry.type == "project") {
|
||||
if (isProject) {
|
||||
icon = ICON_VS_PROJECT;
|
||||
} else {
|
||||
icon = ICON_VS_FILE_BINARY;
|
||||
}
|
||||
if (ImGui::BulletHyperlink(hex::format("{} {}", icon, hex::limitStringLength(recentEntry.displayName, 32)).c_str())) {
|
||||
if (ImGui::Hyperlink(hex::format("{} {}", icon, hex::limitStringLength(recentEntry.displayName, 32)).c_str())) {
|
||||
loadRecentEntry(recentEntry);
|
||||
break;
|
||||
}
|
||||
if (!isProject)
|
||||
ImGui::SetItemTooltip("%s", LangEntry(recentEntry.type).get().c_str());
|
||||
|
||||
// Detect right click on recent provider
|
||||
std::string popupID = hex::format("RecentEntryMenu.{}", recentEntry.getHash());
|
||||
@@ -199,7 +203,7 @@ namespace hex::plugin::builtin::recent {
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopup(popupID.c_str())) {
|
||||
if (ImGui::MenuItem("Remove")) {
|
||||
if (ImGui::MenuItem("hex.builtin.common.remove"_lang)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
|
||||
@@ -164,38 +164,46 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextRow(ImGuiTableRowFlags_None, ImGui::GetTextLineHeightWithSpacing() * 6);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
static bool otherProvidersVisible = false;
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5_scaled);
|
||||
ImGui::BeginSubWindow("hex.builtin.welcome.header.start"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
|
||||
|
||||
{
|
||||
if (ImGui::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())
|
||||
hex::ImHexApi::Provider::remove(newProvider);
|
||||
else
|
||||
EventManager::post<EventProviderOpened>(newProvider);
|
||||
auto startPos = ImGui::GetCursorPos();
|
||||
ImGui::BeginSubWindow("hex.builtin.welcome.header.start"_lang, ImVec2(), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
if (ImGui::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())
|
||||
hex::ImHexApi::Provider::remove(newProvider);
|
||||
else
|
||||
EventManager::post<EventProviderOpened>(newProvider);
|
||||
}
|
||||
if (ImGui::IconHyperlink(ICON_VS_GO_TO_FILE, "hex.builtin.welcome.start.open_file"_lang))
|
||||
EventManager::post<RequestOpenWindow>("Open File");
|
||||
if (ImGui::IconHyperlink(ICON_VS_NOTEBOOK, "hex.builtin.welcome.start.open_project"_lang))
|
||||
EventManager::post<RequestOpenWindow>("Open Project");
|
||||
if (ImGui::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
|
||||
otherProvidersVisible = !otherProvidersVisible;
|
||||
}
|
||||
if (ImGui::IconHyperlink(ICON_VS_GO_TO_FILE, "hex.builtin.welcome.start.open_file"_lang))
|
||||
EventManager::post<RequestOpenWindow>("Open File");
|
||||
if (ImGui::IconHyperlink(ICON_VS_NOTEBOOK, "hex.builtin.welcome.start.open_project"_lang))
|
||||
EventManager::post<RequestOpenWindow>("Open Project");
|
||||
if (ImGui::IconHyperlink(ICON_VS_TELESCOPE, "hex.builtin.welcome.start.open_other"_lang))
|
||||
ImGui::OpenPopup("hex.builtin.welcome.start.popup.open_other"_lang);
|
||||
ImGui::EndSubWindow();
|
||||
auto endPos = ImGui::GetCursorPos();
|
||||
|
||||
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + ImGui::GetCursorPos());
|
||||
if (ImGui::BeginPopup("hex.builtin.welcome.start.popup.open_other"_lang)) {
|
||||
if (otherProvidersVisible) {
|
||||
ImGui::SameLine(0, 2_scaled);
|
||||
ImGui::SetCursorPos(ImGui::GetCursorPos() + ImVec2(0, (endPos - startPos).y / 2));
|
||||
ImGui::TextUnformatted(ICON_VS_ARROW_RIGHT);
|
||||
ImGui::SameLine(0, 2_scaled);
|
||||
|
||||
ImGui::BeginSubWindow("hex.builtin.welcome.start.open_other"_lang, ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 6), ImGuiChildFlags_AutoResizeX);
|
||||
for (const auto &unlocalizedProviderName : ContentRegistry::Provider::impl::getEntries()) {
|
||||
if (ImGui::Hyperlink(LangEntry(unlocalizedProviderName))) {
|
||||
ImHexApi::Provider::createProvider(unlocalizedProviderName);
|
||||
ImGui::CloseCurrentPopup();
|
||||
otherProvidersVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
ImGui::EndSubWindow();
|
||||
}
|
||||
}
|
||||
ImGui::EndSubWindow();
|
||||
|
||||
|
||||
// Draw recent entries
|
||||
ImGui::Dummy({});
|
||||
@@ -286,16 +294,23 @@ namespace hex::plugin::builtin {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::BeginSubWindow("hex.builtin.welcome.header.learn"_lang, ImVec2(ImGui::GetContentRegionAvail().x - windowPadding, 0), ImGuiChildFlags_AutoResizeX);
|
||||
{
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.latest.title"_lang, "hex.builtin.welcome.learn.latest.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
|
||||
const auto size = ImVec2(ImGui::GetContentRegionAvail().x, 0);
|
||||
if (ImGui::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);
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.imhex.title"_lang, "hex.builtin.welcome.learn.imhex.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.imhex.title"_lang, "hex.builtin.welcome.learn.imhex.desc"_lang, size)) {
|
||||
AchievementManager::unlockAchievement("hex.builtin.achievement.starting_out", "hex.builtin.achievement.starting_out.docs.name");
|
||||
hex::openWebpage("hex.builtin.welcome.learn.imhex.link"_lang);
|
||||
}
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.pattern.title"_lang, "hex.builtin.welcome.learn.pattern.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.pattern.title"_lang, "hex.builtin.welcome.learn.pattern.desc"_lang, size))
|
||||
hex::openWebpage("hex.builtin.welcome.learn.pattern.link"_lang);
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.plugins.title"_lang, "hex.builtin.welcome.learn.plugins.desc"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0)))
|
||||
if (ImGui::DescriptionButton("hex.builtin.welcome.learn.plugins.title"_lang, "hex.builtin.welcome.learn.plugins.desc"_lang, size))
|
||||
hex::openWebpage("hex.builtin.welcome.learn.plugins.link"_lang);
|
||||
|
||||
if (auto [unlocked, total] = AchievementManager::getProgress(); unlocked != total) {
|
||||
if (ImGui::DescriptionButtonProgress("hex.builtin.welcome.learn.achievements.title"_lang, "hex.builtin.welcome.learn.achievements.desc"_lang, float(unlocked) / float(total), size)) {
|
||||
EventManager::post<RequestOpenWindow>("Achievements");
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndSubWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user