diff options
| -rw-r--r-- | include/config.hpp | 2 | ||||
| -rw-r--r-- | include/ui.hpp | 2 | ||||
| -rw-r--r-- | libs/imgui/imgui_spectrum.h | 212 | ||||
| -rw-r--r-- | src/locales/en.cpp | 20 | ||||
| -rw-r--r-- | src/logger.cpp | 2 | ||||
| -rw-r--r-- | src/main_linux.cpp | 6 | ||||
| -rw-r--r-- | src/ui/imgui_extensions.cpp | 88 | ||||
| -rw-r--r-- | src/ui/ui_expenses.cpp | 37 | ||||
| -rw-r--r-- | src/ui/ui_invoices.cpp | 16 | ||||
| -rw-r--r-- | src/ui/ui_main.cpp | 6 |
10 files changed, 341 insertions, 50 deletions
diff --git a/include/config.hpp b/include/config.hpp index b7b38d5..93b226a 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -32,7 +32,7 @@ #define SIMULATE_EMAIL 1 #define SIMULATE_SLOW_DISK 0 -#define SIMULATE_WRITE_FAILURE 0 +#define SIMULATE_WRITE_FAILURE 1 #define PROGRAM_VERSION "0.1.0" // major.minor.patch diff --git a/include/ui.hpp b/include/ui.hpp index 4636601..d59ef4e 100644 --- a/include/ui.hpp +++ b/include/ui.hpp @@ -90,6 +90,8 @@ namespace ui { namespace ImGui { + void StyleCustom(); + bool InvalidCompanyInfoWarning(); bool WarningIcon(float radius); diff --git a/libs/imgui/imgui_spectrum.h b/libs/imgui/imgui_spectrum.h new file mode 100644 index 0000000..27d6dba --- /dev/null +++ b/libs/imgui/imgui_spectrum.h @@ -0,0 +1,212 @@ +#pragma once + +/* +Color definitions in ImGui are a good starting point, +but do not cover all the intricacies of Spectrum's possible colors +in controls and widgets. + +One big difference is that ImGui communicates widget activity +(hover, pressed) with their background, while spectrum uses a mix +of background and border, with border being the most common choice. + +Because of this, we reference extra colors in spectrum from +imgui.cpp and imgui_widgets.cpp directly, and to make that work, +we need to have them defined at here at compile time. +*/ + +/// Pick one, or have one defined already. +#if !defined(SPECTRUM_USE_LIGHT_THEME) && !defined(SPECTRUM_USE_DARK_THEME) +#define SPECTRUM_USE_LIGHT_THEME +//#define SPECTRUM_USE_DARK_THEME +#endif + +namespace ImGui { + namespace Spectrum { + // a list of changes introduced to change the look of the widgets. + // Collected here as const rather than being magic numbers spread + // around imgui.cpp and imgui_widgets.cpp. + const float CHECKBOX_BORDER_SIZE = 2.0f; + const float CHECKBOX_ROUNDING = 2.0f; + + // Load SourceSansProRegular and sets it as a default font. + // You may want to call ImGui::GetIO().Fonts->Clear() before this + void LoadFont(float size = 16.0f); + + // Sets the ImGui style to Spectrum + void StyleColorsSpectrum(); + + namespace { // Unnamed namespace, since we only use this here. + unsigned int Color(unsigned int c) { + // add alpha. + // also swap red and blue channel for some reason. + // todo: figure out why, and fix it. + const short a = 0xFF; + const short r = (c >> 16) & 0xFF; + const short g = (c >> 8) & 0xFF; + const short b = (c >> 0) & 0xFF; + return(a << 24) + | (r << 0) + | (g << 8) + | (b << 16); + } + } + // all colors are from http://spectrum.corp.adobe.com/color.html + + inline unsigned int color_alpha(unsigned int alpha, unsigned int c) { + return ((alpha & 0xFF) << 24) | (c & 0x00FFFFFF); + } + + namespace Static { // static colors + const unsigned int NONE = 0x00000000; // transparent + const unsigned int WHITE = Color(0xFFFFFF); + const unsigned int BLACK = Color(0x000000); + const unsigned int GRAY200 = Color(0xF4F4F4); + const unsigned int GRAY300 = Color(0xEAEAEA); + const unsigned int GRAY400 = Color(0xD3D3D3); + const unsigned int GRAY500 = Color(0xBCBCBC); + const unsigned int GRAY600 = Color(0x959595); + const unsigned int GRAY700 = Color(0x767676); + const unsigned int GRAY800 = Color(0x505050); + const unsigned int GRAY900 = Color(0x323232); + const unsigned int BLUE400 = Color(0x378EF0); + const unsigned int BLUE500 = Color(0x2680EB); + const unsigned int BLUE600 = Color(0x1473E6); + const unsigned int BLUE700 = Color(0x0D66D0); + const unsigned int RED400 = Color(0xEC5B62); + const unsigned int RED500 = Color(0xE34850); + const unsigned int RED600 = Color(0xD7373F); + const unsigned int RED700 = Color(0xC9252D); + const unsigned int ORANGE400 = Color(0xF29423); + const unsigned int ORANGE500 = Color(0xE68619); + const unsigned int ORANGE600 = Color(0xDA7B11); + const unsigned int ORANGE700 = Color(0xCB6F10); + const unsigned int GREEN400 = Color(0x33AB84); + const unsigned int GREEN500 = Color(0x2D9D78); + const unsigned int GREEN600 = Color(0x268E6C); + const unsigned int GREEN700 = Color(0x12805C); + } + +#ifdef SPECTRUM_USE_LIGHT_THEME + const unsigned int GRAY50 = Color(0xFFFFFF); + const unsigned int GRAY75 = Color(0xFAFAFA); + const unsigned int GRAY100 = Color(0xF5F5F5); + const unsigned int GRAY200 = Color(0xEAEAEA); + const unsigned int GRAY300 = Color(0xE1E1E1); + const unsigned int GRAY400 = Color(0xCACACA); + const unsigned int GRAY500 = Color(0xB3B3B3); + const unsigned int GRAY600 = Color(0x8E8E8E); + const unsigned int GRAY700 = Color(0x707070); + const unsigned int GRAY800 = Color(0x4B4B4B); + const unsigned int GRAY900 = Color(0x2C2C2C); + const unsigned int BLUE400 = Color(0x2680EB); + const unsigned int BLUE500 = Color(0x1473E6); + const unsigned int BLUE600 = Color(0x0D66D0); + const unsigned int BLUE700 = Color(0x095ABA); + const unsigned int RED400 = Color(0xE34850); + const unsigned int RED500 = Color(0xD7373F); + const unsigned int RED600 = Color(0xC9252D); + const unsigned int RED700 = Color(0xBB121A); + const unsigned int ORANGE400 = Color(0xE68619); + const unsigned int ORANGE500 = Color(0xDA7B11); + const unsigned int ORANGE600 = Color(0xCB6F10); + const unsigned int ORANGE700 = Color(0xBD640D); + const unsigned int GREEN400 = Color(0x2D9D78); + const unsigned int GREEN500 = Color(0x268E6C); + const unsigned int GREEN600 = Color(0x12805C); + const unsigned int GREEN700 = Color(0x107154); + const unsigned int INDIGO400 = Color(0x6767EC); + const unsigned int INDIGO500 = Color(0x5C5CE0); + const unsigned int INDIGO600 = Color(0x5151D3); + const unsigned int INDIGO700 = Color(0x4646C6); + const unsigned int CELERY400 = Color(0x44B556); + const unsigned int CELERY500 = Color(0x3DA74E); + const unsigned int CELERY600 = Color(0x379947); + const unsigned int CELERY700 = Color(0x318B40); + const unsigned int MAGENTA400 = Color(0xD83790); + const unsigned int MAGENTA500 = Color(0xCE2783); + const unsigned int MAGENTA600 = Color(0xBC1C74); + const unsigned int MAGENTA700 = Color(0xAE0E66); + const unsigned int YELLOW400 = Color(0xDFBF00); + const unsigned int YELLOW500 = Color(0xD2B200); + const unsigned int YELLOW600 = Color(0xC4A600); + const unsigned int YELLOW700 = Color(0xB79900); + const unsigned int FUCHSIA400 = Color(0xC038CC); + const unsigned int FUCHSIA500 = Color(0xB130BD); + const unsigned int FUCHSIA600 = Color(0xA228AD); + const unsigned int FUCHSIA700 = Color(0x93219E); + const unsigned int SEAFOAM400 = Color(0x1B959A); + const unsigned int SEAFOAM500 = Color(0x16878C); + const unsigned int SEAFOAM600 = Color(0x0F797D); + const unsigned int SEAFOAM700 = Color(0x096C6F); + const unsigned int CHARTREUSE400 = Color(0x85D044); + const unsigned int CHARTREUSE500 = Color(0x7CC33F); + const unsigned int CHARTREUSE600 = Color(0x73B53A); + const unsigned int CHARTREUSE700 = Color(0x6AA834); + const unsigned int PURPLE400 = Color(0x9256D9); + const unsigned int PURPLE500 = Color(0x864CCC); + const unsigned int PURPLE600 = Color(0x7A42BF); + const unsigned int PURPLE700 = Color(0x6F38B1); +#endif +#ifdef SPECTRUM_USE_DARK_THEME + const unsigned int GRAY50 = Color(0x252525); + const unsigned int GRAY75 = Color(0x2F2F2F); + const unsigned int GRAY100 = Color(0x323232); + const unsigned int GRAY200 = Color(0x393939); + const unsigned int GRAY300 = Color(0x3E3E3E); + const unsigned int GRAY400 = Color(0x4D4D4D); + const unsigned int GRAY500 = Color(0x5C5C5C); + const unsigned int GRAY600 = Color(0x7B7B7B); + const unsigned int GRAY700 = Color(0x999999); + const unsigned int GRAY800 = Color(0xCDCDCD); + const unsigned int GRAY900 = Color(0xFFFFFF); + const unsigned int BLUE400 = Color(0x2680EB); + const unsigned int BLUE500 = Color(0x378EF0); + const unsigned int BLUE600 = Color(0x4B9CF5); + const unsigned int BLUE700 = Color(0x5AA9FA); + const unsigned int RED400 = Color(0xE34850); + const unsigned int RED500 = Color(0xEC5B62); + const unsigned int RED600 = Color(0xF76D74); + const unsigned int RED700 = Color(0xFF7B82); + const unsigned int ORANGE400 = Color(0xE68619); + const unsigned int ORANGE500 = Color(0xF29423); + const unsigned int ORANGE600 = Color(0xF9A43F); + const unsigned int ORANGE700 = Color(0xFFB55B); + const unsigned int GREEN400 = Color(0x2D9D78); + const unsigned int GREEN500 = Color(0x33AB84); + const unsigned int GREEN600 = Color(0x39B990); + const unsigned int GREEN700 = Color(0x3FC89C); + const unsigned int INDIGO400 = Color(0x6767EC); + const unsigned int INDIGO500 = Color(0x7575F1); + const unsigned int INDIGO600 = Color(0x8282F6); + const unsigned int INDIGO700 = Color(0x9090FA); + const unsigned int CELERY400 = Color(0x44B556); + const unsigned int CELERY500 = Color(0x4BC35F); + const unsigned int CELERY600 = Color(0x51D267); + const unsigned int CELERY700 = Color(0x58E06F); + const unsigned int MAGENTA400 = Color(0xD83790); + const unsigned int MAGENTA500 = Color(0xE2499D); + const unsigned int MAGENTA600 = Color(0xEC5AAA); + const unsigned int MAGENTA700 = Color(0xF56BB7); + const unsigned int YELLOW400 = Color(0xDFBF00); + const unsigned int YELLOW500 = Color(0xEDCC00); + const unsigned int YELLOW600 = Color(0xFAD900); + const unsigned int YELLOW700 = Color(0xFFE22E); + const unsigned int FUCHSIA400 = Color(0xC038CC); + const unsigned int FUCHSIA500 = Color(0xCF3EDC); + const unsigned int FUCHSIA600 = Color(0xD951E5); + const unsigned int FUCHSIA700 = Color(0xE366EF); + const unsigned int SEAFOAM400 = Color(0x1B959A); + const unsigned int SEAFOAM500 = Color(0x20A3A8); + const unsigned int SEAFOAM600 = Color(0x23B2B8); + const unsigned int SEAFOAM700 = Color(0x26C0C7); + const unsigned int CHARTREUSE400 = Color(0x85D044); + const unsigned int CHARTREUSE500 = Color(0x8EDE49); + const unsigned int CHARTREUSE600 = Color(0x9BEC54); + const unsigned int CHARTREUSE700 = Color(0xA3F858); + const unsigned int PURPLE400 = Color(0x9256D9); + const unsigned int PURPLE500 = Color(0x9D64E1); + const unsigned int PURPLE600 = Color(0xA873E9); + const unsigned int PURPLE700 = Color(0xB483F0); +#endif + } +} 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 <IconFontCppHeaders/IconsFontAwesome5.h> + #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 <time.h> +#include <imgui/imgui_spectrum.h> #include <tinyfiledialogs/tinyfiledialogs.h> +#include <IconFontCppHeaders/IconsFontAwesome5.h> #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)); |
