(from <Someone>)

What's in it:
some MessageBox tidbits:
- Let all MessageBoxes display an icon
- Introduced NHMessageBox to have messageboxes display a consistent title
- Change icon in mswin_display_file from MB_ICONERROR to MB_ICONEXCLAMATION
  for non-fatal error
And to solve #U355: NetHackW won't run on Win2K OS:
- Avoid a crash when closing the main window while the splash screen is
  displayed.
- Make sure NetHack starts normal when closed minimized
- Center the splash screen on the screen, not on the parent window
  (which may be off-screen)

What's new in it:
- Show copyright banner in textbox in splash screen instead of over the picture
- Show news in splash screen only if iflags.news (solves W341-6)
- show complete version information in splash screen when it is used as about box)

[Also reverse the numkey patch in main trunk]
This commit is contained in:
nethack.allison
2003-03-27 00:23:24 +00:00
parent 345ffcfaec
commit debd89444c
9 changed files with 152 additions and 114 deletions

View File

@@ -23,6 +23,7 @@
#include "mhrip.h"
#include "mhmain.h"
#include "mhfont.h"
#include "resource.h"
#define LLEN 128
@@ -333,8 +334,8 @@ void prompt_for_player_selection(void)
/* tty_putstr(BASE_WINDOW, 0, ""); */
/* echoline = wins[BASE_WINDOW]->cury; */
box_result = MessageBox(NULL, prompt, TEXT("NetHack for Windows"),
MB_YESNOCANCEL | MB_DEFBUTTON1);
box_result = NHMessageBox(NULL, prompt,
MB_YESNOCANCEL | MB_DEFBUTTON1 | MB_ICONQUESTION);
pick4u = (box_result == IDYES) ? 'y' : (box_result == IDNO) ? 'n' : '\033';
/* tty_putstr(BASE_WINDOW, 0, prompt); */
do {
@@ -998,7 +999,7 @@ void mswin_display_file(const char *filename,BOOLEAN_P must_exist)
if (must_exist) {
TCHAR message[90];
_stprintf(message, TEXT("Warning! Could not find file: %s\n"), NH_A2W(filename, wbuf, sizeof(wbuf)));
MessageBox(GetNHApp()->hMainWnd, message, TEXT("ERROR"), MB_OK | MB_ICONERROR );
NHMessageBox(GetNHApp()->hMainWnd, message, MB_OK | MB_ICONEXCLAMATION );
}
} else {
winid text;
@@ -1275,7 +1276,7 @@ void mswin_raw_print(const char *str)
TCHAR wbuf[255];
logDebug("mswin_raw_print(%s)\n", str);
if( str && *str )
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
NHMessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), MB_ICONINFORMATION | MB_OK );
}
/*
@@ -1288,7 +1289,7 @@ void mswin_raw_print_bold(const char *str)
TCHAR wbuf[255];
logDebug("mswin_raw_print_bold(%s)\n", str);
if( str && *str )
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
NHMessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), MB_ICONINFORMATION | MB_OK );
}
/*
@@ -1405,10 +1406,9 @@ char mswin_yn_function(const char *question, const char *choices,
+ strlen(GetNHApp()->saved_text) + 1);
DWORD box_result;
strcat(text, question);
box_result = MessageBox(NULL,
box_result = NHMessageBox(NULL,
NH_W2A(text, message, sizeof(message)),
TEXT("NetHack for Windows"),
MB_YESNOCANCEL |
MB_ICONQUESTION | MB_YESNOCANCEL |
((def == 'y') ? MB_DEFBUTTON1 :
(def == 'n') ? MB_DEFBUTTON2 : MB_DEFBUTTON3));
free(text);
@@ -2476,3 +2476,13 @@ void mswin_update_window_placement(int type, LPRECT rt)
}
}
int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type)
{
TCHAR title[MAX_LOADSTRING];
LoadString(GetNHApp()->hApp, IDS_APP_TITLE_SHORT, title, MAX_LOADSTRING);
return MessageBox(hWnd, text, title, type);
}