1
0
mirror of synced 2024-11-13 18:50:53 +01:00

impr: Use better icons for favorites and filter text boxes

This commit is contained in:
WerWolv 2023-06-04 22:52:36 +02:00
parent cc55e5ec74
commit e78c21cbfb
4 changed files with 11 additions and 10 deletions

View File

@ -177,8 +177,8 @@ namespace hex::plugin::builtin {
if (ImGui::Begin(View::toWindowName("hex.builtin.view.bookmarks.name").c_str(), &this->getWindowOpenState())) {
auto provider = ImHexApi::Provider::get();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::InputTextWithHint("##filter", "hex.builtin.common.filter"_lang, this->m_currFilter);
ImGui::PushItemWidth(-1);
ImGui::InputTextIcon("##filter", ICON_VS_FILTER, this->m_currFilter);
ImGui::PopItemWidth();
ImGui::NewLine();

View File

@ -821,9 +821,9 @@ namespace hex::plugin::builtin {
auto &currOccurrences = *this->m_sortedOccurrences;
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::PushItemWidth(-1);
auto prevFilterLength = this->m_currFilter->length();
if (ImGui::InputTextWithHint("##filter", "hex.builtin.common.filter"_lang, *this->m_currFilter)) {
if (ImGui::InputTextIcon("##filter", ICON_VS_FILTER, *this->m_currFilter)) {
if (prevFilterLength > this->m_currFilter->length())
*this->m_sortedOccurrences = *this->m_foundOccurrences;

View File

@ -434,7 +434,7 @@ namespace hex::plugin::builtin::ui {
}
if (y == u64(clipper.DisplayStart))
cellSize.y -= (ImGui::GetStyle().CellPadding.y + 1);
cellSize.y -= (ImGui::GetStyle().CellPadding.y);
backgroundColor = applySelectionColor(byteAddress, backgroundColor);

View File

@ -211,12 +211,12 @@ namespace hex::plugin::builtin::ui {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
if (this->m_favorites.contains(this->m_currPatternPath)) {
if (ImGui::DimmedIconButton(ICON_FA_STAR, ImGui::GetStyleColorVec4(ImGuiCol_PlotHistogram))) {
if (ImGui::DimmedIconButton(ICON_VS_STAR_DELETE, ImGui::GetStyleColorVec4(ImGuiCol_PlotHistogram))) {
this->m_favorites.erase(this->m_currPatternPath);
}
}
else {
if (ImGui::DimmedIconButton(ICON_FA_STAR, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled))) {
if (ImGui::DimmedIconButton(ICON_VS_STAR_ADD, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled))) {
this->m_favorites.insert({ this->m_currPatternPath, pattern.clone() });
}
}
@ -253,12 +253,13 @@ namespace hex::plugin::builtin::ui {
}
void PatternDrawer::drawValueColumn(pl::ptrn::Pattern& pattern) {
auto value = pattern.getFormattedValue();
const auto value = pattern.getFormattedValue();
const auto width = ImGui::GetColumnWidth();
if (const auto &arguments = pattern.getAttributeArguments("hex::visualize"); !arguments.empty()) {
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0.5F));
if (ImGui::Button(hex::format("{} {}", ICON_VS_EYE_WATCH, value).c_str(), ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight()))) {
if (ImGui::Button(hex::format("{} {}", ICON_VS_EYE_WATCH, value).c_str(), ImVec2(width, ImGui::GetTextLineHeight()))) {
this->m_currVisualizedPattern = &pattern;
this->m_lastVisualizerError.clear();
@ -281,7 +282,7 @@ namespace hex::plugin::builtin::ui {
}
if (ImGui::IsItemHovered()) {
if (ImGui::CalcTextSize(value.c_str()).x > ImGui::GetColumnWidth()) {
if (ImGui::CalcTextSize(value.c_str()).x > width) {
ImGui::BeginTooltip();
ImGui::TextFormatted("{}", value);
ImGui::EndTooltip();