mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
Added engineering display mode to calculator
This commit is contained in:
@@ -195,7 +195,7 @@ namespace hex {
|
||||
else
|
||||
ImGui::NewLine();
|
||||
|
||||
enum class MathDisplayType { Standard, Scientific, Programmer } mathDisplayType;
|
||||
enum class MathDisplayType { Standard, Scientific, Engineering, Programmer } mathDisplayType;
|
||||
if (ImGui::BeginTabBar("##mathFormatTabBar")) {
|
||||
if (ImGui::BeginTabItem("Standard")) {
|
||||
mathDisplayType = MathDisplayType::Standard;
|
||||
@@ -205,6 +205,10 @@ namespace hex {
|
||||
mathDisplayType = MathDisplayType::Scientific;
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Engineering")) {
|
||||
mathDisplayType = MathDisplayType::Engineering;
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem("Programmer")) {
|
||||
mathDisplayType = MathDisplayType::Programmer;
|
||||
ImGui::EndTabItem();
|
||||
@@ -242,6 +246,9 @@ namespace hex {
|
||||
case MathDisplayType::Scientific:
|
||||
ImGui::Text("%.6Le", this->m_mathHistory[(this->m_mathHistory.size() - 1) - i]);
|
||||
break;
|
||||
case MathDisplayType::Engineering:
|
||||
ImGui::Text("%s", hex::toEngineeringString(this->m_mathHistory[(this->m_mathHistory.size() - 1) - i]).c_str());
|
||||
break;
|
||||
case MathDisplayType::Programmer:
|
||||
ImGui::Text("0x%llX (%llu)",
|
||||
u64(this->m_mathHistory[(this->m_mathHistory.size() - 1) - i]),
|
||||
@@ -279,6 +286,9 @@ namespace hex {
|
||||
case MathDisplayType::Scientific:
|
||||
ImGui::Text("%.6Le", value);
|
||||
break;
|
||||
case MathDisplayType::Engineering:
|
||||
ImGui::Text("%s", hex::toEngineeringString(value).c_str());
|
||||
break;
|
||||
case MathDisplayType::Programmer:
|
||||
ImGui::Text("0x%llX (%llu)", u64(value), u64(value));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user