mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 14:20:42 -07:00
cfg: enforce minimum window size (#767)
This commit is contained in:
@@ -21,6 +21,8 @@ static const char *CLASS_NAME = "ConfiguratorWindow";
|
|||||||
static std::string WINDOW_TITLE;
|
static std::string WINDOW_TITLE;
|
||||||
static int WINDOW_SIZE_X = 800;
|
static int WINDOW_SIZE_X = 800;
|
||||||
static int WINDOW_SIZE_Y = 600;
|
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 HICON WINDOW_ICON = LoadIcon(GetModuleHandle(nullptr), MAKEINTRESOURCE(MAINICON));
|
||||||
|
|
||||||
static const UINT_PTR RENDER_TIMER_ID = 1;
|
static const UINT_PTR RENDER_TIMER_ID = 1;
|
||||||
@@ -290,6 +292,22 @@ LRESULT CALLBACK cfg::ConfiguratorWindow::window_proc(HWND hWnd, UINT uMsg, WPAR
|
|||||||
}
|
}
|
||||||
break;
|
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<DWORD>(GetWindowLongPtrW(hWnd, GWL_STYLE));
|
||||||
|
DWORD ex_style = static_cast<DWORD>(GetWindowLongPtrW(hWnd, GWL_EXSTYLE));
|
||||||
|
if (AdjustWindowRectEx(&rc, style, FALSE, ex_style)) {
|
||||||
|
auto *mmi = reinterpret_cast<MINMAXINFO *>(lParam);
|
||||||
|
mmi->ptMinTrackSize.x = rc.right - rc.left;
|
||||||
|
mmi->ptMinTrackSize.y = rc.bottom - rc.top;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WM_CREATE: {
|
case WM_CREATE: {
|
||||||
|
|
||||||
// set user data of window to class pointer
|
// set user data of window to class pointer
|
||||||
|
|||||||
@@ -4209,8 +4209,10 @@ namespace overlay::windows {
|
|||||||
|
|
||||||
ImGui::TextColored(ImVec4(1, 0.7f, 0, 1), "Card overrides");
|
ImGui::TextColored(ImVec4(1, 0.7f, 0, 1), "Card overrides");
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::TextUnformatted("Specify hardcoded card numbers here.");
|
ImGui::TextWrapped(
|
||||||
ImGui::TextUnformatted("Overrides will always take priority when Insert Card is pressed.");
|
"%s",
|
||||||
|
"Specify hardcoded card numbers here.\n\n"
|
||||||
|
"Overrides will always take priority when Insert Card is pressed.");
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
// read in values from options
|
// read in values from options
|
||||||
@@ -4387,7 +4389,8 @@ namespace overlay::windows {
|
|||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::TextColored(ImVec4(1, 0.7f, 0, 1), "Card from text files");
|
ImGui::TextColored(ImVec4(1, 0.7f, 0, 1), "Card from text files");
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::TextUnformatted(
|
ImGui::TextWrapped(
|
||||||
|
"%s",
|
||||||
"Use text files on disk; its content will be read when Insert Card is pressed.");
|
"Use text files on disk; its content will be read when Insert Card is pressed.");
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user