ref: ff3e762fd0078836243011ca91210f32ea7d1cbd
parent: 3ff4d64060b7cf5675bc8a49a1746b7d7c3b26b8
author: Simon Tatham <anakin@pobox.com>
date: Mon Mar 29 14:28:32 EDT 2021
Remove old Windows CE cruft. The WinCE version of these puzzles hasn't been built for years, and the last vestiges of its build system vanished with the migration to CMake. So this seems like a good moment to lose the rest of it. So the supporting Perl script wceinf.pl is deleted, and so is all the unused code under '#ifdef _WIN32_WCE' in windows.c. (I removed that using unifdef, which did a more reliable job than I would have done by hand!)
--- a/wceinf.pl
+++ /dev/null
@@ -1,65 +1,0 @@
-#!/usr/bin/perl
-
-# Perl script to generate a .INF file for building a Pocket PC .CAB
-# archive of Puzzles. This has to be scripted so that it can read
-# gamedesc.txt and automatically adjust to the current available
-# set of puzzles.
-
-# Usage:
-#
-# $ ./wceinf.pl gamedesc.txt > puzzles.inf
-
-$desc = shift @ARGV;
-open DESC, "<", $desc;
-while (<DESC>) {
- chomp;
- @_ = split /:/;
- push @exes, $_[1];
- $names{$_[1]} = $_[2];
-}
-close DESC;
-
-print '[Version]'."\n";
-print 'Signature = "$Windows NT$" ; required as-is'."\n";
-print 'Provider = "Simon Tatham" ; full app name will be "<Provider> <AppName>"'."\n";
-print 'CESignature = "$Windows CE$" ; required as-is'."\n";
-print ''."\n";
-print '[CEStrings]'."\n";
-print 'AppName = "Puzzle Collection" ; full app name will be "<Provider> <AppName>"'."\n";
-print 'InstallDir = %CE8%\%AppName% ; "\Program Files\Games\Puzzle Collection" (default install directory)'."\n";
-print ''."\n";
-print '[CEDevice.x86]'."\n";
-print 'ProcessorType = 686'."\n";
-print ''."\n";
-print '[CEDevice.ARM]'."\n";
-print 'ProcessorType = 2577'."\n";
-print ''."\n";
-print '[SourceDisksNames.x86] ; CPU-dependent files'."\n";
-print '2 = ,"x86 Files",,.'."\n";
-print ''."\n";
-print '[SourceDisksNames.ARMV4] ; CPU-dependent files'."\n";
-print '2 = ,"ARM Files",,.'."\n";
-print ''."\n";
-print '[SourceDisksFiles]'."\n";
-for $exe (@exes) {
- print $exe.' = 2'."\n";
-}
-print ''."\n";
-print '[DefaultInstall]'."\n";
-print 'CopyFiles = PuzzleFiles'."\n";
-print 'CEShortcuts = Links'."\n";
-print ''."\n";
-print '[DestinationDirs]'."\n";
-print 'PuzzleFiles = 0, %InstallDir%'."\n";
-print 'Links = 0, %CE14%\Puzzles'."\n";
-print ''."\n";
-print ';File copy list.'."\n";
-print '[PuzzleFiles]'."\n";
-for $exe (@exes) {
- print $exe."\n";
-}
-print ''."\n";
-print '[Links]'."\n";
-for $exe (@exes) {
- print '"'.$names{$exe}.'",0,'.$exe."\n";
-}
--- a/windows.c
+++ b/windows.c
@@ -8,11 +8,6 @@
#include <htmlhelp.h>
#endif /* NO_HTMLHELP */
-#ifdef _WIN32_WCE
-#include <commdlg.h>
-#include <aygshell.h>
-#endif
-
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
@@ -23,10 +18,6 @@
#include "puzzles.h"
-#ifdef _WIN32_WCE
-#include "resource.h"
-#endif
-
#define IDM_NEW 0x0010
#define IDM_RESTART 0x0020
#define IDM_UNDO 0x0030
@@ -77,50 +68,6 @@
#define CLASSNAME thegame.name
#endif
-#ifdef _WIN32_WCE
-
-/*
- * Wrapper implementations of functions not supplied by the
- * PocketPC API.
- */
-
-#define SHGetSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_GETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU)
-
-#undef MessageBox
-
-int MessageBox(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
-{
- TCHAR wText[2048];
- TCHAR wCaption[2048];
-
- MultiByteToWideChar (CP_ACP, 0, lpText, -1, wText, 2048);
- MultiByteToWideChar (CP_ACP, 0, lpCaption, -1, wCaption, 2048);
-
- return MessageBoxW (hWnd, wText, wCaption, uType);
-}
-
-BOOL SetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPCSTR lpString)
-{
- TCHAR wText[256];
-
- MultiByteToWideChar (CP_ACP, 0, lpString, -1, wText, 256);
- return SetDlgItemTextW(hDlg, nIDDlgItem, wText);
-}
-
-LPCSTR getenv(LPCSTR buf)
-{
- return NULL;
-}
-
-BOOL GetKeyboardState(PBYTE pb)
-{
- return false;
-}
-
-static TCHAR wClassName[256], wGameName[256];
-
-#endif
-
#ifdef DEBUGGING
static FILE *debug_fp = NULL;
static HANDLE debug_hdl = INVALID_HANDLE_VALUE;
@@ -168,12 +115,8 @@
}
#endif
-#ifndef _WIN32_WCE
#define WINFLAGS (WS_OVERLAPPEDWINDOW &~ \
(WS_MAXIMIZEBOX | WS_OVERLAPPED))
-#else
-#define WINFLAGS (WS_CAPTION | WS_SYSMENU)
-#endif
static void new_game_size(frontend *fe, float scale);
@@ -204,9 +147,6 @@
const game *game;
midend *me;
HWND hwnd, statusbar, cfgbox;
-#ifdef _WIN32_WCE
- HWND numpad; /* window handle for the numeric pad */
-#endif
HINSTANCE inst;
HBITMAP bitmap, prevbm;
RECT bitmapPosition; /* game bitmap position within game window */
@@ -308,19 +248,9 @@
static void win_status_bar(void *handle, const char *text)
{
-#ifdef _WIN32_WCE
- TCHAR wText[255];
-#endif
frontend *fe = (frontend *)handle;
-#ifdef _WIN32_WCE
- MultiByteToWideChar (CP_ACP, 0, text, -1, wText, 255);
- SendMessage(fe->statusbar, SB_SETTEXT,
- (WPARAM) 255 | SBT_NOBORDERS,
- (LPARAM) wText);
-#else
SetWindowText(fe->statusbar, text);
-#endif
}
static blitter *win_blitter_new(void *handle, int w, int h)
@@ -464,13 +394,6 @@
if (hatch < 0) {
br = CreateSolidBrush(RGB(r * 255, g * 255, b * 255));
} else {
-#ifdef _WIN32_WCE
- /*
- * This is only ever required during printing, and the
- * PocketPC port doesn't support printing.
- */
- fatal("CreateHatchBrush not supported");
-#else
br = CreateHatchBrush(hatch == HATCH_BACKSLASH ? HS_FDIAGONAL :
hatch == HATCH_SLASH ? HS_BDIAGONAL :
hatch == HATCH_HORIZ ? HS_HORIZONTAL :
@@ -478,7 +401,6 @@
hatch == HATCH_PLUS ? HS_CROSS :
/* hatch == HATCH_X ? */ HS_DIAGCROSS,
RGB(0,0,0));
-#endif
}
} else {
br = fe->brushes[colour];
@@ -602,9 +524,6 @@
lf.lfPitchAndFamily = (fonttype == FONT_FIXED ?
FIXED_PITCH | FF_DONTCARE :
VARIABLE_PITCH | FF_SWISS);
-#ifdef _WIN32_WCE
- wcscpy(lf.lfFaceName, TEXT("Tahoma"));
-#endif
fe->fonts[i].font = CreateFontIndirect(&lf);
}
@@ -754,9 +673,7 @@
fe->prevbm = SelectObject(fe->hdc, fe->bitmap);
ReleaseDC(fe->hwnd, hdc_win);
fe->clip = NULL;
-#ifndef _WIN32_WCE
SetMapMode(fe->hdc, MM_TEXT);
-#endif
fe->drawstatus = DRAWING;
}
@@ -999,7 +916,6 @@
void print(frontend *fe)
{
-#ifndef _WIN32_WCE
PRINTDLG pd;
char doctitle[256];
document *doc;
@@ -1090,7 +1006,6 @@
DeleteDC(pd.hDC);
document_free(doc);
-#endif
}
void deactivate_timer(frontend *fe)
@@ -1168,7 +1083,6 @@
*/
static void init_help(void)
{
-#ifndef _WIN32_WCE
char b[2048], *p, *q, *r;
FILE *fp;
@@ -1232,11 +1146,8 @@
}
help_type = NONE; /* didn't find any */
-#endif
}
-#ifndef _WIN32_WCE
-
/*
* Start Help.
*/
@@ -1306,8 +1217,6 @@
}
}
-#endif
-
/*
* Terminate Help on process exit.
*/
@@ -1338,10 +1247,8 @@
if (!fe->statusbar) return;
sy = get_statusbar_height(fe);
-#ifndef _WIN32_WCE
SetWindowPos(fe->statusbar, NULL, 0, r->bottom-r->top-sy, r->right-r->left,
sy, SWP_NOZORDER);
-#endif
}
static void get_menu_size(HWND wh, RECT *r)
@@ -1416,13 +1323,7 @@
cx = r.right - r.left;
cy = r.bottom - r.top;
- if (check_window_resize(fe, cx, cy, px, py, &wx, &wy)) {
-#ifdef _WIN32_WCE
- SetWindowPos(fe->hwnd, NULL, 0, 0, wx, wy,
- SWP_NOMOVE | SWP_NOZORDER);
-#endif
- ;
- }
+ check_window_resize(fe, cx, cy, px, py, &wx, &wy);
GetClientRect(fe->hwnd, &r);
adjust_statusbar(fe, &r);
@@ -1452,23 +1353,6 @@
}
}
-#ifdef _WIN32_WCE
-/* Toolbar buttons on the numeric pad */
-static TBBUTTON tbNumpadButtons[] =
-{
- {0, IDM_KEYEMUL + '1', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {1, IDM_KEYEMUL + '2', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {2, IDM_KEYEMUL + '3', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {3, IDM_KEYEMUL + '4', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {4, IDM_KEYEMUL + '5', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {5, IDM_KEYEMUL + '6', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {6, IDM_KEYEMUL + '7', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {7, IDM_KEYEMUL + '8', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {8, IDM_KEYEMUL + '9', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1},
- {9, IDM_KEYEMUL + ' ', TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, -1}
-};
-#endif
-
/*
* Allocate a new frontend structure and create its main window.
*/
@@ -1502,34 +1386,6 @@
fe->puzz_scale = 1.0;
- #ifdef _WIN32_WCE
- MultiByteToWideChar (CP_ACP, 0, nogame, -1, wGameName, 256);
- fe->hwnd = CreateWindowEx(0, wClassName, wGameName,
- WS_VISIBLE,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, inst, NULL);
-
- {
- SHMENUBARINFO mbi;
- RECT rc, rcBar, rcTB, rcClient;
-
- memset (&mbi, 0, sizeof(SHMENUBARINFO));
- mbi.cbSize = sizeof(SHMENUBARINFO);
- mbi.hwndParent = fe->hwnd;
- mbi.nToolBarId = IDR_MENUBAR1;
- mbi.hInstRes = inst;
-
- SHCreateMenuBar(&mbi);
-
- GetWindowRect(fe->hwnd, &rc);
- GetWindowRect(mbi.hwndMB, &rcBar);
- rc.bottom -= rcBar.bottom - rcBar.top;
- MoveWindow(fe->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, false);
-
- fe->numpad = NULL;
- }
-#else
fe->hwnd = CreateWindowEx(0, CLASSNAME, nogame,
WS_OVERLAPPEDWINDOW &~
(WS_MAXIMIZEBOX),
@@ -1540,7 +1396,6 @@
DWORD lerr = GetLastError();
printf("no window: 0x%x\n", (unsigned)lerr);
}
-#endif
fe->gamemenu = NULL;
fe->preset_menu = NULL;
@@ -1694,15 +1549,7 @@
* here.
*/
-#ifndef _WIN32_WCE
AppendMenu(winmenu, flags, id_or_sub, entry->title);
-#else
- {
- TCHAR wName[255];
- MultiByteToWideChar(CP_ACP, 0, entry->title, -1, wName, 255);
- AppendMenu(winmenu, flags, id_or_sub, wName);
- }
-#endif
}
}
@@ -1770,34 +1617,7 @@
r.bottom = y;
AdjustWindowRectEx(&r, WINFLAGS, true, 0);
-#ifdef _WIN32_WCE
- if (fe->numpad)
- DestroyWindow(fe->numpad);
- if (fe->game->flags & REQUIRE_NUMPAD)
- {
- fe->numpad = CreateToolbarEx (fe->hwnd,
- WS_VISIBLE | WS_CHILD | CCS_NOPARENTALIGN | TBSTYLE_FLAT,
- 0, 10, fe->inst, IDR_PADTOOLBAR,
- tbNumpadButtons, sizeof (tbNumpadButtons) / sizeof (TBBUTTON),
- 0, 0, 14, 15, sizeof (TBBUTTON));
- GetWindowRect(fe->numpad, &rcTB);
- GetClientRect(fe->hwnd, &rcClient);
- MoveWindow(fe->numpad,
- 0,
- rcClient.bottom - (rcTB.bottom - rcTB.top) - 1,
- rcClient.right,
- rcTB.bottom - rcTB.top,
- false);
- SendMessage(fe->numpad, TB_SETINDENT, (rcClient.right - (10 * 21)) / 2, 0);
- }
- else {
- fe->numpad = NULL;
- }
- MultiByteToWideChar (CP_ACP, 0, fe->game->name, -1, wGameName, 256);
- SetWindowText(fe->hwnd, wGameName);
-#else
SetWindowText(fe->hwnd, fe->game->name);
-#endif
if (fe->statusbar)
DestroyWindow(fe->statusbar);
@@ -1807,13 +1627,6 @@
WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, /* status bar does these */
fe->hwnd, NULL, fe->inst, NULL);
-#ifdef _WIN32_WCE
- /* Flat status bar looks better on the Pocket PC */
- SendMessage(fe->statusbar, SB_SIMPLE, (WPARAM) true, 0);
- SendMessage(fe->statusbar, SB_SETTEXT,
- (WPARAM) 255 | SBT_NOBORDERS,
- (LPARAM) L"");
-#endif
/*
* Now resize the window to take account of the status bar.
@@ -1820,11 +1633,9 @@
*/
GetWindowRect(fe->statusbar, &sr);
GetWindowRect(fe->hwnd, &r);
-#ifndef _WIN32_WCE
SetWindowPos(fe->hwnd, NULL, 0, 0, r.right - r.left,
r.bottom - r.top + sr.bottom - sr.top,
SWP_NOMOVE | SWP_NOZORDER);
-#endif
} else {
fe->statusbar = NULL;
}
@@ -1832,24 +1643,17 @@
{
HMENU oldmenu = GetMenu(fe->hwnd);
-#ifndef _WIN32_WCE
HMENU bar = CreateMenu();
HMENU menu = CreateMenu();
RECT menusize;
AppendMenu(bar, MF_ENABLED|MF_POPUP, (UINT)menu, "&Game");
-#else
- HMENU menu = SHGetSubMenu(SHFindMenuBar(fe->hwnd), ID_GAME);
- DeleteMenu(menu, 0, MF_BYPOSITION);
-#endif
fe->gamemenu = menu;
AppendMenu(menu, MF_ENABLED, IDM_NEW, TEXT("&New"));
AppendMenu(menu, MF_ENABLED, IDM_RESTART, TEXT("&Restart"));
-#ifndef _WIN32_WCE
/* ...here I run out of sensible accelerator characters. */
AppendMenu(menu, MF_ENABLED, IDM_DESC, TEXT("Speci&fic..."));
AppendMenu(menu, MF_ENABLED, IDM_SEED, TEXT("Rando&m Seed..."));
-#endif
assert(!fe->preset_menu);
@@ -1863,14 +1667,9 @@
fe->preset_menuitems[i].which_menu = NULL;
}
if (fe->preset_menu->n_entries > 0 || fe->game->can_configure) {
-#ifndef _WIN32_WCE
HMENU sub = CreateMenu();
AppendMenu(bar, MF_ENABLED|MF_POPUP, (UINT)sub, "&Type");
-#else
- HMENU sub = SHGetSubMenu(SHFindMenuBar(fe->hwnd), ID_TYPE);
- DeleteMenu(sub, 0, MF_BYPOSITION);
-#endif
populate_preset_menu(fe, fe->preset_menu, sub);
@@ -1884,9 +1683,6 @@
}
#ifdef COMBINED
-#ifdef _WIN32_WCE
-#error Windows CE does not support COMBINED build.
-#endif
{
HMENU games = CreateMenu();
int i;
@@ -1904,7 +1700,6 @@
#endif
AppendMenu(menu, MF_SEPARATOR, 0, 0);
-#ifndef _WIN32_WCE
AppendMenu(menu, MF_ENABLED, IDM_LOAD, TEXT("&Load..."));
AppendMenu(menu, MF_ENABLED, IDM_SAVE, TEXT("&Save..."));
AppendMenu(menu, MF_SEPARATOR, 0, 0);
@@ -1912,27 +1707,21 @@
AppendMenu(menu, MF_ENABLED, IDM_PRINT, TEXT("&Print..."));
AppendMenu(menu, MF_SEPARATOR, 0, 0);
}
-#endif
AppendMenu(menu, MF_ENABLED, IDM_UNDO, TEXT("Undo"));
AppendMenu(menu, MF_ENABLED, IDM_REDO, TEXT("Redo"));
-#ifndef _WIN32_WCE
if (fe->game->can_format_as_text_ever) {
AppendMenu(menu, MF_SEPARATOR, 0, 0);
AppendMenu(menu, MF_ENABLED, IDM_COPY, TEXT("&Copy"));
}
-#endif
if (fe->game->can_solve) {
AppendMenu(menu, MF_SEPARATOR, 0, 0);
AppendMenu(menu, MF_ENABLED, IDM_SOLVE, TEXT("Sol&ve"));
}
AppendMenu(menu, MF_SEPARATOR, 0, 0);
-#ifndef _WIN32_WCE
AppendMenu(menu, MF_ENABLED, IDM_QUIT, TEXT("E&xit"));
menu = CreateMenu();
AppendMenu(bar, MF_ENABLED|MF_POPUP, (UINT)menu, TEXT("&Help"));
-#endif
AppendMenu(menu, MF_ENABLED, IDM_ABOUT, TEXT("&About"));
-#ifndef _WIN32_WCE
if (help_type != NONE) {
char *item;
AppendMenu(menu, MF_SEPARATOR, 0, 0);
@@ -1947,7 +1736,6 @@
SetMenu(fe->hwnd, bar);
get_menu_size(fe->hwnd, &menusize);
fe->xmin = (menusize.right - menusize.left) + 25;
-#endif
}
if (fe->bitmap) DeleteObject(fe->bitmap);
@@ -1968,36 +1756,6 @@
midend_redraw(fe->me);
}
-#ifdef _WIN32_WCE
-static HFONT dialog_title_font()
-{
- static HFONT hf = NULL;
- LOGFONT lf;
-
- if (hf)
- return hf;
-
- memset (&lf, 0, sizeof(LOGFONT));
- lf.lfHeight = -11; /* - ((8 * GetDeviceCaps(hdc, LOGPIXELSY)) / 72) */
- lf.lfWeight = FW_BOLD;
- wcscpy(lf.lfFaceName, TEXT("Tahoma"));
-
- return hf = CreateFontIndirect(&lf);
-}
-
-static void make_dialog_full_screen(HWND hwnd)
-{
- SHINITDLGINFO shidi;
-
- /* Make dialog full screen */
- shidi.dwMask = SHIDIM_FLAGS;
- shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN |
- SHIDIF_EMPTYMENU;
- shidi.hDlg = hwnd;
- SHInitDialog(&shidi);
-}
-#endif
-
static int CALLBACK AboutDlgProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
@@ -2005,39 +1763,15 @@
switch (msg) {
case WM_INITDIALOG:
-#ifdef _WIN32_WCE
- {
- char title[256];
-
- make_dialog_full_screen(hwnd);
-
- sprintf(title, "About %.250s", fe->game->name);
- SetDlgItemTextA(hwnd, IDC_ABOUT_CAPTION, title);
-
- SendDlgItemMessage(hwnd, IDC_ABOUT_CAPTION, WM_SETFONT,
- (WPARAM) dialog_title_font(), 0);
-
- SetDlgItemTextA(hwnd, IDC_ABOUT_GAME, fe->game->name);
- SetDlgItemTextA(hwnd, IDC_ABOUT_VERSION, ver);
- }
-#endif
return 1;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
-#ifdef _WIN32_WCE
- EndDialog(hwnd, 1);
-#else
fe->dlg_done = 1;
-#endif
return 0;
case WM_CLOSE:
-#ifdef _WIN32_WCE
- EndDialog(hwnd, 1);
-#else
fe->dlg_done = 1;
-#endif
return 0;
}
@@ -2137,119 +1871,6 @@
}
}
-#ifdef _WIN32_WCE
-/* Separate version of mkctrl function for the Pocket PC. */
-/* Control coordinates should be specified in dialog units. */
-HWND mkctrl(frontend *fe, int x1, int x2, int y1, int y2,
- LPCTSTR wclass, int wstyle,
- int exstyle, const char *wtext, INT_PTR wid)
-{
- RECT rc;
- TCHAR wwtext[256];
-
- /* Convert dialog units into pixels */
- rc.left = x1; rc.right = x2;
- rc.top = y1; rc.bottom = y2;
- MapDialogRect(fe->cfgbox, &rc);
-
- MultiByteToWideChar (CP_ACP, 0, wtext, -1, wwtext, 256);
-
- return CreateWindowEx(exstyle, wclass, wwtext,
- wstyle | WS_CHILD | WS_VISIBLE,
- rc.left, rc.top,
- rc.right - rc.left, rc.bottom - rc.top,
- fe->cfgbox, (HMENU) wid, fe->inst, NULL);
-}
-
-static void create_config_controls(frontend * fe)
-{
- int id, nctrls;
- int col1l, col1r, col2l, col2r, y;
- config_item *i;
- struct cfg_aux *j;
- HWND ctl;
-
- /* Control placement done in dialog units */
- col1l = 4; col1r = 96; /* Label column */
- col2l = 100; col2r = 154; /* Input column (edit boxes and combo boxes) */
-
- /*
- * Count the controls so we can allocate cfgaux.
- */
- for (nctrls = 0, i = fe->cfg; i->type != C_END; i++)
- nctrls++;
- fe->cfgaux = snewn(nctrls, struct cfg_aux);
-
- id = 1000;
- y = 22; /* Leave some room for the dialog title */
- for (i = fe->cfg, j = fe->cfgaux; i->type != C_END; i++, j++) {
- switch (i->type) {
- case C_STRING:
- /*
- * Edit box with a label beside it.
- */
- mkctrl(fe, col1l, col1r, y + 1, y + 11,
- TEXT("Static"), SS_LEFTNOWORDWRAP, 0, i->name, id++);
- mkctrl(fe, col2l, col2r, y, y + 12,
- TEXT("EDIT"), WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL,
- 0, "", (j->ctlid = id++));
- SetDlgItemTextA(fe->cfgbox, j->ctlid, i->u.string.sval);
- break;
-
- case C_BOOLEAN:
- /*
- * Simple checkbox.
- */
- mkctrl(fe, col1l, col2r, y + 1, y + 11, TEXT("BUTTON"),
- BS_NOTIFY | BS_AUTOCHECKBOX | WS_TABSTOP,
- 0, i->name, (j->ctlid = id++));
- CheckDlgButton(fe->cfgbox, j->ctlid, (i->u.boolean.bval != 0));
- break;
-
- case C_CHOICES:
- /*
- * Drop-down list with a label beside it.
- */
- mkctrl(fe, col1l, col1r, y + 1, y + 11,
- TEXT("STATIC"), SS_LEFTNOWORDWRAP, 0, i->name, id++);
- ctl = mkctrl(fe, col2l, col2r, y, y + 48,
- TEXT("COMBOBOX"), WS_BORDER | WS_TABSTOP |
- CBS_DROPDOWNLIST | CBS_HASSTRINGS,
- 0, "", (j->ctlid = id++));
- {
- char c;
- const char *p, *q;
- char *str;
-
- p = i->u.choices.choicenames;
- c = *p++;
- while (*p) {
- q = p;
- while (*q && *q != c) q++;
- str = snewn(q-p+1, char);
- strncpy(str, p, q-p);
- str[q-p] = '\0';
- {
- TCHAR ws[50];
- MultiByteToWideChar (CP_ACP, 0, str, -1, ws, 50);
- SendMessage(ctl, CB_ADDSTRING, 0, (LPARAM)ws);
- }
-
- sfree(str);
- if (*q) q++;
- p = q;
- }
- }
- SendMessage(ctl, CB_SETCURSEL, i->u.choices.selected, 0);
- break;
- }
-
- y += 15;
- }
-
-}
-#endif
-
static int CALLBACK ConfigDlgProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
@@ -2259,25 +1880,6 @@
switch (msg) {
case WM_INITDIALOG:
-#ifdef _WIN32_WCE
- {
- char *title;
-
- fe = (frontend *) lParam;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
- fe->cfgbox = hwnd;
-
- fe->cfg = frontend_get_config(fe, fe->cfg_which, &title);
-
- make_dialog_full_screen(hwnd);
-
- SetDlgItemTextA(hwnd, IDC_CONFIG_CAPTION, title);
- SendDlgItemMessage(hwnd, IDC_CONFIG_CAPTION, WM_SETFONT,
- (WPARAM) dialog_title_font(), 0);
-
- create_config_controls(fe);
- }
-#endif
return 1;
case WM_COMMAND:
@@ -2293,18 +1895,10 @@
MessageBox(hwnd, err, "Validation error",
MB_ICONERROR | MB_OK);
} else {
-#ifdef _WIN32_WCE
- EndDialog(hwnd, 2);
-#else
fe->dlg_done = 2;
-#endif
}
} else {
-#ifdef _WIN32_WCE
- EndDialog(hwnd, 1);
-#else
fe->dlg_done = 1;
-#endif
}
return 0;
}
@@ -2321,13 +1915,7 @@
if (i->type == C_STRING && HIWORD(wParam) == EN_CHANGE) {
char buffer[4096];
-#ifdef _WIN32_WCE
- TCHAR wBuffer[4096];
- GetDlgItemText(fe->cfgbox, j->ctlid, wBuffer, 4096);
- WideCharToMultiByte(CP_ACP, 0, wBuffer, -1, buffer, 4096, NULL, NULL);
-#else
GetDlgItemText(fe->cfgbox, j->ctlid, buffer, lenof(buffer));
-#endif
buffer[lenof(buffer)-1] = '\0';
sfree(i->u.string.sval);
i->u.string.sval = dupstr(buffer);
@@ -2351,7 +1939,6 @@
return 0;
}
-#ifndef _WIN32_WCE
HWND mkctrl(frontend *fe, int x1, int x2, int y1, int y2,
char *wclass, int wstyle,
int exstyle, const char *wtext, INT_PTR wid)
@@ -2363,13 +1950,9 @@
SendMessage(ret, WM_SETFONT, (WPARAM)fe->cfgfont, MAKELPARAM(true, 0));
return ret;
}
-#endif
static void about(frontend *fe)
{
-#ifdef _WIN32_WCE
- DialogBox(fe->inst, MAKEINTRESOURCE(IDD_ABOUT), fe->hwnd, AboutDlgProc);
-#else
int i;
WNDCLASS wc;
MSG msg;
@@ -2518,19 +2101,10 @@
SetForegroundWindow(fe->hwnd);
DestroyWindow(fe->cfgbox);
DeleteObject(fe->cfgfont);
-#endif
}
static bool get_config(frontend *fe, int which)
{
-#ifdef _WIN32_WCE
- fe->cfg_which = which;
-
- return DialogBoxParam(fe->inst,
- MAKEINTRESOURCE(IDD_CONFIG),
- fe->hwnd, ConfigDlgProc,
- (LPARAM) fe) == 2;
-#else
config_item *i;
struct cfg_aux *j;
char *title;
@@ -2770,40 +2344,10 @@
sfree(fe->cfgaux);
return (fe->dlg_done == 2);
-#endif
}
-#ifdef _WIN32_WCE
static void calculate_bitmap_position(frontend *fe, int x, int y)
{
- /* Pocket PC - center the game in the full screen window */
- int yMargin;
- RECT rcClient;
-
- GetClientRect(fe->hwnd, &rcClient);
- fe->bitmapPosition.left = (rcClient.right - x) / 2;
- yMargin = rcClient.bottom - y;
-
- if (fe->numpad != NULL) {
- RECT rcPad;
- GetWindowRect(fe->numpad, &rcPad);
- yMargin -= rcPad.bottom - rcPad.top;
- }
-
- if (fe->statusbar != NULL) {
- RECT rcStatus;
- GetWindowRect(fe->statusbar, &rcStatus);
- yMargin -= rcStatus.bottom - rcStatus.top;
- }
-
- fe->bitmapPosition.top = yMargin / 2;
-
- fe->bitmapPosition.right = fe->bitmapPosition.left + x;
- fe->bitmapPosition.bottom = fe->bitmapPosition.top + y;
-}
-#else
-static void calculate_bitmap_position(frontend *fe, int x, int y)
-{
/* Plain Windows - position the game in the upper-left corner */
fe->bitmapPosition.left = 0;
fe->bitmapPosition.top = 0;
@@ -2810,7 +2354,6 @@
fe->bitmapPosition.right = fe->bitmapPosition.left + x;
fe->bitmapPosition.bottom = fe->bitmapPosition.top + y;
}
-#endif
static void new_bitmap(frontend *fe, int x, int y)
{
@@ -2849,26 +2392,19 @@
} else {
sr.left = sr.right = sr.top = sr.bottom = 0;
}
-#ifndef _WIN32_WCE
SetWindowPos(fe->hwnd, NULL, 0, 0,
r.right - r.left,
r.bottom - r.top + sr.bottom - sr.top,
SWP_NOMOVE | SWP_NOZORDER);
-#endif
check_window_size(fe, &x, &y);
-#ifndef _WIN32_WCE
if (fe->statusbar != NULL)
SetWindowPos(fe->statusbar, NULL, 0, y, x,
sr.bottom - sr.top, SWP_NOZORDER);
-#endif
new_bitmap(fe, x, y);
-#ifdef _WIN32_WCE
- InvalidateRect(fe->hwnd, NULL, true);
-#endif
midend_redraw(fe->me);
}
@@ -2990,13 +2526,6 @@
DestroyWindow(hwnd);
return 0;
case WM_COMMAND:
-#ifdef _WIN32_WCE
- /* Numeric pad sends WM_COMMAND messages */
- if ((wParam >= IDM_KEYEMUL) && (wParam < IDM_KEYEMUL + 256))
- {
- midend_process_key(fe->me, 0, 0, wParam - IDM_KEYEMUL);
- }
-#endif
cmd = wParam & ~0xF; /* low 4 bits reserved to Windows */
switch (cmd) {
case IDM_NEW:
@@ -3173,7 +2702,6 @@
}
break;
-#ifndef _WIN32_WCE
case IDM_HELPC:
start_help(fe, NULL);
break;
@@ -3182,7 +2710,6 @@
start_help(fe, help_type == CHM ?
fe->game->htmlhelp_topic : fe->game->winhelp_topic);
break;
-#endif
default:
#ifdef COMBINED
if (wParam >= IDM_GAMES && wParam < (IDM_GAMES + (WPARAM)gamecount)) {
@@ -3207,9 +2734,7 @@
}
break;
case WM_DESTROY:
-#ifndef _WIN32_WCE
stop_help(fe);
-#endif
frontend_free(fe);
PostQuitMessage(0);
return 0;
@@ -3223,9 +2748,6 @@
hdc = BeginPaint(hwnd, &p);
hdc2 = CreateCompatibleDC(hdc);
prevbm = SelectObject(hdc2, fe->bitmap);
-#ifdef _WIN32_WCE
- FillRect(hdc, &(p.rcPaint), (HBRUSH) GetStockObject(WHITE_BRUSH));
-#endif
IntersectRect(&rcDest, &(fe->bitmapPosition), &(p.rcPaint));
BitBlt(hdc,
rcDest.left, rcDest.top,
@@ -3338,28 +2860,8 @@
else if (message == WM_RBUTTONDOWN || is_alt_pressed())
button = RIGHT_BUTTON;
else
-#ifndef _WIN32_WCE
button = LEFT_BUTTON;
-#else
- if ((fe->game->flags & REQUIRE_RBUTTON) == 0)
- button = LEFT_BUTTON;
- else
- {
- SHRGINFO shrgi;
- shrgi.cbSize = sizeof(SHRGINFO);
- shrgi.hwndClient = hwnd;
- shrgi.ptDown.x = (signed short)LOWORD(lParam);
- shrgi.ptDown.y = (signed short)HIWORD(lParam);
- shrgi.dwFlags = SHRG_RETURNCMD;
-
- if (GN_CONTEXTMENU == SHRecognizeGesture(&shrgi))
- button = RIGHT_BUTTON;
- else
- button = LEFT_BUTTON;
- }
-#endif
-
if (!midend_process_key(fe->me,
(signed short)LOWORD(lParam) - fe->bitmapPosition.left,
(signed short)HIWORD(lParam) - fe->bitmapPosition.top,
@@ -3436,7 +2938,6 @@
fe->timer_last_tickcount = now;
}
return 0;
-#ifndef _WIN32_WCE
case WM_SIZING:
{
RECT *sr = (RECT *)lParam;
@@ -3468,29 +2969,11 @@
return true;
}
break;
-#endif
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
-#ifdef _WIN32_WCE
-static int FindPreviousInstance()
-{
- /* Check if application is running. If it's running then focus on the window */
- HWND hOtherWnd = NULL;
-
- hOtherWnd = FindWindow (wGameName, wGameName);
- if (hOtherWnd)
- {
- SetForegroundWindow (hOtherWnd);
- return true;
- }
-
- return false;
-}
-#endif
-
/*
* Split a complete command line into argc/argv, attempting to do it
* exactly the same way the Visual Studio C library would do it (so
@@ -3723,12 +3206,6 @@
split_into_argv(cmdline, &argc, &argv, NULL);
-#ifdef _WIN32_WCE
- MultiByteToWideChar (CP_ACP, 0, CLASSNAME, -1, wClassName, 256);
- if (FindPreviousInstance ())
- return 0;
-#endif
-
InitCommonControls();
if (!prev) {
@@ -3740,18 +3217,12 @@
wndclass.cbWndExtra = 0;
wndclass.hInstance = inst;
wndclass.hIcon = LoadIcon(inst, MAKEINTRESOURCE(200));
-#ifndef _WIN32_WCE
if (!wndclass.hIcon) /* in case resource file is absent */
wndclass.hIcon = LoadIcon(inst, IDI_APPLICATION);
-#endif
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL;
-#ifdef _WIN32_WCE
- wndclass.lpszClassName = wClassName;
-#else
wndclass.lpszClassName = CLASSNAME;
-#endif
RegisterClass(&wndclass);
}