little-brother / sqlite-x

The minimalistic SQLite editor for non-programmers
GNU General Public License v2.0
63 stars 3 forks source link

font-size is not used in all places #3

Closed ghost closed 11 months ago

ghost commented 1 year ago

its used in the main view, but not in the New table view:

Untitled

ghost commented 1 year ago

this seems to work, although it is ugly:

int font_size = getStoredValue(TEXT("font-size"), 16);
int margin = 9;
int width_inner = 20*font_size;
int width_outer = 21*font_size;
int x = 0;

CreateWindow(WC_STATIC, TEXT("Table name"), WS_VISIBLE | WS_CHILD, 
x, 0, width_inner, font_size, hWnd, (HMENU)IntToPtr(IDC_DLG_LABEL), GetModuleHandle(0), 0);

CreateWindow(WC_EDIT, NULL, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 
x, font_size+margin, width_inner, font_size, hWnd, (HMENU)IntToPtr(IDC_DLG_EDIT), GetModuleHandle(0), 0);

CreateWindow(WC_STATIC, TEXT("Column names separated by commas"), WS_VISIBLE | WS_CHILD, 
x, 2*font_size+2*margin, width_inner, font_size, hWnd, (HMENU)IntToPtr(IDC_DLG_LABEL), GetModuleHandle(0), 0);

CreateWindow(WC_EDIT, NULL, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | WS_CLIPSIBLINGS | ES_AUTOHSCROLL, 
x, 3*font_size+3*margin, width_inner, font_size, hWnd, (HMENU)IntToPtr(IDC_DLG_EDIT + 1), GetModuleHandle(0), 0);

CreateWindow(WC_BUTTON, TEXT("OK"), WS_VISIBLE | WS_CHILD | WS_TABSTOP,
x, 4*font_size+4*margin, width_inner, font_size, hWnd, (HMENU)IDC_DLG_OK, GetModuleHandle(0), 0);

RECT rc;
GetWindowRect((HWND)lParam, &rc);
SetWindowPos(hWnd, 0,
rc.left + 50, rc.top + 50, width_outer, 6*font_size+6*margin,
SWP_NOZORDER);  

HFONT hFont = CreateFont (
   font_size,
   0, 0, 0, FW_DONTCARE, FALSE, FALSE,
   FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
   DEFAULT_PITCH | FF_SWISS, (TCHAR*)GetProp(hWnd, TEXT("FONTFAMILY"))
);

EnumChildWindows(
   hWnd, (WNDENUMPROC)cbEnumSetFont,
   (LPARAM)hFont
);  

result with 30:

30

result with 15:

15

https://github.com/little-brother/sqlite-x/files/11607102/sqlite-x.zip

little-brother commented 1 year ago

Thanks. I forgot to apply the font size in the dialog. Sorry for a long response. I somehow missed your message.

little-brother commented 11 months ago

Done.