ui: Added some hint text for in/out variable tab, improved centered hints
This commit is contained in:
parent
65212f22a6
commit
a66fec489c
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
#include <imgui_internal.h>
|
||||||
|
|
||||||
#include <hex/helpers/fmt.hpp>
|
#include <hex/helpers/fmt.hpp>
|
||||||
|
|
||||||
@ -105,4 +107,16 @@ namespace ImGui {
|
|||||||
void TextFormattedWrapped(const std::string &fmt, auto&& ... args) {
|
void TextFormattedWrapped(const std::string &fmt, auto&& ... args) {
|
||||||
ImGui::TextWrapped("%s", hex::format(fmt, std::forward<decltype(args)>(args)...).c_str());
|
ImGui::TextWrapped("%s", hex::format(fmt, std::forward<decltype(args)>(args)...).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextFormattedCentered(const std::string &fmt, auto&& ... args) {
|
||||||
|
auto text = hex::format(fmt);
|
||||||
|
auto availableSpace = ImGui::GetContentRegionAvail();
|
||||||
|
auto textSize = ImGui::CalcTextSize(text.c_str(), nullptr, false, availableSpace.x * 0.75F);
|
||||||
|
|
||||||
|
ImGui::SetCursorPos(((availableSpace - textSize) / 2.0F));
|
||||||
|
|
||||||
|
ImGui::PushTextWrapPos(availableSpace.x * 0.75F);
|
||||||
|
ImGui::TextFormattedWrapped("{}", text);
|
||||||
|
ImGui::PopTextWrapPos();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,7 +1,5 @@
|
|||||||
#include <hex/api/content_registry.hpp>
|
#include <hex/api/content_registry.hpp>
|
||||||
|
|
||||||
#include <imgui.h>
|
|
||||||
#include <imgui_internal.h>
|
|
||||||
#include <hex/views/view.hpp>
|
#include <hex/views/view.hpp>
|
||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
@ -57,12 +57,7 @@ namespace hex::plugin::builtin {
|
|||||||
auto &bookmarks = ImHexApi::Bookmarks::getEntries();
|
auto &bookmarks = ImHexApi::Bookmarks::getEntries();
|
||||||
|
|
||||||
if (bookmarks.empty()) {
|
if (bookmarks.empty()) {
|
||||||
std::string text = "hex.builtin.view.bookmarks.no_bookmarks"_lang;
|
ImGui::TextFormattedCentered("hex.builtin.view.bookmarks.no_bookmarks"_lang);
|
||||||
auto textSize = ImGui::CalcTextSize(text.c_str());
|
|
||||||
auto availableSpace = ImGui::GetContentRegionAvail();
|
|
||||||
|
|
||||||
ImGui::SetCursorPos((availableSpace - textSize) / 2.0F);
|
|
||||||
ImGui::TextUnformatted(text.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 id = 1;
|
u32 id = 1;
|
||||||
|
@ -290,6 +290,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.pattern_editor.settings", "Einstellungen" },
|
{ "hex.builtin.view.pattern_editor.settings", "Einstellungen" },
|
||||||
{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Gefährliche funktion erlauben?" },
|
{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Gefährliche funktion erlauben?" },
|
||||||
{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "Dieses Pattern hat versucht eine gefährliche Funktion aufzurufen.\nBist du sicher, dass du diesem Pattern vertraust?" },
|
{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "Dieses Pattern hat versucht eine gefährliche Funktion aufzurufen.\nBist du sicher, dass du diesem Pattern vertraust?" },
|
||||||
|
{ "hex.builtin.view.pattern_editor.no_in_out_vars", "Definiere einige globale Variablen mit dem 'in' oder 'out' specifier damit diese hier auftauchen." },
|
||||||
|
|
||||||
{ "hex.builtin.view.pattern_data.name", "Pattern Daten" },
|
{ "hex.builtin.view.pattern_data.name", "Pattern Daten" },
|
||||||
{ "hex.builtin.view.pattern_data.var_name", "Name" },
|
{ "hex.builtin.view.pattern_data.var_name", "Name" },
|
||||||
|
@ -293,6 +293,7 @@ namespace hex::plugin::builtin {
|
|||||||
{ "hex.builtin.view.pattern_editor.settings", "Settings" },
|
{ "hex.builtin.view.pattern_editor.settings", "Settings" },
|
||||||
{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Allow dangerous function?" },
|
{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Allow dangerous function?" },
|
||||||
{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "This pattern tried to call a dangerous function.\nAre you sure you want to trust this pattern?" },
|
{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "This pattern tried to call a dangerous function.\nAre you sure you want to trust this pattern?" },
|
||||||
|
{ "hex.builtin.view.pattern_editor.no_in_out_vars", "Define some global variables with the 'in' or 'out' specifier for them to appear here." },
|
||||||
|
|
||||||
{ "hex.builtin.view.pattern_data.name", "Pattern Data" },
|
{ "hex.builtin.view.pattern_data.name", "Pattern Data" },
|
||||||
{ "hex.builtin.view.pattern_data.var_name", "Name" },
|
{ "hex.builtin.view.pattern_data.var_name", "Name" },
|
||||||
|
@ -290,6 +290,7 @@ namespace hex::plugin::builtin {
|
|||||||
//{ "hex.builtin.view.pattern_editor.settings", "Settings" },
|
//{ "hex.builtin.view.pattern_editor.settings", "Settings" },
|
||||||
//{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Allow dangerous function?" },
|
//{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Allow dangerous function?" },
|
||||||
//{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "This pattern tried to call a dangerous function.\nAre you sure you want to trust this pattern?" },
|
//{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "This pattern tried to call a dangerous function.\nAre you sure you want to trust this pattern?" },
|
||||||
|
//{ "hex.builtin.view.pattern_editor.no_in_out_vars", "Define some global variables with the 'in' or 'out' specifier for them to appear here." },
|
||||||
|
|
||||||
{ "hex.builtin.view.pattern_data.name", "Dati dei Pattern" },
|
{ "hex.builtin.view.pattern_data.name", "Dati dei Pattern" },
|
||||||
{ "hex.builtin.view.pattern_data.var_name", "Nome" },
|
{ "hex.builtin.view.pattern_data.var_name", "Nome" },
|
||||||
|
@ -289,6 +289,7 @@ namespace hex::plugin::builtin {
|
|||||||
//{ "hex.builtin.view.pattern_editor.settings", "Settings" },
|
//{ "hex.builtin.view.pattern_editor.settings", "Settings" },
|
||||||
//{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Allow dangerous function?" },
|
//{ "hex.builtin.view.pattern_editor.dangerous_function.name", "Allow dangerous function?" },
|
||||||
//{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "This pattern tried to call a dangerous function.\nAre you sure you want to trust this pattern?" },
|
//{ "hex.builtin.view.pattern_editor.dangerous_function.desc", "This pattern tried to call a dangerous function.\nAre you sure you want to trust this pattern?" },
|
||||||
|
//{ "hex.builtin.view.pattern_editor.no_in_out_vars", "Define some global variables with the 'in' or 'out' specifier for them to appear here." },
|
||||||
|
|
||||||
{ "hex.builtin.view.pattern_data.name", "模式数据" },
|
{ "hex.builtin.view.pattern_data.name", "模式数据" },
|
||||||
{ "hex.builtin.view.pattern_data.var_name", "名称" },
|
{ "hex.builtin.view.pattern_data.var_name", "名称" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user