Skip to content

Commit

Permalink
scale page and find text box by font to make it the right size when w…
Browse files Browse the repository at this point in the history
…e incrase ToolbarSize setting
  • Loading branch information
kjk committed Oct 28, 2023
1 parent 6126563 commit c76414b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Toolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ static int kButtonSpacingX = 4;

// distance between label and edit field
constexpr int kTextPaddingRight = 6;
constexpr int kPageBoxDx = 40;

struct ToolbarButtonInfo {
/* index in the toolbar bitmap (-1 for separators) */
Expand Down Expand Up @@ -519,7 +518,7 @@ void UpdateToolbarState(MainWindow* win) {
}

static void CreateFindBox(MainWindow* win, HFONT hfont, int iconDy) {
int findBoxDx = DpiScale(win->hwndFrame, 160);
int findBoxDx = HwndMeasureText(win->hwndFrame, "this is a story of my", hfont).dx;
HMODULE hmod = GetModuleHandleW(nullptr);
HWND p = win->hwndToolbar;
DWORD style = WS_VISIBLE | WS_CHILD | WS_BORDER;
Expand Down Expand Up @@ -703,7 +702,7 @@ void UpdateToolbarPageText(MainWindow* win, int pageCount, bool updateOnly) {
static void CreatePageBox(MainWindow* win, HFONT font, int iconDy) {
auto hwndFrame = win->hwndFrame;
auto hwndToolbar = win->hwndToolbar;
int boxWidth = DpiScale(hwndFrame, kPageBoxDx);
int boxWidth = HwndMeasureText(hwndFrame, "99999", font).dx;
DWORD style = WS_VISIBLE | WS_CHILD;
auto h = GetModuleHandle(nullptr);
int dx = boxWidth;
Expand Down

0 comments on commit c76414b

Please sign in to comment.