1
0
mirror of synced 2024-11-12 02:00:52 +01:00

impr: Disable endianess switch in hex editor when visualizer only uses one byte

This commit is contained in:
WerWolv 2023-07-18 14:23:02 +02:00
parent 90267ec356
commit 2d4f971d10

View File

@ -824,11 +824,22 @@ namespace hex::plugin::builtin::ui {
ImGui::SameLine(0, 0); ImGui::SameLine(0, 0);
{
bool hasEndianess = this->m_currDataVisualizer->getBytesPerCell() > 1;
if (!hasEndianess)
this->m_dataVisualizerEndianness = std::endian::native;
ImGui::BeginDisabled(!hasEndianess);
{
int sliderPos = this->m_dataVisualizerEndianness == std::endian::little ? 0 : 1; int sliderPos = this->m_dataVisualizerEndianness == std::endian::little ? 0 : 1;
ImGui::PushItemWidth(60_scaled); ImGui::PushItemWidth(60_scaled);
ImGui::SliderInt("##visualizer_endianness", &sliderPos, 0, 1, sliderPos == 0 ? "hex.builtin.common.little"_lang : "hex.builtin.common.big"_lang); ImGui::SliderInt("##visualizer_endianness", &sliderPos, 0, 1, sliderPos == 0 ? "hex.builtin.common.little"_lang : "hex.builtin.common.big"_lang);
ImGui::PopItemWidth(); ImGui::PopItemWidth();
this->m_dataVisualizerEndianness = sliderPos == 0 ? std::endian::little : std::endian::big; this->m_dataVisualizerEndianness = sliderPos == 0 ? std::endian::little : std::endian::big;
}
ImGui::EndDisabled();
}
ImGui::SameLine(0, 2_scaled); ImGui::SameLine(0, 2_scaled);
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 60_scaled); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 60_scaled);