MCPcopy Create free account
hub / github.com/NetHack/NetHack / mswin_preference_update

Function mswin_preference_update

win/win32/mswproc.c:1968–2090  ·  view source on GitHub ↗

handle options updates here */

Source from the content-addressed store, hash-verified

1966
1967/* handle options updates here */
1968void
1969mswin_preference_update(const char *pref)
1970{
1971 if (stricmp(pref, "font_menu") == 0
1972 || stricmp(pref, "font_size_menu") == 0) {
1973 if (iflags.wc_fontsiz_menu < NHFONT_SIZE_MIN
1974 || iflags.wc_fontsiz_menu > NHFONT_SIZE_MAX)
1975 iflags.wc_fontsiz_menu = NHFONT_DEFAULT_SIZE;
1976
1977 HDC hdc = GetDC(GetNHApp()->hMainWnd);
1978 mswin_get_font(NHW_MENU, ATR_NONE, hdc, TRUE);
1979 mswin_get_font(NHW_MENU, ATR_BOLD, hdc, TRUE);
1980 mswin_get_font(NHW_MENU, ATR_DIM, hdc, TRUE);
1981 mswin_get_font(NHW_MENU, ATR_ULINE, hdc, TRUE);
1982 mswin_get_font(NHW_MENU, ATR_BLINK, hdc, TRUE);
1983 mswin_get_font(NHW_MENU, ATR_INVERSE, hdc, TRUE);
1984 ReleaseDC(GetNHApp()->hMainWnd, hdc);
1985
1986 mswin_layout_main_window(NULL);
1987 return;
1988 }
1989
1990 if (stricmp(pref, "font_status") == 0
1991 || stricmp(pref, "font_size_status") == 0) {
1992 if (iflags.wc_fontsiz_status < NHFONT_SIZE_MIN
1993 || iflags.wc_fontsiz_status > NHFONT_SIZE_MAX)
1994 iflags.wc_fontsiz_status = NHFONT_DEFAULT_SIZE;
1995
1996 HDC hdc = GetDC(GetNHApp()->hMainWnd);
1997 mswin_get_font(NHW_STATUS, ATR_NONE, hdc, TRUE);
1998 mswin_get_font(NHW_STATUS, ATR_BOLD, hdc, TRUE);
1999 mswin_get_font(NHW_STATUS, ATR_DIM, hdc, TRUE);
2000 mswin_get_font(NHW_STATUS, ATR_ULINE, hdc, TRUE);
2001 mswin_get_font(NHW_STATUS, ATR_BLINK, hdc, TRUE);
2002 mswin_get_font(NHW_STATUS, ATR_INVERSE, hdc, TRUE);
2003 ReleaseDC(GetNHApp()->hMainWnd, hdc);
2004
2005 for (int i = 1; i < MAXWINDOWS; i++) {
2006 if (GetNHApp()->windowlist[i].type == NHW_STATUS
2007 && GetNHApp()->windowlist[i].win != NULL) {
2008 InvalidateRect(GetNHApp()->windowlist[i].win, NULL, TRUE);
2009 }
2010 }
2011 mswin_layout_main_window(NULL);
2012 return;
2013 }
2014
2015 if (stricmp(pref, "font_message") == 0
2016 || stricmp(pref, "font_size_message") == 0) {
2017 if (iflags.wc_fontsiz_message < NHFONT_SIZE_MIN
2018 || iflags.wc_fontsiz_message > NHFONT_SIZE_MAX)
2019 iflags.wc_fontsiz_message = NHFONT_DEFAULT_SIZE;
2020
2021 HDC hdc = GetDC(GetNHApp()->hMainWnd);
2022 mswin_get_font(NHW_MESSAGE, ATR_NONE, hdc, TRUE);
2023 mswin_get_font(NHW_MESSAGE, ATR_BOLD, hdc, TRUE);
2024 mswin_get_font(NHW_MESSAGE, ATR_DIM, hdc, TRUE);
2025 mswin_get_font(NHW_MESSAGE, ATR_ULINE, hdc, TRUE);

Callers

nothing calls this directly

Calls 7

GetNHAppFunction · 0.70
mswin_get_fontFunction · 0.70
mswin_layout_main_windowFunction · 0.70
mswin_hwnd_from_winidFunction · 0.70
mswin_cliparoundFunction · 0.70
mswin_select_map_modeFunction · 0.70
mswin_update_inventoryFunction · 0.70

Tested by

no test coverage detected