# window, windowframe, windowtext.
#OPTIONS=windowcolors:status windowtext/window message windowtext/window
+# "Nethack mode" colors
+OPTIONS=windowcolors:status white/#000000 message white/#000000 text white/#000000 menu white/#000000 menutext white/#000000
+OPTIONS=vary_msgcount:1
+
# *** LOCATIONS ***
# IMPORTANT: If you change any of these locations, the directories they
# point at must exist. NetHack will not create them for you.
static int mapmode2menuid(int map_mode);
static void nhlock_windows(BOOL lock);
static char *nh_compose_ascii_screenshot();
+static void mswin_apply_window_style_all();
// returns strdup() created pointer - callee assumes the ownership
HWND
/* kludge - inventory window should have its own type (same as
menu-text
as a matter of fact) */
- if (flags.perm_invent && i == WIN_INVEN)
+ if (flags.perm_invent && i == WIN_INVEN) {
mswin_get_window_placement(NHW_INVEN, &rt);
- else
+ } else {
mswin_get_window_placement(GetNHApp()->windowlist[i].type,
&rt);
+ }
MoveWindow(GetNHApp()->windowlist[i].win, rt.left, rt.top,
rt.right - rt.left, rt.bottom - rt.top, TRUE);
case IDM_NHMODE: {
GetNHApp()->regNetHackMode = GetNHApp()->regNetHackMode ? 0 : 1;
mswin_menu_check_intf_mode();
+ mswin_apply_window_style_all();
break;
}
case IDM_CLEARSETTINGS: {
void
nhlock_windows(BOOL lock)
{
- int i;
+ /* update menu */
+ GetNHApp()->bWindowsLocked = lock;
+ CheckMenuItem(GetMenu(GetNHApp()->hMainWnd), IDM_SETTING_LOCKWINDOWS,
+ MF_BYCOMMAND | (lock ? MF_CHECKED : MF_UNCHECKED));
- /* go through the windows list and adjust sizes */
+ /* restyle windows */
+ mswin_apply_window_style_all();
+}
+
+void
+mswin_apply_window_style(HWND hwnd) {
+ DWORD style = 0, exstyle = 0;
+
+ style = GetWindowLong(hwnd, GWL_STYLE);
+ exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+
+ if( !GetNHApp()->bWindowsLocked ) {
+ style = WS_CHILD|WS_CLIPSIBLINGS|WS_CAPTION|WS_SIZEBOX|(style & (WS_VISIBLE|WS_VSCROLL|WS_HSCROLL));
+ exstyle = WS_EX_WINDOWEDGE;
+ } else if (GetNHApp()->regNetHackMode) {
+ /* do away borders */
+ style = WS_CHILD|WS_CLIPSIBLINGS|(style & (WS_VISIBLE|WS_VSCROLL|WS_HSCROLL));
+ exstyle = 0;
+ } else {
+ style = WS_CHILD|WS_CLIPSIBLINGS|WS_THICKFRAME|(style & (WS_VISIBLE|WS_VSCROLL|WS_HSCROLL));
+ exstyle = WS_EX_WINDOWEDGE;
+ }
+
+ SetWindowLong(hwnd, GWL_STYLE, style);
+ SetWindowLong(hwnd, GWL_EXSTYLE, exstyle);
+ SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
+}
+
+void
+mswin_apply_window_style_all() {
+ int i;
for (i = 0; i < MAXWINDOWS; i++) {
if (IsWindow(GetNHApp()->windowlist[i].win)
&& !GetNHApp()->windowlist[i].dead) {
- DWORD style;
- style = GetWindowLong(GetNHApp()->windowlist[i].win, GWL_STYLE);
- if (lock)
- style &= ~WS_CAPTION;
- else
- style |= WS_CAPTION;
- SetWindowLong(GetNHApp()->windowlist[i].win, GWL_STYLE, style);
- SetWindowPos(GetNHApp()->windowlist[i].win, NULL, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER
- | SWP_FRAMECHANGED);
+ mswin_apply_window_style(GetNHApp()->windowlist[i].win);
}
}
-
- /* update menu */
- GetNHApp()->bWindowsLocked = lock;
- CheckMenuItem(GetMenu(GetNHApp()->hMainWnd), IDM_SETTING_LOCKWINDOWS,
- MF_BYCOMMAND | (lock ? MF_CHECKED : MF_UNCHECKED));
+ mswin_layout_main_window(NULL);
}
// returns strdup() created pointer - callee assumes the ownership
/* Set window caption */
SetWindowText(ret, "Map");
+ mswin_apply_window_style(ret);
+
return ret;
}
/* Set window caption */
SetWindowText(ret, "Menu/Text");
- if (!GetNHApp()->bWindowsLocked) {
- DWORD style;
- style = GetWindowLong(ret, GWL_STYLE);
- style |= WS_CAPTION;
- SetWindowLong(ret, GWL_STYLE, style);
- SetWindowPos(ret, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
- | SWP_NOZORDER
- | SWP_FRAMECHANGED);
- }
+ mswin_apply_window_style(ret);
SetMenuType(ret, type);
return ret;
activate = TRUE;
}
- data->is_active = activate;
+ data->is_active = activate && !GetNHApp()->regNetHackMode;
/* set menu type */
SetMenuListType(hWnd, how);
: SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT));
}
}
- return FALSE;
+ return FALSE;
+
+ case WM_CTLCOLORDLG:
+ return (INT_PTR)(text_bg_brush
+ ? text_bg_brush
+ : SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT));
case WM_DESTROY:
if (data) {
switch (how) {
case PICK_NONE:
- dwStyles = WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_CHILD | WS_VSCROLL
+ dwStyles = WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_VSCROLL
| WS_HSCROLL | LVS_REPORT | LVS_OWNERDRAWFIXED
| LVS_SINGLESEL;
break;
case PICK_ONE:
- dwStyles = WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_CHILD | WS_VSCROLL
+ dwStyles = WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_VSCROLL
| WS_HSCROLL | LVS_REPORT | LVS_OWNERDRAWFIXED
| LVS_SINGLESEL;
break;
case PICK_ANY:
- dwStyles = WS_VISIBLE | WS_TABSTOP | WS_BORDER | WS_CHILD | WS_VSCROLL
+ dwStyles = WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_VSCROLL
| WS_HSCROLL | LVS_REPORT | LVS_OWNERDRAWFIXED
| LVS_SINGLESEL;
break;
#define MSG_WRAP_TEXT
-#define MSG_VISIBLE_LINES max(iflags.wc_vary_msgcount, 2)
+#define MSG_VISIBLE_LINES max(iflags.wc_vary_msgcount, 1)
#define MAX_MSG_LINES 128
#define MSG_LINES (int) min(iflags.msg_history, MAX_MSG_LINES)
#define MAXWINDOWTEXT TBUFSZ
/* Set window caption */
SetWindowText(ret, "Messages");
+ mswin_apply_window_style(ret);
+
return ret;
}
ZeroMemory(data, sizeof(NHStatusWindow));
SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR) data);
+
+ mswin_apply_window_style(ret);
+
return ret;
}
/* Set window caption */
SetWindowText(ret, "Text");
- if (!GetNHApp()->bWindowsLocked) {
- DWORD style;
- style = GetWindowLong(ret, GWL_STYLE);
- style |= WS_CAPTION;
- SetWindowLong(ret, GWL_STYLE, style);
- SetWindowPos(ret, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
- | SWP_NOZORDER
- | SWP_FRAMECHANGED);
- }
/* create and set window data */
data = (PNHTextWindow) malloc(sizeof(NHTextWindow));
panic("out of memory");
ZeroMemory(data, sizeof(NHTextWindow));
SetWindowLongPtr(ret, GWLP_USERDATA, (LONG_PTR) data);
+
+ mswin_apply_window_style(ret);
+
return ret;
}
/* get window coordinates */
GetClientRect(hWnd, &clrt);
- /* set window placements */
- GetWindowRect(btn_ok, &rt);
- sz_ok.cx = clrt.right - clrt.left;
- sz_ok.cy = rt.bottom - rt.top;
- pt_ok.x = clrt.left;
- pt_ok.y = clrt.bottom - sz_ok.cy;
+ if( !GetNHApp()->regNetHackMode ) {
+ /* set window placements */
+ GetWindowRect(btn_ok, &rt);
+ sz_ok.cx = clrt.right - clrt.left;
+ sz_ok.cy = rt.bottom - rt.top;
+ pt_ok.x = clrt.left;
+ pt_ok.y = clrt.bottom - sz_ok.cy;
+
+ pt_elem.x = clrt.left;
+ pt_elem.y = clrt.top;
+ sz_elem.cx = clrt.right - clrt.left;
+ sz_elem.cy = pt_ok.y;
+
+ MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE);
+ MoveWindow(btn_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE);
+ } else {
+ sz_ok.cx = sz_ok.cy = 0;
+
+ pt_ok.x = pt_ok.y = 0;
+ pt_elem.x = clrt.left;
+ pt_elem.y = clrt.top;
- pt_elem.x = clrt.left;
- pt_elem.y = clrt.top;
- sz_elem.cx = clrt.right - clrt.left;
- sz_elem.cy = pt_ok.y;
+ sz_elem.cx = clrt.right - clrt.left;
+ sz_elem.cy = clrt.bottom - clrt.top;
- MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE);
- MoveWindow(btn_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE);
+ ShowWindow(btn_ok, SW_HIDE);
+ MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE );
+ }
+ mswin_apply_window_style(text);
}
/* Edit box hook */
*/
iflags.toptenwin = 1;
set_option_mod_status("toptenwin", SET_IN_FILE);
- set_option_mod_status("perm_invent", SET_IN_FILE);
+ //set_option_mod_status("perm_invent", SET_IN_FILE);
/* initialize map tiles bitmap */
initMapTiles();
is
read from the registry, so these defaults apply. */
GetNHApp()->saveRegistrySettings = 1; /* Normally, we always save */
- GetNHApp()->regNetHackMode = 0;
+ GetNHApp()->regNetHackMode = TRUE;
if (RegOpenKeyEx(HKEY_CURRENT_USER, keystring, 0, KEY_READ, &key)
!= ERROR_SUCCESS)
void mswin_get_window_placement(int type, LPRECT rt);
void mswin_update_window_placement(int type, LPRECT rt);
+void mswin_apply_window_style(HWND hwnd);
int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type);
EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif", 0, 0
BEGIN
- LISTBOX IDC_MENU_LIST,10,10,170,55,LBS_SORT
+ LISTBOX IDC_MENU_LIST,10,10,170,55,LBS_SORT | NOT WS_BORDER
EDITTEXT IDC_MENU_TEXT,10,70,170,60,ES_MULTILINE | ES_OEMCONVERT |
- ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP
+ ES_READONLY | WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP | NOT WS_BORDER
DEFPUSHBUTTON "OK",IDOK,7,132,50,14,BS_FLAT | NOT WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,130,132,50,14,BS_FLAT | NOT WS_TABSTOP
END