sys: Use custom literals for scaled values

This commit is contained in:
WerWolv
2022-01-11 23:48:18 +01:00
parent 2f1a707fd3
commit d399a6427a
12 changed files with 43 additions and 24 deletions

View File

@@ -55,7 +55,7 @@ namespace hex::plugin::builtin {
ImGui::SameLine();
ImGui::SmallProgressBar(taskProgress, (ImGui::GetCurrentWindow()->MenuBarHeight() - 10 * SharedData::globalScale) / 2.0);
ImGui::SmallProgressBar(taskProgress, (ImGui::GetCurrentWindow()->MenuBarHeight() - 10_scaled) / 2.0);
ImGui::InfoTooltip(taskName.c_str());
}
@@ -133,7 +133,7 @@ namespace hex::plugin::builtin {
if (ImHexApi::Provider::isValid())
preview = providers[SharedData::currentProvider]->getName();
ImGui::SetNextItemWidth(200 * SharedData::globalScale);
ImGui::SetNextItemWidth(200_scaled);
if (ImGui::BeginCombo("", preview.c_str())) {
for (int i = 0; i < providers.size(); i++) {

View File

@@ -48,7 +48,7 @@ namespace hex::plugin::builtin {
if (ImHexApi::Provider::isValid() && provider >= 0)
preview = providers[provider]->getName();
ImGui::SetNextItemWidth(200 * SharedData::globalScale);
ImGui::SetNextItemWidth(200_scaled);
if (ImGui::BeginCombo("", preview.c_str())) {
for (int i = 0; i < providers.size(); i++) {

View File

@@ -113,7 +113,7 @@ namespace hex::plugin::builtin {
}
void ViewHelp::drawAboutPopup() {
ImGui::SetNextWindowSize(ImVec2(600, 350) * SharedData::globalScale, ImGuiCond_Always);
ImGui::SetNextWindowSize(scaled(ImVec2(600, 350)), ImGuiCond_Always);
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.help.about.name").c_str(), &this->m_aboutWindowOpen, ImGuiWindowFlags_NoResize)) {
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))

View File

@@ -177,7 +177,7 @@ namespace hex::plugin::builtin {
if (provider->getPageCount() > 1) {
ImGui::NewLine();
auto linePos = ImGui::GetCursorPosY() - 15 * SharedData::globalScale;
auto linePos = ImGui::GetCursorPosY() - 15_scaled;
ImGui::SetCursorPosY(linePos);

View File

@@ -218,7 +218,7 @@ namespace hex::plugin::builtin {
}
void ViewStore::drawContent() {
ImGui::SetNextWindowSizeConstraints(ImVec2(600, 400) * SharedData::globalScale, ImVec2(FLT_MAX, FLT_MAX));
ImGui::SetNextWindowSizeConstraints(scaled(ImVec2(600, 400)), ImVec2(FLT_MAX, FLT_MAX));
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.store.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_AlwaysAutoResize)) {
if (this->m_apiRequest.valid()) {
if (this->m_apiRequest.wait_for(0s) != std::future_status::ready)