From 0d0b2d69622f86f59ca132a593a749a15ca1941d Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 23 Nov 2020 22:14:11 +0100 Subject: [PATCH] Indent variable name instead of color in pattern data view --- include/lang/pattern_data.hpp | 33 ++++++++++++++---------------- source/views/view_pattern_data.cpp | 4 ++-- source/window.cpp | 3 +-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/include/lang/pattern_data.hpp b/include/lang/pattern_data.hpp index 8b49d57b7..9fa0bd02a 100644 --- a/include/lang/pattern_data.hpp +++ b/include/lang/pattern_data.hpp @@ -129,17 +129,17 @@ namespace hex::lang { protected: void createDefaultEntry(std::string value) { ImGui::TableNextRow(); - ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth); + ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_AllowItemOverlap); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip); - ImGui::TableNextColumn(); - if (ImGui::Selectable(("##PatternDataLine"s + std::to_string(this->getOffset())).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) { + if (ImGui::Selectable(("##PatternDataLine"s + std::to_string(this->getOffset())).c_str(), false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) { Region selectRegion = { this->getOffset(), this->getSize() }; View::postEvent(Events::SelectionChangeRequest, &selectRegion); } ImGui::SameLine(); ImGui::Text("%s", this->getName().c_str()); ImGui::TableNextColumn(); + ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), 14)); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -190,10 +190,10 @@ namespace hex::lang { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip); - ImGui::TableNextColumn(); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); + ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), 14)); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -349,10 +349,10 @@ namespace hex::lang { void createEntry(prv::Provider* &provider) override { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_AlphaPreview); - ImGui::TableNextColumn(); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); + ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), 14)); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -402,10 +402,9 @@ namespace hex::lang { void createEntry(prv::Provider* &provider) override { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_AlphaPreview); - ImGui::TableNextColumn(); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -461,10 +460,9 @@ namespace hex::lang { void createEntry(prv::Provider* &provider) override { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_AlphaPreview); - ImGui::TableNextColumn(); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -540,8 +538,6 @@ namespace hex::lang { ImGui::TableNextRow(); ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip); - ImGui::TableNextColumn(); if (ImGui::Selectable(("##PatternDataLine"s + std::to_string(this->getOffset())).c_str(), false, ImGuiSelectableFlags_SpanAllColumns)) { Region selectRegion = { this->getOffset(), this->getSize() }; View::postEvent(Events::SelectionChangeRequest, &selectRegion); @@ -549,6 +545,8 @@ namespace hex::lang { ImGui::SameLine(); ImGui::Text("%s", this->getName().c_str()); ImGui::TableNextColumn(); + ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), 14)); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -579,10 +577,9 @@ namespace hex::lang { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(0x00FFFFFF), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_AlphaPreview); - ImGui::TableNextColumn(); bool open = ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset(), this->getOffset() + this->getSize() - 1); ImGui::TableNextColumn(); ImGui::Text("0x%04lx", this->getSize()); @@ -597,10 +594,10 @@ namespace hex::lang { ImGui::TableNextRow(); ImGui::TreeNodeEx(this->getName().c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_SpanFullWidth); ImGui::TableNextColumn(); - ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip); - ImGui::TableNextColumn(); ImGui::Text("%s", entryName.c_str()); ImGui::TableNextColumn(); + ImGui::ColorButton("color", ImColor(this->getColor()), ImGuiColorEditFlags_NoTooltip, ImVec2(ImGui::GetColumnWidth(), 14)); + ImGui::TableNextColumn(); ImGui::Text("0x%08lx : 0x%08lx", this->getOffset() + (bitOffset >> 3), this->getOffset() + ((bitOffset + entrySize) >> 3) - 1); ImGui::TableNextColumn(); if (entrySize == 1) diff --git a/source/views/view_pattern_data.cpp b/source/views/view_pattern_data.cpp index 479eb0a07..955dae5db 100644 --- a/source/views/view_pattern_data.cpp +++ b/source/views/view_pattern_data.cpp @@ -18,10 +18,10 @@ namespace hex { } static bool beginPatternDataTable(prv::Provider* &provider, const std::vector &patterns, std::vector &sortedPatterns) { - if (ImGui::BeginTable("##patterndatatable", 6, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_ScrollY)) { + if (ImGui::BeginTable("##patterndatatable", 6, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Sortable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY)) { ImGui::TableSetupScrollFreeze(0, 1); - ImGui::TableSetupColumn("Color", 0, -1, ImGui::GetID("color")); ImGui::TableSetupColumn("Name", 0, -1, ImGui::GetID("name")); + ImGui::TableSetupColumn("Color", 0, -1, ImGui::GetID("color")); ImGui::TableSetupColumn("Offset", 0, -1, ImGui::GetID("offset")); ImGui::TableSetupColumn("Size", 0, -1, ImGui::GetID("size")); ImGui::TableSetupColumn("Type", 0, -1, ImGui::GetID("type")); diff --git a/source/window.cpp b/source/window.cpp index c7d4f04ad..0ce83af51 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -205,8 +205,7 @@ namespace hex { io.ConfigViewportsNoTaskBarIcon = true; style.WindowMenuButtonPosition = ImGuiDir_None; - style.WindowRounding = 0.0f; - style.Colors[ImGuiCol_WindowBg].w = 1.0f; + style.IndentSpacing = 10.0F; // Install custom settings handler ImGuiSettingsHandler handler;