diff --git a/src/spice2x/cfg/configurator_wnd.cpp b/src/spice2x/cfg/configurator_wnd.cpp index ca7580d..551778b 100644 --- a/src/spice2x/cfg/configurator_wnd.cpp +++ b/src/spice2x/cfg/configurator_wnd.cpp @@ -21,6 +21,8 @@ static const char *CLASS_NAME = "ConfiguratorWindow"; static std::string WINDOW_TITLE; static int WINDOW_SIZE_X = 800; static int WINDOW_SIZE_Y = 600; +static const int WINDOW_MIN_SIZE_X = 540; +static const int WINDOW_MIN_SIZE_Y = 300; static HICON WINDOW_ICON = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(MAINICON)); static const UINT_PTR RENDER_TIMER_ID = 1; @@ -290,6 +292,22 @@ LRESULT CALLBACK cfg::ConfiguratorWindow::window_proc(HWND hWnd, UINT uMsg, WPAR } break; } + case WM_GETMINMAXINFO: { + + // enforce a minimum window size so the UI can't be shrunk to a + // point where the tabs/controls become unusable. The minimum is + // expressed in client-area pixels and converted to a full window + // size that accounts for the current frame/title-bar style. + RECT rc = { 0, 0, WINDOW_MIN_SIZE_X, WINDOW_MIN_SIZE_Y }; + DWORD style = static_cast(GetWindowLongPtrW(hWnd, GWL_STYLE)); + DWORD ex_style = static_cast(GetWindowLongPtrW(hWnd, GWL_EXSTYLE)); + if (AdjustWindowRectEx(&rc, style, FALSE, ex_style)) { + auto *mmi = reinterpret_cast(lParam); + mmi->ptMinTrackSize.x = rc.right - rc.left; + mmi->ptMinTrackSize.y = rc.bottom - rc.top; + } + break; + } case WM_CREATE: { // set user data of window to class pointer diff --git a/src/spice2x/overlay/windows/config.cpp b/src/spice2x/overlay/windows/config.cpp index 4c89eb1..ada1136 100644 --- a/src/spice2x/overlay/windows/config.cpp +++ b/src/spice2x/overlay/windows/config.cpp @@ -4209,8 +4209,10 @@ namespace overlay::windows { ImGui::TextColored(ImVec4(1, 0.7f, 0, 1), "Card overrides"); ImGui::Spacing(); - ImGui::TextUnformatted("Specify hardcoded card numbers here."); - ImGui::TextUnformatted("Overrides will always take priority when Insert Card is pressed."); + ImGui::TextWrapped( + "%s", + "Specify hardcoded card numbers here.\n\n" + "Overrides will always take priority when Insert Card is pressed."); ImGui::Spacing(); // read in values from options @@ -4387,7 +4389,8 @@ namespace overlay::windows { ImGui::Spacing(); ImGui::TextColored(ImVec4(1, 0.7f, 0, 1), "Card from text files"); ImGui::Spacing(); - ImGui::TextUnformatted( + ImGui::TextWrapped( + "%s", "Use text files on disk; its content will be read when Insert Card is pressed."); ImGui::Spacing();