-
Notifications
You must be signed in to change notification settings - Fork 7
/
wdriver.h
190 lines (164 loc) · 6.32 KB
/
wdriver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
** Daedalus (Version 3.4) File: wdriver.h
** By Walter D. Pullen, [email protected], http://www.astrolog.org/labyrnth.htm
**
** IMPORTANT NOTICE: Daedalus and all Maze generation and general
** graphics routines used in this program are Copyright (C) 1998-2023 by
** Walter D. Pullen. Permission is granted to freely use, modify, and
** distribute these routines provided these credits and notices remain
** unmodified with any altered or distributed versions of the program.
** The user does have all rights to Mazes and other graphic output
** they make in Daedalus, like a novel created in a word processor.
**
** More formally: This program is free software; you can redistribute it
** and/or modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of the
** License, or (at your option) any later version. This program is
** distributed in the hope that it will be useful and inspiring, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details, a copy of which is in the
** LICENSE.HTM included with Daedalus, and at http://www.gnu.org
**
** This file contains Windows specific definitions for Daedalus as a whole.
**
** Created: 4/8/2013.
** Last code change: 8/29/2023.
*/
/*
******************************************************************************
** Macros
******************************************************************************
*/
#ifdef _WIN64
#define szArchCore "64 bit"
#else
#define szArchCore "32 bit"
#endif
#define nScrollDiv 16
#define API PASCAL
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x20B
#endif
#ifndef SC_MONITORPOWER
#define SC_MONITORPOWER 0xF170
#endif
#define SetWindowOrg(hdc, x, y) SetWindowOrgEx(hdc, x, y, NULL)
#define SetViewportOrg(hdc, x, y) SetViewportOrgEx(hdc, x, y, NULL)
#define MoveTo(hdc, x, y) MoveToEx(hdc, x, y, NULL)
#define InitDC(hdc) SetMapMode(hdc, MM_TEXT); \
SetWindowOrg(hdc, 0, 0); SetViewportOrg(hdc, 0, 0)
#define SetWindowPosition(xo, yo, xs, ys) SetWindowPos(wi.hwnd, \
ws.fWindowTop ? GetTopWindow(NULL) : HWND_NOTOPMOST, xo, yo, xs, ys, 0)
// Dialog Macros
#define CheckMenu(cmd, f) \
CheckMenuItem(wi.hmenu, cmd, f ? MF_CHECKED : MF_UNCHECKED);
#define SetCheck(id, f) CheckDlgButton(hdlg, id, f)
#define SetRadio(id, idLo, idHi) CheckRadioButton(hdlg, idLo, idHi, id)
#define SetEdit(id, sz) SetDlgItemText(hdlg, id, (LPCSTR)(sz))
#define SetEditN(id, n) SetDlgItemInt(hdlg, id, n, fTrue)
#define SetEditL(id, l) SetDlgItemLong(hdlg, id, l)
#define SetEditR(id, r) SetDlgItemReal(hdlg, id, r)
#define SetCombo(id, sz) \
SendDlgItemMessage(hdlg, id, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)(sz))
#define ClearCombo(id) SendDlgItemMessage(hdlg, id, CB_RESETCONTENT, 0, 0);
#define GetCheck(id) IsDlgButtonChecked(hdlg, id)
#define GetEdit(id, sz) GetEditCore(id, sz, cchSzDef)
#define GetEditCore(id, sz, cch) GetDlgItemText(hdlg, id, sz, cch)
#define GetEditN(id) GetDlgItemInt(hdlg, id, NULL, fTrue)
#define GetEditL(id) GetDlgItemLong(hdlg, id)
#define GetEditR(id) GetDlgItemReal(hdlg, id)
#define GetRadio(idLo, idHi) GetDlgItemRadio(hdlg, idLo, idHi)
#define EnsureBetweenN(n, n1, n2, szError) \
if (!FEnsureBetweenN(n, n1, n2, szError)) return fTrue;
#define EnsureBetweenR(r, n1, n2, szError) \
if (!FEnsureBetweenR(r, n1, n2, szError)) return fTrue;
#define EnsureLeastN(n, n1, szError) \
if (!FEnsureLeastN(n, n1, szError)) return fTrue;
/*
******************************************************************************
** Structures
******************************************************************************
*/
typedef struct _windowinternal {
// Window settings
HINSTANCE hinst;
HWND hwndMain;
HWND hwnd;
HWND hwndAbort;
HMENU hmenu;
HACCEL haccel;
// Internal settings
RECT rcFull;
HDC hdcInside;
HANDLE hMutex;
ulong timeSound;
// Bitmap fields
HDC hdcBmp;
HBITMAP hbmpPrev;
HBITMAP hbmp;
HBITMAP hbmpC;
HBITMAP hbmpI;
BITMAPINFOHEADER bi;
RGBQUAD rgbq[2];
BITMAPINFOHEADER biC;
BITMAPINFOHEADER biI;
} WI;
/*
******************************************************************************
** Externs
******************************************************************************
*/
// Global variables
extern WI wi;
extern OPENFILENAME ofn;
extern PRINTDLG prd;
// From wdriver.cpp
LRESULT PASCAL WndProc(HWND, uint, WPARAM, LPARAM);
void Redraw(HWND);
// From wutil.cpp
void CopyBitmapToDeviceBitmap(void);
void DirtyView(void);
void BitmapDot(int, int);
flag FBootExternal(CONST char *, flag);
void RedoMenu(HWND);
void GetWindowPosition(int *, int *, int *, int *);
void AdjustWindowPosition(int *, int *, int *, int *);
void DrawTextLine(HDC, CONST char *, int, int);
flag FCreateDesktopIcon(void);
flag FCreateProgramGroup(flag);
flag FRegisterExtensions(void);
flag FUnregisterExtensions(void);
// From wdialog.cpp
void DoDialog(flag API (HWND, uint, WORD, LONG), WORD);
flag FSzCopy(CONST char *);
flag FFileCopy(int);
flag FFilePaste();
flag DlgPrint(void);
flag API DlgAbortProc(HDC, int);
flag API DlgAbort(HWND, uint, WORD, LONG);
flag API DlgFile(HWND, uint, WORD, LONG);
flag API DlgAbout(HWND, uint, WORD, LONG);
flag API DlgCommand(HWND, uint, WORD, LONG);
flag API DlgEvent(HWND, uint, WORD, LONG);
flag API DlgDisplay(HWND, uint, WORD, LONG);
flag API DlgColor(HWND, uint, WORD, LONG);
flag API DlgRandom(HWND, uint, WORD, LONG);
flag API DlgDot(HWND, uint, WORD, LONG);
flag API DlgInside(HWND, uint, WORD, LONG);
flag API DlgSize(HWND, uint, WORD, LONG);
flag API DlgZoom(HWND, uint, WORD, LONG);
flag API DlgCubeFlip(HWND, uint, WORD, LONG);
flag API DlgBright(HWND, uint, WORD, LONG);
flag API DlgColorReplace(HWND, uint, WORD, LONG);
flag API DlgSizeMaze(HWND, uint, WORD, LONG);
flag API DlgBias(HWND, uint, WORD, LONG);
flag API DlgMaze(HWND, uint, WORD, LONG);
flag API DlgCreate(HWND, uint, WORD, LONG);
flag API DlgLabyrinth(HWND, uint, WORD, LONG);
flag API DlgDraw(HWND, uint, WORD, LONG);
flag API DlgDraw2(HWND, uint, WORD, LONG);
flag API DlgString(HWND, uint, WORD, LONG);
flag API DlgString2(HWND, uint, WORD, LONG);
flag API DlgString3(HWND, uint, WORD, LONG);
/* wdriver.h */