From 6166eeda08fd1d4106afe47416a73de60700d17e Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 10 Jan 2026 19:57:44 +0100 Subject: new look --- src/locales/en.cpp | 20 ++++++----- src/logger.cpp | 2 +- src/main_linux.cpp | 6 ++-- src/ui/imgui_extensions.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++-- src/ui/ui_expenses.cpp | 37 +++++-------------- src/ui/ui_invoices.cpp | 16 +++++---- src/ui/ui_main.cpp | 6 ++++ 7 files changed, 126 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/locales/en.cpp b/src/locales/en.cpp index 752e328..634b8b2 100644 --- a/src/locales/en.cpp +++ b/src/locales/en.cpp @@ -14,6 +14,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include "locales.hpp" locale_entry en_locales[] = { @@ -22,16 +24,16 @@ locale_entry en_locales[] = { {"ui.workingOn", "Working on"}, {"ui.invoiceRequirementP1", "Company info ↗"}, {"ui.invoiceRequirementP2", "needs to be completed before adding invoices."}, - {"ui.next", "Next >>"}, - {"ui.prev", "<< Prev"}, + {"ui.next", "Next" ICON_FA_ANGLE_RIGHT}, + {"ui.prev", ICON_FA_ANGLE_LEFT" Prev"}, {"ui.tooltip.invalidInvoice", "Invoice has missing information."}, {"ui.tooltip.invalidProject", "Project has missing information."}, {"ui.tooltip.invalidContact", "Contact has missing information."}, - {"ui.import", "+ Import"}, + {"ui.import", ICON_FA_FILE_IMPORT" Import"}, {"ui.clear", "Clear"}, {"ui.selected", "Selected"}, - {"ui.exportAs", "Export"}, - {"ui.sendAs", "Send"}, + {"ui.exportAs", ICON_FA_FILE_EXPORT" Export"}, + {"ui.sendAs", ICON_FA_ENVELOPE_SQUARE" Send"}, {"ui.sendAs.email", "Email"}, {"ui.sendAs.einvoice", "E-Invoice (Peppol Network)"}, @@ -51,13 +53,13 @@ locale_entry en_locales[] = { {"status.saveFailed", "[Save failed]"}, // General form buttons. - {"form.create", "+ Create"}, - {"form.back", "Back"}, - {"form.save", "Save"}, + {"form.create", ICON_FA_PLUS_SQUARE" Create"}, + {"form.back", ICON_FA_CARET_SQUARE_LEFT" Back"}, + {"form.save", ICON_FA_SAVE" Save"}, {"form.cancel", "Cancel"}, {"form.yes", "Yes"}, {"form.no", "No"}, - {"form.change", "Change"}, + {"form.change", ICON_FA_PEN_SQUARE" Change"}, {"form.view", "View"}, {"form.delete", "Delete"}, {"form.cancel", "Cancel"}, diff --git a/src/logger.cpp b/src/logger.cpp index 40fdfc8..c16e94f 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -108,7 +108,7 @@ namespace logger { { va_list args; va_start(args, fmt); - log_message(fmt, ImVec4(1,1,1,1), args); + log_message(fmt, ImVec4(0,0,0,1), args); va_end(args); } diff --git a/src/main_linux.cpp b/src/main_linux.cpp index 5c36209..b317ab1 100644 --- a/src/main_linux.cpp +++ b/src/main_linux.cpp @@ -83,7 +83,7 @@ static void _create_window(bool is_setup_window) io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style - ImGui::StyleColorsDark(); + ImGui::StyleCustom(); //ImGui::StyleColorsLight(); // Setup scaling @@ -96,7 +96,7 @@ static void _create_window(bool is_setup_window) ImGui_ImplOpenGL2_Init(); io.Fonts->Clear(); - style.FontSizeBase = 18.0f; + style.FontSizeBase = 16.0f; float iconFontSize = 10.0f; static ImWchar icon_range[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; @@ -138,7 +138,7 @@ int main(int argc, char** argv) } - ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); + ImVec4 clear_color = ImVec4(210 / 255.0f, 210 / 255.0f, 210 / 255.0f, 255 / 255.0f); timer_lib_initialize(); administration_writer::create(); diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 568806a..03d4a44 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -15,7 +15,9 @@ */ #include +#include #include +#include #include "ui.hpp" #include "strops.hpp" @@ -78,14 +80,14 @@ namespace ImGui static void DrawSuccessMark(int bWidth = 0, bool isButton = true) { ImGui::PushStyleColor(ImGuiCol_Text, config::colors::COLOR_SUCCESS); - if (isButton) ImGui::Button("√", ImVec2(bWidth, 0)); else ImGui::Text("√"); + if (isButton) ImGui::Button(ICON_FA_CHECK_SQUARE, ImVec2(bWidth, 0)); else ImGui::Text("√"); ImGui::PopStyleColor(); } static void DrawFailureMark(int bWidth = 0, bool isButton = true) { ImGui::PushStyleColor(ImGuiCol_Text, config::colors::COLOR_ERROR); - if (isButton) ImGui::Button("X", ImVec2(bWidth, 0)); else ImGui::Text("√"); + if (isButton) ImGui::Button(ICON_FA_BAN, ImVec2(bWidth, 0)); else ImGui::Text("√"); ImGui::PopStyleColor(); } @@ -868,4 +870,86 @@ namespace ImGui return false; } + + void StyleCustom() + { + ImGui::StyleColorsLight(); + + ImGuiStyle* style = &ImGui::GetStyle(); + + //style->WindowMinSize = ImVec2( 160, 20 ); + style->FramePadding = ImVec2( 10, 5 ); + style->ItemSpacing = ImVec2( 6, 2 ); + style->ItemInnerSpacing = ImVec2( 6, 4 ); + style->Alpha = 1.0f; + style->DisabledAlpha = 0.45f; + style->WindowRounding = 4.0f; + style->FrameRounding = 4.0f; + style->IndentSpacing = 6.0f; + style->ItemInnerSpacing = ImVec2( 2, 4 ); + style->ColumnsMinSpacing = 50.0f; + style->GrabMinSize = 14.0f; + style->GrabRounding = 16.0f; + style->ScrollbarSize = 12.0f; + style->ScrollbarRounding = 16.0f; + style->FrameBorderSize = 1.0f; + style->WindowBorderSize = 1.0f; + + ImVec4* colors = style->Colors; + + //colors[ImGuiCol_Border] = ColorConvertU32ToFloat4(IM_COL32(210, 210, 210, 255)); + colors[ImGuiCol_Text] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY800); // text on hovered controls is gray900 + colors[ImGuiCol_TextDisabled] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY500); + colors[ImGuiCol_WindowBg] = ColorConvertU32ToFloat4(IM_COL32(239, 240, 241, 255)); + //colors[ImGuiCol_ChildBg] = ColorConvertU32ToFloat4(IM_COL32(255, 0, 0, 255)); + colors[ImGuiCol_PopupBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY50); // not sure about this. Note: applies to tooltips too. + colors[ImGuiCol_Border] = ColorConvertU32ToFloat4(IM_COL32(214, 214, 215, 255)); + colors[ImGuiCol_BorderShadow] = ColorConvertU32ToFloat4(ImGui::Spectrum::Static::NONE); // We don't want shadows. Ever. + colors[ImGuiCol_FrameBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY75); // this isnt right, spectrum does not do this, but it's a good fallback + colors[ImGuiCol_FrameBgHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY50); + colors[ImGuiCol_FrameBgActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY200); + colors[ImGuiCol_TitleBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY300); // those titlebar values are totally made up, spectrum does not have this. + colors[ImGuiCol_TitleBgActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY200); + colors[ImGuiCol_TitleBgCollapsed] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY400); + colors[ImGuiCol_MenuBarBg] = ColorConvertU32ToFloat4(IM_COL32(243, 244, 245, 255)); + colors[ImGuiCol_ScrollbarBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY100); // same as regular background + colors[ImGuiCol_ScrollbarGrab] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY400); + colors[ImGuiCol_ScrollbarGrabHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY600); + colors[ImGuiCol_ScrollbarGrabActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY700); + colors[ImGuiCol_CheckMark] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE500); + colors[ImGuiCol_SliderGrab] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY700); + colors[ImGuiCol_SliderGrabActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY800); + colors[ImGuiCol_Button] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY75); // match default button to Spectrum's 'Action Button'. + colors[ImGuiCol_ButtonHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY50); + colors[ImGuiCol_ButtonActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY200); + + colors[ImGuiCol_TableHeaderBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY300); + colors[ImGuiCol_Header] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY300); + colors[ImGuiCol_HeaderHovered] = ImVec4(0.78f, 0.87f, 0.98f, 0.5f); + colors[ImGuiCol_HeaderActive] = colors[ImGuiCol_TableHeaderBg]; + + colors[ImGuiCol_TableRowBg] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY100); + colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); + + colors[ImGuiCol_Separator] = colors[ImGuiCol_Border]; + + colors[ImGuiCol_SeparatorHovered] = colors[ImGuiCol_Border]; + colors[ImGuiCol_SeparatorActive] = colors[ImGuiCol_Border]; + colors[ImGuiCol_TableBorderStrong] = colors[ImGuiCol_Border]; + colors[ImGuiCol_TableBorderLight] = colors[ImGuiCol_Border]; + + colors[ImGuiCol_ResizeGrip] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY400); + colors[ImGuiCol_ResizeGripHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY600); + colors[ImGuiCol_ResizeGripActive] = ColorConvertU32ToFloat4(ImGui::Spectrum::GRAY700); + colors[ImGuiCol_PlotLines] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE400); + colors[ImGuiCol_PlotLinesHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE600); + colors[ImGuiCol_PlotHistogram] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE400); + colors[ImGuiCol_PlotHistogramHovered] = ColorConvertU32ToFloat4(ImGui::Spectrum::BLUE600); + colors[ImGuiCol_TextSelectedBg] = ColorConvertU32ToFloat4((ImGui::Spectrum::BLUE400 & 0x00FFFFFF) | 0x33000000); + colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f); + colors[ImGuiCol_NavHighlight] = ColorConvertU32ToFloat4((ImGui::Spectrum::GRAY900 & 0x00FFFFFF) | 0x0A000000); + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); + } } \ No newline at end of file diff --git a/src/ui/ui_expenses.cpp b/src/ui/ui_expenses.cpp index 7c9f596..35adea0 100644 --- a/src/ui/ui_expenses.cpp +++ b/src/ui/ui_expenses.cpp @@ -226,8 +226,11 @@ static void draw_expenses_list() ImGui::TableSetupColumn(locale::get("invoice.table.issuedat"), ImGuiTableColumnFlags_WidthFixed, 90); ImGui::TableSetupColumn(locale::get("invoice.table.total"), ImGuiTableColumnFlags_WidthFixed, 90); ImGui::TableSetupColumn(locale::get("invoice.table.status"), ImGuiTableColumnFlags_WidthFixed, 90); + ImGui::PushFont(ui::fontBold); ImGui::TableHeadersRow(); + ImGui::PopFont(); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); for (u32 i = 0; i < invoice_count; i++) { invoice c = invoice_list[i]; @@ -237,7 +240,7 @@ static void draw_expenses_list() ImGui::PushID(i); ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap; bool selected = false; - if (ImGui::Selectable("##invisible_selectable", selected, selectable_flags, ImVec2(0, ImGui::GetFrameHeight()-4.0f))) + if (ImGui::Selectable("##invisible_selectable", selected, selectable_flags, ImVec2(0, ImGui::GetFrameHeight()+2.0f))) { _set_active_invoice(c); current_view_state = ui::view_state::VIEW_EXISTING; @@ -265,30 +268,8 @@ static void draw_expenses_list() ImGui::TableSetColumnIndex(3); ImGui::Text(buf); ImGui::TableSetColumnIndex(4); ImGui::Text("%.2f %s", c.total, c.currency); ImGui::TableSetColumnIndex(5); ImGui::Text("%s", locale::get(administration::invoice_get_status_string(&c))); - - /* - char btn_name[20]; - strops::format(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.view"), i); - if (ImGui::Button(btn_name)) { - active_invoice = c; - current_view_state = ui::view_state::VIEW_EXISTING; - } - - ImGui::SameLine(); - - strops::format(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.change"), i); - if (ImGui::Button(btn_name)) { - active_invoice = administration::invoice_create_copy(&c); // We create a copy because of billing item list pointers. - current_view_state = ui::view_state::EDIT_EXISTING; - } - - ImGui::SameLine(); - strops::format(btn_name, sizeof(btn_name), "%s##%d", locale::get("form.delete"), i); - if (ImGui::Button(btn_name)) { - selected_for_removal = c; - ImGui::OpenPopup("ConfirmDeletePopup"); - }*/ } + ImGui::PopStyleVar(); ImGui::EndTable(); } @@ -310,7 +291,7 @@ static void _invoice_saved_callback() static void _draw_activity_sidepanel() { ImGui::SameLine(); - ImGui::SeparatorEx(1 << 1, 3.0f); + ImGui::SeparatorEx(1 << 1, 1.0f); ImGui::SameLine(); ImGui::BeginChild("##historyPanel", ImVec2(sidepanel_width, 0), ImGuiChildFlags_None); @@ -357,7 +338,7 @@ static void draw_expense_update() } ImGui::Spacing(); - ImGui::Separator(3.0f); + ImGui::Separator(1.0f); ImGui::Spacing(); float availableWidth = ImGui::GetContentRegionAvail().x; @@ -386,7 +367,7 @@ static void draw_expense_create() } ImGui::Spacing(); - ImGui::Separator(3.0f); + ImGui::Separator(1.0f); ImGui::Spacing(); float availableWidth = ImGui::GetContentRegionAvail().x; @@ -409,7 +390,7 @@ static void draw_expense_view() } ImGui::Spacing(); - ImGui::Separator(3.0f); + ImGui::Separator(1.0f); ImGui::Spacing(); float availableWidth = ImGui::GetContentRegionAvail().x; diff --git a/src/ui/ui_invoices.cpp b/src/ui/ui_invoices.cpp index 49ee697..72c4964 100644 --- a/src/ui/ui_invoices.cpp +++ b/src/ui/ui_invoices.cpp @@ -321,8 +321,11 @@ static void draw_invoices_list() ImGui::TableSetupColumn(locale::get("invoice.table.issuedat"), ImGuiTableColumnFlags_WidthFixed, 90); ImGui::TableSetupColumn(locale::get("invoice.table.total"), ImGuiTableColumnFlags_WidthFixed, 90); ImGui::TableSetupColumn(locale::get("invoice.table.status"), ImGuiTableColumnFlags_WidthFixed, 90); + ImGui::PushFont(ui::fontBold); ImGui::TableHeadersRow(); - + ImGui::PopFont(); + + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); for (u32 i = 0; i < invoice_count; i++) { invoice c = invoice_list[i]; @@ -332,7 +335,7 @@ static void draw_invoices_list() ImGui::PushID(i); ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap; bool selected = false; - if (ImGui::Selectable("##invisible_selectable", selected, selectable_flags, ImVec2(0, ImGui::GetFrameHeight()-4.0f))) + if (ImGui::Selectable("##invisible_selectable", selected, selectable_flags, ImVec2(0, ImGui::GetFrameHeight()+2.0f))) { _set_active_invoice(c); current_view_state = ui::view_state::VIEW_EXISTING; @@ -363,6 +366,7 @@ static void draw_invoices_list() ImGui::SameLine(); } + ImGui::PopStyleVar(); ImGui::EndTable(); } @@ -384,7 +388,7 @@ static void _reset_to_default_view() static void _draw_activity_sidepanel() { ImGui::SameLine(); - ImGui::SeparatorEx(1 << 1, 3.0f); + ImGui::SeparatorEx(1 << 1, 1.0f); ImGui::SameLine(); ImGui::BeginChild("##historyPanel", ImVec2(sidepanel_width, 0), ImGuiChildFlags_None); @@ -431,7 +435,7 @@ static void draw_invoice_update() } ImGui::Spacing(); - ImGui::Separator(3.0f); + ImGui::Separator(1.0f); ImGui::Spacing(); float availableWidth = ImGui::GetContentRegionAvail().x; @@ -460,7 +464,7 @@ static void draw_invoice_create() } ImGui::Spacing(); - ImGui::Separator(3.0f); + ImGui::Separator(1.0f); ImGui::Spacing(); float availableWidth = ImGui::GetContentRegionAvail().x; @@ -530,7 +534,7 @@ static void draw_invoice_view() ImGui::PushItemWidth(0.0f); ImGui::Spacing(); - ImGui::Separator(3.0f); + ImGui::Separator(1.0f); ImGui::Spacing(); float availableWidth = ImGui::GetContentRegionAvail().x; diff --git a/src/ui/ui_main.cpp b/src/ui/ui_main.cpp index 5d74fa6..f20b9a8 100644 --- a/src/ui/ui_main.cpp +++ b/src/ui/ui_main.cpp @@ -117,6 +117,8 @@ void ui::draw_main() // Side panel ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f); ImGui::Begin("SidePanel", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse); { // Navigation buttons with custom styling @@ -154,14 +156,18 @@ void ui::draw_main() } ImGui::End(); ImGui::PopStyleVar(); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); ImGui::SetNextWindowPos(ImVec2(sidePanelWidth, menuBarHeight)); ImGui::SetNextWindowSize(ImVec2(io.DisplaySize.x - sidePanelWidth, io.DisplaySize.y - menuBarHeight - statusBarHeight)); // Main content + ImGui::PushStyleColor(ImGuiCol_WindowBg, IM_COL32(255, 255, 255, 255)); ImGui::Begin("AccountingMainWindow", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse); if (drawcalls[ui_state]) drawcalls[ui_state](); ImGui::End(); + ImGui::PopStyleColor(); // Status bar. ImGui::SetNextWindowPos(ImVec2(0, io.DisplaySize.y - statusBarHeight)); -- cgit v1.2.3-70-g09d2