Some TODO resolution.
This commit is contained in:
parent
3705ef05d1
commit
d060744f87
|
@ -932,8 +932,7 @@ static void fixupControlPositions(struct colorDialog *c)
|
|||
labelA, c->editADouble, c->editAInt,
|
||||
NULL);
|
||||
|
||||
// TODO this uses the message font, not the dialog font
|
||||
uiWindowsGetSizing(c->hwnd, &sizing);
|
||||
getSizing(c->hwnd, &sizing, (HFONT) SendMessageW(labelH, WM_GETFONT, 0, 0));
|
||||
offset = sizing.InternalLeading;
|
||||
moveWindowsUp(c, offset,
|
||||
labelH, labelS, labelV,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "uipriv_windows.hpp"
|
||||
|
||||
// TODO rework the error handling
|
||||
void uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing)
|
||||
void getSizing(HWND hwnd, uiWindowsSizing *sizing, HFONT font)
|
||||
{
|
||||
HDC dc;
|
||||
HFONT prevfont;
|
||||
|
@ -12,7 +12,7 @@ void uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing)
|
|||
dc = GetDC(hwnd);
|
||||
if (dc == NULL)
|
||||
logLastError(L"error getting DC");
|
||||
prevfont = (HFONT) SelectObject(dc, hMessageFont);
|
||||
prevfont = (HFONT) SelectObject(dc, font);
|
||||
if (prevfont == NULL)
|
||||
logLastError(L"error loading control font into device context");
|
||||
|
||||
|
@ -26,12 +26,17 @@ void uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing)
|
|||
sizing->BaseY = (int) tm.tmHeight;
|
||||
sizing->InternalLeading = tm.tmInternalLeading;
|
||||
|
||||
if (SelectObject(dc, prevfont) != hMessageFont)
|
||||
if (SelectObject(dc, prevfont) != font)
|
||||
logLastError(L"error restoring previous font into device context");
|
||||
if (ReleaseDC(hwnd, dc) == 0)
|
||||
logLastError(L"error releasing DC");
|
||||
}
|
||||
|
||||
void uiWindowsGetSizing(HWND hwnd, uiWindowsSizing *sizing)
|
||||
{
|
||||
return getSizing(hwnd, sizing, hMessageFont);
|
||||
}
|
||||
|
||||
#define dlgUnitsToX(dlg, baseX) MulDiv((dlg), (baseX), 4)
|
||||
#define dlgUnitsToY(dlg, baseY) MulDiv((dlg), (baseY), 8)
|
||||
|
||||
|
|
|
@ -137,6 +137,9 @@ struct colorDialogRGBA {
|
|||
};
|
||||
extern BOOL showColorDialog(HWND parent, struct colorDialogRGBA *c);
|
||||
|
||||
// sizing.cpp
|
||||
extern void getSizing(HWND hwnd, uiWindowsSizing *sizing, HFONT font);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -185,7 +185,6 @@ static void uiWindowShow(uiControl *c)
|
|||
|
||||
w->visible = 1;
|
||||
// just in case the window's minimum size wasn't recalculated already
|
||||
// TODO is it needed?
|
||||
ensureMinimumWindowSize(w);
|
||||
if (w->shownOnce) {
|
||||
ShowWindow(w->hwnd, SW_SHOW);
|
||||
|
|
Loading…
Reference in New Issue