To summarise:
- My "various Windows refinements" patch from yesterday went into 3.4.x correctly - My "NumberPad" patch went into 3.4.x, but should be backed out - My "various Windows refinements" patch from last week was for 3.5.0, but is incomplete; you can safely ignore that. - I'll make a new "various Windows refinements" patch for 3.5.0 tonight.
This commit is contained in:
@@ -354,7 +354,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||||||
if( plselFinalSelection(hWnd, data->selection) ) {
|
if( plselFinalSelection(hWnd, data->selection) ) {
|
||||||
EndDialog(hWnd, wParam);
|
EndDialog(hWnd, wParam);
|
||||||
} else {
|
} else {
|
||||||
NHMessageBox(hWnd, TEXT("Cannot match this role. Try something else."), MB_ICONSTOP | MB_OK );
|
MessageBox(hWnd, TEXT("Cannot match this role. Try something else."), TEXT("STOP"), MB_OK );
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@@ -677,7 +677,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
|
|||||||
if( flags.initrole==ROLE_RANDOM ) {
|
if( flags.initrole==ROLE_RANDOM ) {
|
||||||
flags.initrole = pick_role(flags.initrace, flags.initgend, flags.initalign, PICK_RANDOM);
|
flags.initrole = pick_role(flags.initrace, flags.initgend, flags.initalign, PICK_RANDOM);
|
||||||
if (flags.initrole < 0) {
|
if (flags.initrole < 0) {
|
||||||
NHMessageBox(hWnd, TEXT("Incompatible role!"), MB_ICONSTOP | MB_OK);
|
MessageBox(hWnd, TEXT("Incompatible role!"), TEXT("STOP"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -691,7 +691,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags.initrace < 0) {
|
if (flags.initrace < 0) {
|
||||||
NHMessageBox(hWnd, TEXT("Incompatible race!"), MB_ICONSTOP | MB_OK);
|
MessageBox(hWnd, TEXT("Incompatible race!"), TEXT("STOP"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -707,7 +707,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags.initgend < 0) {
|
if (flags.initgend < 0) {
|
||||||
NHMessageBox(hWnd, TEXT("Incompatible gender!"), MB_ICONSTOP | MB_OK);
|
MessageBox(hWnd, TEXT("Incompatible gender!"), TEXT("STOP"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -720,7 +720,7 @@ int plselFinalSelection(HWND hWnd, int* selection)
|
|||||||
if (flags.initalign == ROLE_RANDOM) {
|
if (flags.initalign == ROLE_RANDOM) {
|
||||||
flags.initalign = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM);
|
flags.initalign = pick_align(flags.initrole, flags.initrace, flags.initgend, PICK_RANDOM);
|
||||||
} else {
|
} else {
|
||||||
NHMessageBox(hWnd, TEXT("Incompatible alignment!"), MB_ICONSTOP | MB_OK);
|
MessageBox(hWnd, TEXT("Incompatible alignment!"), TEXT("STOP"), MB_OK);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ static struct font_table_entry {
|
|||||||
} font_table[MAXFONTS] ;
|
} font_table[MAXFONTS] ;
|
||||||
static int font_table_size = 0;
|
static int font_table_size = 0;
|
||||||
HFONT version_splash_font;
|
HFONT version_splash_font;
|
||||||
|
HFONT extrainfo_splash_font;
|
||||||
|
|
||||||
#define NHFONT_CODE(win, attr) (((attr&0xFF)<<8)|(win_type&0xFF))
|
#define NHFONT_CODE(win, attr) (((attr&0xFF)<<8)|(win_type&0xFF))
|
||||||
|
|
||||||
@@ -40,12 +41,15 @@ void mswin_init_splashfonts(HWND hWnd)
|
|||||||
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
|
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
|
||||||
NH_A2W( "Times New Roman", lgfnt.lfFaceName, LF_FACESIZE);
|
NH_A2W( "Times New Roman", lgfnt.lfFaceName, LF_FACESIZE);
|
||||||
version_splash_font = CreateFontIndirect(&lgfnt);
|
version_splash_font = CreateFontIndirect(&lgfnt);
|
||||||
|
lgfnt.lfHeight = -16; // height of font
|
||||||
|
extrainfo_splash_font = CreateFontIndirect(&lgfnt);
|
||||||
ReleaseDC(hWnd, hdc);
|
ReleaseDC(hWnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mswin_destroy_splashfonts()
|
void mswin_destroy_splashfonts()
|
||||||
{
|
{
|
||||||
DeleteObject (version_splash_font);
|
DeleteObject (version_splash_font);
|
||||||
|
DeleteObject (extrainfo_splash_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create font based on window type, charater attributes and
|
/* create font based on window type, charater attributes and
|
||||||
|
|||||||
@@ -438,8 +438,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
|||||||
|
|
||||||
wp.length = sizeof(wp);
|
wp.length = sizeof(wp);
|
||||||
if (GetWindowPlacement(hWnd, &wp)) {
|
if (GetWindowPlacement(hWnd, &wp)) {
|
||||||
GetNHApp()->regMainShowState = (wp.showCmd == SW_SHOWMAXIMIZED
|
GetNHApp()->regMainShowState = wp.showCmd;
|
||||||
? SW_SHOWMAXIMIZED : SW_SHOWNORMAL);
|
|
||||||
|
|
||||||
GetNHApp()->regMainMinX = wp.ptMinPosition.x;
|
GetNHApp()->regMainMinX = wp.ptMinPosition.x;
|
||||||
GetNHApp()->regMainMinY = wp.ptMinPosition.y;
|
GetNHApp()->regMainMinY = wp.ptMinPosition.y;
|
||||||
@@ -473,15 +472,9 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
|||||||
NHEVENT_KBD('\033'); /* and send keyboard input as if user pressed ESC */
|
NHEVENT_KBD('\033'); /* and send keyboard input as if user pressed ESC */
|
||||||
/* additional code for this is done in menu and rip windows */
|
/* additional code for this is done in menu and rip windows */
|
||||||
}
|
}
|
||||||
else if (!program_state.something_worth_saving)
|
|
||||||
{
|
|
||||||
/* User exited before the game started, e.g. during splash display */
|
|
||||||
/* Just get out. */
|
|
||||||
bail((char *)0);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (NHMessageBox(hWnd, TEXT("Save?"), MB_YESNOCANCEL | MB_ICONQUESTION)) {
|
switch(MessageBox(hWnd, TEXT("Save?"), TEXT("NetHack for Windows"), MB_YESNOCANCEL | MB_ICONQUESTION)) {
|
||||||
case IDYES: NHEVENT_KBD('y'); dosave(); break;
|
case IDYES: NHEVENT_KBD('y'); dosave(); break;
|
||||||
case IDNO: NHEVENT_KBD('q'); done(QUIT); break;
|
case IDNO: NHEVENT_KBD('q'); done(QUIT); break;
|
||||||
case IDCANCEL: break;
|
case IDCANCEL: break;
|
||||||
@@ -768,9 +761,9 @@ LRESULT onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
mswin_destroy_reg();
|
mswin_destroy_reg();
|
||||||
/* Notify the user that windows settings will not be saved this time. */
|
/* Notify the user that windows settings will not be saved this time. */
|
||||||
NHMessageBox(GetNHApp()->hMainWnd,
|
MessageBox(GetNHApp()->hMainWnd,
|
||||||
"Your Windows Settings will not be stored when you exit this time.",
|
"Your Windows Settings will not be stored when you exit this time.",
|
||||||
MB_OK | MB_ICONINFORMATION);
|
"NetHack", MB_OK | MB_ICONINFORMATION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,12 @@ extern HFONT extrainfo_splash_font;
|
|||||||
void mswin_display_splash_window (BOOL show_ver)
|
void mswin_display_splash_window (BOOL show_ver)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
int left, top;
|
RECT rt;
|
||||||
RECT splashrt;
|
RECT splashrt;
|
||||||
RECT clientrt;
|
RECT clientrt;
|
||||||
RECT controlrt;
|
RECT controlrt;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
int buttop;
|
int buttop;
|
||||||
HDC hDC;
|
|
||||||
|
|
||||||
hWnd = CreateDialog(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_SPLASH),
|
hWnd = CreateDialog(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_SPLASH),
|
||||||
GetNHApp()->hMainWnd, NHSplashWndProc);
|
GetNHApp()->hMainWnd, NHSplashWndProc);
|
||||||
@@ -58,12 +57,10 @@ void mswin_display_splash_window (BOOL show_ver)
|
|||||||
splashrt.right += SPLASH_WIDTH + SPLASH_OFFSET_X * 2 - clientrt.right;
|
splashrt.right += SPLASH_WIDTH + SPLASH_OFFSET_X * 2 - clientrt.right;
|
||||||
splashrt.bottom += SPLASH_HEIGHT + controlrt.bottom + SPLASH_OFFSET_Y * 3 - clientrt.bottom;
|
splashrt.bottom += SPLASH_HEIGHT + controlrt.bottom + SPLASH_OFFSET_Y * 3 - clientrt.bottom;
|
||||||
/* Place the window centered */
|
/* Place the window centered */
|
||||||
/* On the screen, not on the parent window */
|
GetWindowRect(GetNHApp()->hMainWnd, &rt);
|
||||||
hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
|
rt.left += (rt.right - rt.left - splashrt.right) / 2;
|
||||||
left = (GetDeviceCaps(hDC, HORZRES) - splashrt.right) / 2;
|
rt.top += (rt.bottom - rt.top - splashrt.bottom) / 2;
|
||||||
top = (GetDeviceCaps(hDC, VERTRES) - splashrt.bottom) / 2;
|
MoveWindow(hWnd, rt.left, rt.top, splashrt.right, splashrt.bottom, TRUE);
|
||||||
DeleteDC(hDC);
|
|
||||||
MoveWindow(hWnd, left, top, splashrt.right, splashrt.bottom, TRUE);
|
|
||||||
/* Place the OK control */
|
/* Place the OK control */
|
||||||
GetClientRect (hWnd, &clientrt);
|
GetClientRect (hWnd, &clientrt);
|
||||||
MoveWindow (GetDlgItem(hWnd, IDOK),
|
MoveWindow (GetDlgItem(hWnd, IDOK),
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "mhrip.h"
|
#include "mhrip.h"
|
||||||
#include "mhmain.h"
|
#include "mhmain.h"
|
||||||
#include "mhfont.h"
|
#include "mhfont.h"
|
||||||
#include "resource.h"
|
|
||||||
|
|
||||||
#define LLEN 128
|
#define LLEN 128
|
||||||
|
|
||||||
@@ -334,8 +333,8 @@ void prompt_for_player_selection(void)
|
|||||||
|
|
||||||
/* tty_putstr(BASE_WINDOW, 0, ""); */
|
/* tty_putstr(BASE_WINDOW, 0, ""); */
|
||||||
/* echoline = wins[BASE_WINDOW]->cury; */
|
/* echoline = wins[BASE_WINDOW]->cury; */
|
||||||
box_result = NHMessageBox(NULL, prompt,
|
box_result = MessageBox(NULL, prompt, TEXT("NetHack for Windows"),
|
||||||
MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON1);
|
MB_YESNOCANCEL | MB_DEFBUTTON1);
|
||||||
pick4u = (box_result == IDYES) ? 'y' : (box_result == IDNO) ? 'n' : '\033';
|
pick4u = (box_result == IDYES) ? 'y' : (box_result == IDNO) ? 'n' : '\033';
|
||||||
/* tty_putstr(BASE_WINDOW, 0, prompt); */
|
/* tty_putstr(BASE_WINDOW, 0, prompt); */
|
||||||
do {
|
do {
|
||||||
@@ -999,7 +998,7 @@ void mswin_display_file(const char *filename,BOOLEAN_P must_exist)
|
|||||||
if (must_exist) {
|
if (must_exist) {
|
||||||
TCHAR message[90];
|
TCHAR message[90];
|
||||||
_stprintf(message, TEXT("Warning! Could not find file: %s\n"), NH_A2W(filename, wbuf, sizeof(wbuf)));
|
_stprintf(message, TEXT("Warning! Could not find file: %s\n"), NH_A2W(filename, wbuf, sizeof(wbuf)));
|
||||||
NHMessageBox(GetNHApp()->hMainWnd, message, MB_OK | MB_ICONEXCLAMATION );
|
MessageBox(GetNHApp()->hMainWnd, message, TEXT("ERROR"), MB_OK | MB_ICONERROR );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
winid text;
|
winid text;
|
||||||
@@ -1276,8 +1275,7 @@ void mswin_raw_print(const char *str)
|
|||||||
TCHAR wbuf[255];
|
TCHAR wbuf[255];
|
||||||
logDebug("mswin_raw_print(%s)\n", str);
|
logDebug("mswin_raw_print(%s)\n", str);
|
||||||
if( str && *str )
|
if( str && *str )
|
||||||
NHMessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)),
|
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
|
||||||
MB_ICONINFORMATION | MB_OK );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1290,8 +1288,7 @@ void mswin_raw_print_bold(const char *str)
|
|||||||
TCHAR wbuf[255];
|
TCHAR wbuf[255];
|
||||||
logDebug("mswin_raw_print_bold(%s)\n", str);
|
logDebug("mswin_raw_print_bold(%s)\n", str);
|
||||||
if( str && *str )
|
if( str && *str )
|
||||||
NHMessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)),
|
MessageBox(GetNHApp()->hMainWnd, NH_A2W(str, wbuf, sizeof(wbuf)), TEXT("NetHack"), MB_OK );
|
||||||
MB_ICONINFORMATION | MB_OK );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1408,9 +1405,10 @@ char mswin_yn_function(const char *question, const char *choices,
|
|||||||
+ strlen(GetNHApp()->saved_text) + 1);
|
+ strlen(GetNHApp()->saved_text) + 1);
|
||||||
DWORD box_result;
|
DWORD box_result;
|
||||||
strcat(text, question);
|
strcat(text, question);
|
||||||
box_result = NHMessageBox(NULL,
|
box_result = MessageBox(NULL,
|
||||||
NH_W2A(text, message, sizeof(message)),
|
NH_W2A(text, message, sizeof(message)),
|
||||||
MB_YESNOCANCEL | MB_ICONQUESTION |
|
TEXT("NetHack for Windows"),
|
||||||
|
MB_YESNOCANCEL |
|
||||||
((def == 'y') ? MB_DEFBUTTON1 :
|
((def == 'y') ? MB_DEFBUTTON1 :
|
||||||
(def == 'n') ? MB_DEFBUTTON2 : MB_DEFBUTTON3));
|
(def == 'n') ? MB_DEFBUTTON2 : MB_DEFBUTTON3));
|
||||||
free(text);
|
free(text);
|
||||||
@@ -2402,15 +2400,6 @@ static void mswin_color_from_string(char *colorstring, HBRUSH* brushptr, COLORRE
|
|||||||
brush_table[max_brush++] = *brushptr;
|
brush_table[max_brush++] = *brushptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mswin_get_window_placement(int type, LPRECT rt)
|
void mswin_get_window_placement(int type, LPRECT rt)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#define IDS_HELLO 106
|
#define IDS_HELLO 106
|
||||||
#define IDI_NETHACKW 107
|
#define IDI_NETHACKW 107
|
||||||
#define IDC_NETHACKW 109
|
#define IDC_NETHACKW 109
|
||||||
#define IDS_APP_TITLE_SHORT 110
|
|
||||||
#define IDR_MAINFRAME 128
|
#define IDR_MAINFRAME 128
|
||||||
#define IDB_TILES 129
|
#define IDB_TILES 129
|
||||||
#define IDD_TEXT 130
|
#define IDD_TEXT 130
|
||||||
|
|||||||
@@ -164,8 +164,6 @@ void mswin_write_reg(void);
|
|||||||
void mswin_get_window_placement(int type, LPRECT rt);
|
void mswin_get_window_placement(int type, LPRECT rt);
|
||||||
void mswin_update_window_placement(int type, LPRECT rt);
|
void mswin_update_window_placement(int type, LPRECT rt);
|
||||||
|
|
||||||
int NHMessageBox(HWND hWnd, LPCTSTR text, UINT type);
|
|
||||||
|
|
||||||
extern HBRUSH menu_bg_brush;
|
extern HBRUSH menu_bg_brush;
|
||||||
extern HBRUSH menu_fg_brush;
|
extern HBRUSH menu_fg_brush;
|
||||||
extern HBRUSH text_bg_brush;
|
extern HBRUSH text_bg_brush;
|
||||||
|
|||||||
@@ -325,7 +325,6 @@ STRINGTABLE DISCARDABLE
|
|||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "NetHack for Windows - Graphical Interface"
|
IDS_APP_TITLE "NetHack for Windows - Graphical Interface"
|
||||||
IDC_NETHACKW "NETHACKW"
|
IDC_NETHACKW "NETHACKW"
|
||||||
IDS_APP_TITLE_SHORT "NetHack for Windows"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
#endif // English (U.S.) resources
|
||||||
|
|||||||
Reference in New Issue
Block a user