From f9f1955748a3b369f0a015405af131c9b6e3285c Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 4 Oct 2025 16:53:57 +0200 Subject: namespace for logger, strops, locales --- src/ui/helpers.cpp | 2 +- src/ui/imgui_extensions.cpp | 14 +++++++------- src/ui/ui_log.cpp | 6 +++--- src/ui/ui_settings.cpp | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/helpers.cpp b/src/ui/helpers.cpp index 2447270..19eeee3 100644 --- a/src/ui/helpers.cpp +++ b/src/ui/helpers.cpp @@ -69,7 +69,7 @@ void ui_set_status_ex(const char* txt, int color) current_status.time = 0.0f; current_status.color = color; current_status.loading = false; - strops_copy(current_status.text, txt, STATUS_TEXT_LEN); + strops::copy(current_status.text, txt, STATUS_TEXT_LEN); } void ui_set_status_error(const char* txt) diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 8c8f4c4..a283ad4 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -61,7 +61,7 @@ namespace ImGui 0); // allowMultiple (0 = single) if (file) { - strops_copy(buffer, file, MAX_LEN_PATH); + strops::copy(buffer, file, MAX_LEN_PATH); buffer[MAX_LEN_PATH-1] = '\0'; result = true; } @@ -136,7 +136,7 @@ namespace ImGui } if (selected_country_index != -1) { - strops_copy(buffer, config::country_codes[selected_country_index], buf_size); + strops::copy(buffer, config::country_codes[selected_country_index], buf_size); } } @@ -201,7 +201,7 @@ namespace ImGui if (ImGui::Selectable(suggestions[i])) { // Copy selected suggestion to buffer - strops_copy(buffer, suggestions[i], buf_size); + strops::copy(buffer, suggestions[i], buf_size); buffer[buf_size - 1] = '\0'; result = i; is_open = false; @@ -279,7 +279,7 @@ namespace ImGui } if (selected_costcenter_index != -1) { - strops_copy(costcenter_id, buffer[selected_costcenter_index].id, MAX_LEN_ID); + strops::copy(costcenter_id, buffer[selected_costcenter_index].id, MAX_LEN_ID); } free(buffer); @@ -320,7 +320,7 @@ namespace ImGui } if (selected_project_index != -1) { - strops_copy(project_id, buffer[selected_project_index].id, MAX_LEN_ID); + strops::copy(project_id, buffer[selected_project_index].id, MAX_LEN_ID); } free(buffer); @@ -392,7 +392,7 @@ namespace ImGui } if (selected_tax_rate_index != -1) { - strops_copy(tax_rate_id, buffer[selected_tax_rate_index].id, MAX_LEN_ID); + strops::copy(tax_rate_id, buffer[selected_tax_rate_index].id, MAX_LEN_ID); } free(buffer); @@ -441,7 +441,7 @@ namespace ImGui if (ImGui::Selectable(currencies[n], isSelected)) { result = true; - strops_copy(currency, currencies[n], MAX_LEN_CURRENCY); + strops::copy(currency, currencies[n], MAX_LEN_CURRENCY); } if (isSelected) diff --git a/src/ui/ui_log.cpp b/src/ui/ui_log.cpp index fa56f4a..48eaf1c 100644 --- a/src/ui/ui_log.cpp +++ b/src/ui/ui_log.cpp @@ -18,18 +18,18 @@ #include "ui.hpp" #include "imgui.h" -#include "log.hpp" +#include "logger.hpp" #include "locales.hpp" void ui_draw_log() { - program_log* l = get_log(); + logger::program_log* l = logger::get(); for (int i = (int)l->history_length-1; i >= 0; i--) { s32 cursor = l->write_cursor - l->history_length + i; if (cursor < 0) { - cursor = (l->write_cursor + i) % MAX_LEN_LOG_HISTORY; + cursor = (l->write_cursor + i) % logger::MAX_LEN_LOG_HISTORY; } ImGui::TextColored(l->colors[cursor], l->history[cursor]); } diff --git a/src/ui/ui_settings.cpp b/src/ui/ui_settings.cpp index 79d65da..e497615 100644 --- a/src/ui/ui_settings.cpp +++ b/src/ui/ui_settings.cpp @@ -85,13 +85,13 @@ static void ui_draw_vat_rates() // Check for fixed rates shared accross countries. if (strcmp(c.country_code, "00") == 0) { - strops_copy(prev_country, c.country_code, 3); + strops::copy(prev_country, c.country_code, 3); can_be_modified = false; } // Generate headers per country. else if (strcmp(c.country_code, prev_country) != 0) { - strops_copy(prev_country, c.country_code, 3); + strops::copy(prev_country, c.country_code, 3); // Empty row. ImGui::TableNextRow(); @@ -118,7 +118,7 @@ static void ui_draw_vat_rates() is_adding_item = true; is_editing_item = false; new_tax_rate = administration_tax_rate_create_empty(); - strops_copy(new_tax_rate.country_code, c.country_code, 3); + strops::copy(new_tax_rate.country_code, c.country_code, 3); } ImGui::PopStyleVar(); } -- cgit v1.2.3-70-g09d2