summaryrefslogtreecommitdiff
path: root/src/ui/imgui_extensions.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 15:15:55 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 15:15:55 +0200
commitb278d242d03ba614779243ec9e9495fc95abea3d (patch)
tree0d3cd94a3a059b0754c61da075c7dcecc081f358 /src/ui/imgui_extensions.cpp
parent0a2b0e347d926ac0f29c9dd0f49e00634e822d0e (diff)
strops format
Diffstat (limited to 'src/ui/imgui_extensions.cpp')
-rw-r--r--src/ui/imgui_extensions.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp
index 5a00648..4e8270a 100644
--- a/src/ui/imgui_extensions.cpp
+++ b/src/ui/imgui_extensions.cpp
@@ -1,4 +1,3 @@
-#include <stdio.h>
#include <stdlib.h>
#include "ui.hpp"
@@ -93,7 +92,7 @@ namespace ImGui
for (int x = 0; x < config::country_count; x++)
{
char locale_str[20];
- snprintf(locale_str, 20, "country.%s", config::country_codes[x]);
+ strops::format(locale_str, 20, "country.%s", config::country_codes[x]);
countries[x] = locale::get(locale_str);
}
@@ -227,7 +226,7 @@ namespace ImGui
for (int i = 0; i < autocomplete_count; i++)
{
autocomplete_strings[i] = (char*)malloc(200);
- snprintf(autocomplete_strings[i], 200, "%s (%s %s)", autocomplete_list[i].name, autocomplete_list[i].address.address1, autocomplete_list[i].address.address2);
+ strops::format(autocomplete_strings[i], 200, "%s (%s %s)", autocomplete_list[i].name, autocomplete_list[i].address.address1, autocomplete_list[i].address.address2);
}
int autocomplete_index = ImGui::TextInputWithAutocomplete(locale::get("contact.form.fullname"),
@@ -355,10 +354,10 @@ namespace ImGui
{
if (strcmp(selected_tax_rate->country_code, "00") == 0) {
char category_code_desc[MAX_LEN_LONG_DESC];
- snprintf(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", selected_tax_rate->category_code);
- snprintf(rate_str_buf, 40, "%s", locale::get(category_code_desc));
+ strops::format(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", selected_tax_rate->category_code);
+ strops::format(rate_str_buf, 40, "%s", locale::get(category_code_desc));
}
- else snprintf(rate_str_buf, 40, "%s/%.1f%%", selected_tax_rate->country_code, selected_tax_rate->rate);
+ else strops::format(rate_str_buf, 40, "%s/%.1f%%", selected_tax_rate->country_code, selected_tax_rate->rate);
}
if (has_error) {
@@ -374,10 +373,10 @@ namespace ImGui
if (strcmp(buffer[n].country_code, "00") == 0) {
char category_code_desc[MAX_LEN_LONG_DESC];
- snprintf(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", buffer[n].category_code);
- snprintf(rate_str_buf, 40, "%s", locale::get(category_code_desc));
+ strops::format(category_code_desc, MAX_LEN_LONG_DESC, "taxcategory.%s", buffer[n].category_code);
+ strops::format(rate_str_buf, 40, "%s", locale::get(category_code_desc));
}
- else snprintf(rate_str_buf, 40, "%s/%.1f%%", buffer[n].country_code, buffer[n].rate);
+ else strops::format(rate_str_buf, 40, "%s/%.1f%%", buffer[n].country_code, buffer[n].rate);
if (ImGui::Selectable(rate_str_buf, is_selected)) {
selected_tax_rate_index = n;
@@ -458,7 +457,7 @@ namespace ImGui
const char* items[] = { option1, option2 };
char ID[MAX_LEN_LONG_DESC];
- snprintf(ID, MAX_LEN_LONG_DESC, "Mode##%p", buffer);
+ strops::format(ID, MAX_LEN_LONG_DESC, "Mode##%p", buffer);
if (ImGui::BeginCombo(ID, items[*buffer])) {
for (int n = 0; n < 2; n++) {
bool is_selected = (n == (int)*buffer);