~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweak the cropping of the Filling icon very slightly.
[sgt/puzzles]
/
windows.c
diff --git
a/windows.c
b/windows.c
index
d282d72
..
82767e4
100644
(file)
--- a/
windows.c
+++ b/
windows.c
@@
-4,7
+4,9
@@
#include <windows.h>
#include <commctrl.h>
#include <windows.h>
#include <commctrl.h>
+#ifndef NO_HTMLHELP
#include <htmlhelp.h>
#include <htmlhelp.h>
+#endif /* NO_HTMLHELP */
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <assert.h>
@@
-36,12
+38,15
@@
#define HELP_FILE_NAME "puzzles.hlp"
#define HELP_CNT_NAME "puzzles.cnt"
#define HELP_FILE_NAME "puzzles.hlp"
#define HELP_CNT_NAME "puzzles.cnt"
+#ifndef NO_HTMLHELP
#define CHM_FILE_NAME "puzzles.chm"
#define CHM_FILE_NAME "puzzles.chm"
+#endif /* NO_HTMLHELP */
+#ifndef NO_HTMLHELP
typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD);
typedef HWND (CALLBACK *htmlhelp_t)(HWND, LPCSTR, UINT, DWORD);
-static DWORD html_help_cookie;
static htmlhelp_t htmlhelp;
static HINSTANCE hh_dll;
static htmlhelp_t htmlhelp;
static HINSTANCE hh_dll;
+#endif /* NO_HTMLHELP */
enum { NONE, HLP, CHM } help_type;
char *help_path;
const char *help_topic;
enum { NONE, HLP, CHM } help_type;
char *help_path;
const char *help_topic;
@@
-79,7
+84,7
@@
void debug_printf(char *fmt, ...)
va_list ap;
va_start(ap, fmt);
va_list ap;
va_start(ap, fmt);
-
vsprintf(buf
, fmt, ap);
+
_vsnprintf(buf, 4095
, fmt, ap);
dputs(buf);
va_end(ap);
}
dputs(buf);
va_end(ap);
}
@@
-1009,6
+1014,7
@@
static void init_help(void)
q = strrchr(b, ':');
if (q && q >= r) r = q+1;
q = strrchr(b, ':');
if (q && q >= r) r = q+1;
+#ifndef NO_HTMLHELP
/*
* Try HTML Help first.
*/
/*
* Try HTML Help first.
*/
@@
-1026,13
+1032,13
@@
static void init_help(void)
FreeLibrary(hh_dll);
}
if (htmlhelp) {
FreeLibrary(hh_dll);
}
if (htmlhelp) {
- htmlhelp(NULL, NULL, HH_INITIALIZE, (DWORD)&html_help_cookie);
help_path = dupstr(b);
help_type = CHM;
help_topic = thegame.htmlhelp_topic;
return;
}
}
help_path = dupstr(b);
help_type = CHM;
help_topic = thegame.htmlhelp_topic;
return;
}
}
+#endif /* NO_HTMLHELP */
/*
* Now try old-style .HLP.
/*
* Now try old-style .HLP.
@@
-1086,6
+1092,7
@@
static void start_help(frontend *fe, const char *topic)
fe->help_running = TRUE;
break;
case CHM:
fe->help_running = TRUE;
break;
case CHM:
+#ifndef NO_HTMLHELP
assert(help_path);
assert(htmlhelp);
if (topic) {
assert(help_path);
assert(htmlhelp);
if (topic) {
@@
-1097,6
+1104,7
@@
static void start_help(frontend *fe, const char *topic)
htmlhelp(fe->hwnd, str, HH_DISPLAY_TOPIC, 0);
fe->help_running = TRUE;
break;
htmlhelp(fe->hwnd, str, HH_DISPLAY_TOPIC, 0);
fe->help_running = TRUE;
break;
+#endif /* NO_HTMLHELP */
case NONE:
assert(!"This shouldn't happen");
break;
case NONE:
assert(!"This shouldn't happen");
break;
@@
-1116,9
+1124,11
@@
static void stop_help(frontend *fe)
WinHelp(fe->hwnd, help_path, HELP_QUIT, 0);
break;
case CHM:
WinHelp(fe->hwnd, help_path, HELP_QUIT, 0);
break;
case CHM:
+#ifndef NO_HTMLHELP
assert(htmlhelp);
htmlhelp(NULL, NULL, HH_CLOSE_ALL, 0);
break;
assert(htmlhelp);
htmlhelp(NULL, NULL, HH_CLOSE_ALL, 0);
break;
+#endif /* NO_HTMLHELP */
case NONE:
assert(!"This shouldn't happen");
break;
case NONE:
assert(!"This shouldn't happen");
break;
@@
-1132,10
+1142,9
@@
static void stop_help(frontend *fe)
*/
static void cleanup_help(void)
{
*/
static void cleanup_help(void)
{
- if (help_type == CHM) {
- assert(htmlhelp);
- htmlhelp(NULL, NULL, HH_UNINITIALIZE, html_help_cookie);
- }
+ /* Nothing to do currently.
+ * (If we were running HTML Help single-threaded, this is where we'd
+ * call HH_UNINITIALIZE.) */
}
static void check_window_size(frontend *fe, int *px, int *py)
}
static void check_window_size(frontend *fe, int *px, int *py)
@@
-1341,11
+1350,11
@@
static frontend *new_window(HINSTANCE inst, char *game_id, char **error)
}
AppendMenu(menu, MF_SEPARATOR, 0, 0);
}
AppendMenu(menu, MF_SEPARATOR, 0, 0);
- AppendMenu(menu, MF_ENABLED, IDM_LOAD, "Load");
- AppendMenu(menu, MF_ENABLED, IDM_SAVE, "Save");
+ AppendMenu(menu, MF_ENABLED, IDM_LOAD, "Load
...
");
+ AppendMenu(menu, MF_ENABLED, IDM_SAVE, "Save
...
");
AppendMenu(menu, MF_SEPARATOR, 0, 0);
if (thegame.can_print) {
AppendMenu(menu, MF_SEPARATOR, 0, 0);
if (thegame.can_print) {
- AppendMenu(menu, MF_ENABLED, IDM_PRINT, "Print");
+ AppendMenu(menu, MF_ENABLED, IDM_PRINT, "Print
...
");
AppendMenu(menu, MF_SEPARATOR, 0, 0);
}
AppendMenu(menu, MF_ENABLED, IDM_UNDO, "Undo");
AppendMenu(menu, MF_SEPARATOR, 0, 0);
}
AppendMenu(menu, MF_ENABLED, IDM_UNDO, "Undo");