impr: Make pattern tooltips more appropriately sized
This commit is contained in:
parent
1b26db40f7
commit
d097f6ada0
@ -685,7 +685,7 @@ namespace hex {
|
|||||||
return string;
|
return string;
|
||||||
|
|
||||||
// If the string is longer than the max length, find the last space before the max length
|
// If the string is longer than the max length, find the last space before the max length
|
||||||
auto it = string.begin() + maxLength / 2;
|
auto it = string.begin() + maxLength;
|
||||||
while (it != string.begin() && !std::isspace(*it)) --it;
|
while (it != string.begin() && !std::isspace(*it)) --it;
|
||||||
|
|
||||||
// If there's no space before the max length, just cut the string
|
// If there's no space before the max length, just cut the string
|
||||||
|
@ -1456,6 +1456,7 @@ namespace hex::plugin::builtin {
|
|||||||
void ViewPatternEditor::drawPatternTooltip(pl::ptrn::Pattern *pattern) {
|
void ViewPatternEditor::drawPatternTooltip(pl::ptrn::Pattern *pattern) {
|
||||||
ImGui::PushID(pattern);
|
ImGui::PushID(pattern);
|
||||||
{
|
{
|
||||||
|
const bool shiftHeld = ImGui::GetIO().KeyShift;
|
||||||
ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor()));
|
ImGui::ColorButton(pattern->getVariableName().c_str(), ImColor(pattern->getColor()));
|
||||||
ImGui::SameLine(0, 10);
|
ImGui::SameLine(0, 10);
|
||||||
ImGuiExt::TextFormattedColored(TextEditor::GetPalette()[u32(TextEditor::PaletteIndex::KnownIdentifier)], "{} ", pattern->getFormattedName());
|
ImGuiExt::TextFormattedColored(TextEditor::GetPalette()[u32(TextEditor::PaletteIndex::KnownIdentifier)], "{} ", pattern->getFormattedName());
|
||||||
@ -1464,9 +1465,9 @@ namespace hex::plugin::builtin {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGuiExt::TextFormatted("{} ", hex::limitStringLength(pattern->getFormattedValue(), 64));
|
ImGuiExt::TextFormatted("{: <{}} ", hex::limitStringLength(pattern->getFormattedValue(), 64), shiftHeld ? 40 : 0);
|
||||||
|
|
||||||
if (ImGui::GetIO().KeyShift) {
|
if (shiftHeld) {
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_NoClip)) {
|
if (ImGui::BeginTable("##extra_info", 2, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_NoClip)) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
@ -1498,7 +1499,7 @@ namespace hex::plugin::builtin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
ImGui::PushTextWrapPos(300_scaled);
|
ImGui::PushTextWrapPos(500_scaled);
|
||||||
ImGuiExt::TextFormattedWrapped("{}", path);
|
ImGuiExt::TextFormattedWrapped("{}", path);
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user