diff options
author | Bernie Innocenti <bernie@codewiz.org> | 2010-05-03 21:53:47 (GMT) |
---|---|---|
committer | Bernie Innocenti <bernie@codewiz.org> | 2010-05-03 21:53:47 (GMT) |
commit | 1030dc837b10a03a02a85d5504cbeec168ce49e2 (patch) | |
tree | 698eefa87ac437deaf36a4141b326f8ce7986692 /src/ui/ui-drv/win32 |
Import XaoS r489 (trunk after version 3.5)
Diffstat (limited to 'src/ui/ui-drv/win32')
-rw-r--r-- | src/ui/ui-drv/win32/Makefile.in | 43 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/about.c | 239 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/about.h | 20 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/about.rc | 19 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/dxguid.c | 1102 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/installer/XaoS Installer.nsi | 138 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/installer/XaoS.bmp | bin | 0 -> 25818 bytes | |||
-rw-r--r-- | src/ui/ui-drv/win32/resource.h | 3 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/small.ico | bin | 0 -> 2294 bytes | |||
-rw-r--r-- | src/ui/ui-drv/win32/ui_win32.c | 1886 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/ui_win32.h | 20 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/version.rc | 39 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/windialo.c | 471 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/winmenu.c | 243 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/xaos.dlg | 228 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/xaos.exe.manifest | 10 | ||||
-rw-r--r-- | src/ui/ui-drv/win32/xaos.ico | bin | 0 -> 135286 bytes | |||
-rw-r--r-- | src/ui/ui-drv/win32/xaos.rc | 16 |
18 files changed, 4477 insertions, 0 deletions
diff --git a/src/ui/ui-drv/win32/Makefile.in b/src/ui/ui-drv/win32/Makefile.in new file mode 100644 index 0000000..f2cd8a0 --- /dev/null +++ b/src/ui/ui-drv/win32/Makefile.in @@ -0,0 +1,43 @@ +CC = @CC@
+CFLAGS = @CFLAGS@
+LIBS = @LIBS@ -lm
+LFLAGS = @LDFLAGS@
+AR = @AR@
+RANLIB = @RANLIB@
+
+SRCS = ui_win32.c dxguid.c winmenu.c windialo.c about.c
+
+OBJS = $(SRCS:.c=.o) #xaos.res
+
+TLIB = @LIBPATH@/libuiwin32.a
+
+
+all: ui_win32.o xaos.res $(TLIB)
+
+$(TLIB):$(OBJS)
+ rm -f $@
+ $(AR) rc $@ $(OBJS)
+ $(RANLIB) $@
+
+clean:
+ rm -f $(TLIB)
+ rm -f *.[oas]
+ rm -f *~
+ rm -f core
+ rm -f xaos.res
+
+xaos.res: xaos.rc resource.h xaos.dlg
+ windres xaos.rc -O coff -o $@
+
+distclean:clean
+ rm Makefile
+
+#dep:
+# rm -f .depend
+# make .depend
+#
+#.depend:
+# echo '# Program dependencies' >.depend
+# gcc -I svgalib $(DEFINES) -MM $(patsubst %.o,%.c,$(OBJS)) >>.depend
+#
+#include .depend
diff --git a/src/ui/ui-drv/win32/about.c b/src/ui/ui-drv/win32/about.c new file mode 100644 index 0000000..22b040d --- /dev/null +++ b/src/ui/ui-drv/win32/about.c @@ -0,0 +1,239 @@ +#include <windows.h> +#include "fconfig.h" +#include "xerror.h" +#include "ui_win32.h" +#include "about.h" +void CenterWindow(HWND hwndChild, HWND hwndParent) +{ + RECT rChild, rParent, rWorkArea; + int wChild, hChild, wParent, hParent; + int xNew, yNew; + BOOL bResult; + + GetWindowRect(hwndChild, &rChild); + wChild = rChild.right - rChild.left; + hChild = rChild.bottom - rChild.top; + + GetWindowRect(hwndParent, &rParent); + wParent = rParent.right - rParent.left; + hParent = rParent.bottom - rParent.top; + + bResult = SystemParametersInfo(SPI_GETWORKAREA, // system parameter to query or set + sizeof(RECT), &rWorkArea, 0); + if (!bResult) { + rWorkArea.left = rWorkArea.top = 0; + rWorkArea.right = GetSystemMetrics(SM_CXSCREEN); + rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN); + } + + xNew = rParent.left + ((wParent - wChild) / 2); + if (xNew < rWorkArea.left) { + xNew = rWorkArea.left; + } else if ((xNew + wChild) > rWorkArea.right) { + xNew = rWorkArea.right - wChild; + } + + yNew = rParent.top + ((hParent - hChild) / 2); + if (yNew < rWorkArea.top) { + yNew = rWorkArea.top; + } else if ((yNew + hChild) > rWorkArea.bottom) { + yNew = rWorkArea.bottom - hChild; + } + + SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0, + SWP_NOSIZE | SWP_NOZORDER); + return; +} + + +static LPTSTR GetStringRes(int id) +{ + static TCHAR buffer[MAX_PATH]; + + buffer[0] = 0; + LoadString(GetModuleHandle(NULL), id, buffer, MAX_PATH); + return buffer; +} + +static LRESULT CALLBACK +About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + static HFONT hfontDlg; // Font for dialog text + static HFONT hFinePrint; // Font for 'fine print' in dialog + DWORD dwVerInfoSize; // Size of version information block + LPSTR lpVersion; // String pointer to 'version' text + DWORD dwVerHnd = 0; // An 'ignored' parameter, always '0' + UINT uVersionLen; + WORD wRootLen; + BOOL bRetCode; + int i; + char szFullPath[256]; + char szResult[256]; + char szGetName[256]; + DWORD dwVersion; + char szVersion[40]; + DWORD dwResult; + + switch (message) { + case WM_INITDIALOG: + ShowWindow(hDlg, SW_HIDE); + + if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE) { + hfontDlg = + CreateFont(14, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, + 0, VARIABLE_PITCH | FF_DONTCARE, ""); + hFinePrint = + CreateFont(11, 0, 0, 0, 0, 0, 0, 0, SHIFTJIS_CHARSET, 0, 0, + 0, VARIABLE_PITCH | FF_DONTCARE, ""); + } else { + hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + VARIABLE_PITCH | FF_SWISS, ""); + hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + VARIABLE_PITCH | FF_SWISS, ""); + } + + CenterWindow(hDlg, GetWindow(hDlg, GW_OWNER)); + GetModuleFileName(hInstance, szFullPath, sizeof(szFullPath)); +#if 0 + // Now lets dive in and pull out the version information: + dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd); + if (dwVerInfoSize) { + LPSTR lpstrVffInfo; + HANDLE hMem; + hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize); + lpstrVffInfo = GlobalLock(hMem); + GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, + lpstrVffInfo); + // The below 'hex' value looks a little confusing, but + // essentially what it is, is the hexidecimal representation + // of a couple different values that represent the language + // and character set that we are wanting string values for. + // 040904E4 is a very common one, because it means: + // US English, Windows MultiLingual characterset + // Or to pull it all apart: + // 04------ = SUBLANG_ENGLISH_USA + // --09---- = LANG_ENGLISH + // --11---- = LANG_JAPANESE + // ----04E4 = 1252 = Codepage for Windows:Multilingual + + lstrcpy(szGetName, GetStringRes(IDS_VER_INFO_LANG)); + + wRootLen = (WORD) lstrlen(szGetName); // Save this position + + // Set the title of the dialog: + lstrcat(szGetName, "ProductName"); + bRetCode = VerQueryValue((LPVOID) lpstrVffInfo, + (LPSTR) szGetName, + (LPVOID) & lpVersion, + (UINT *) & uVersionLen); + + // Notice order of version and string... + if (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE) { + lstrcpy(szResult, lpVersion); + lstrcat(szResult, " のバージョン情報"); + } else { + lstrcpy(szResult, "About "); + lstrcat(szResult, lpVersion); + } + + // ----------------------------------------------------- + + SetWindowText(hDlg, szResult); + + // Walk through the dialog items that we want to replace: + for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) { + GetDlgItemText(hDlg, i, szResult, sizeof(szResult)); + szGetName[wRootLen] = (char) 0; + lstrcat(szGetName, szResult); + uVersionLen = 0; + lpVersion = NULL; + x_message("lpstrVffInfo %s", lpstrVffInfo); + bRetCode = VerQueryValue((LPVOID) lpstrVffInfo, + (LPSTR) szGetName, + (LPVOID) & lpVersion, + (UINT *) & uVersionLen); + + if (bRetCode && uVersionLen && lpVersion) { + // Replace dialog item text with version info + lstrcpy(szResult, lpVersion); + SetDlgItemText(hDlg, i, szResult); + } else { + dwResult = GetLastError(); + + wsprintf(szResult, GetStringRes(IDS_VERSION_ERROR), + dwResult); + SetDlgItemText(hDlg, i, szResult); + } + SendMessage(GetDlgItem(hDlg, i), WM_SETFONT, + /* (ULONG_PTR) */ + (unsigned long *) ((i == DLG_VERLAST) ? + hFinePrint : hfontDlg), + TRUE); + } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) + + + GlobalUnlock(hMem); + GlobalFree(hMem); + } else { + // No version information available. + } // if (dwVerInfoSize) +#endif + for (i = DLG_VERFIRST; i <= IDC_LICENSE; i++) { + SendMessage(GetDlgItem(hDlg, i), WM_SETFONT, + /* (ULONG_PTR) */ + (unsigned long *) ((i == DLG_VERLAST) ? hFinePrint + : hfontDlg), TRUE); + } // for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) + + SendMessage(GetDlgItem(hDlg, IDC_LABEL), WM_SETFONT, + (WPARAM) hfontDlg, (LPARAM) TRUE); + + // We are using GetVersion rather then GetVersionEx + // because earlier versions of Windows NT and Win32s + // didn't include GetVersionEx: + dwVersion = GetVersion(); + + if (dwVersion < 0x80000000) { + // Windows NT + wsprintf(szVersion, "Microsoft Windows NT %u.%u (Build: %u)", + (DWORD) (LOBYTE(LOWORD(dwVersion))), + (DWORD) (HIBYTE(LOWORD(dwVersion))), + (DWORD) (HIWORD(dwVersion))); + } else if (LOBYTE(LOWORD(dwVersion)) < 4) { + // Win32s + wsprintf(szVersion, "Microsoft Win32s %u.%u (Build: %u)", + (DWORD) (LOBYTE(LOWORD(dwVersion))), + (DWORD) (HIBYTE(LOWORD(dwVersion))), + (DWORD) (HIWORD(dwVersion) & ~0x8000)); + } else { + // Windows 95 + wsprintf(szVersion, "Microsoft Windows 95 %u.%u", + (DWORD) (LOBYTE(LOWORD(dwVersion))), + (DWORD) (HIBYTE(LOWORD(dwVersion)))); + } + + SetWindowText(GetDlgItem(hDlg, IDC_OSVERSION), szVersion); + ShowWindow(hDlg, SW_SHOW); + return (TRUE); + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, TRUE); + DeleteObject(hfontDlg); + DeleteObject(hFinePrint); + return (TRUE); + } + break; + } + + return FALSE; +} + +void AboutBox(void) +{ +#ifdef DDRAW_DRIVER + if (directX == 1) + return; +#endif + DialogBox(hInstance, "AboutBox", hWnd, (DLGPROC) About); +} diff --git a/src/ui/ui-drv/win32/about.h b/src/ui/ui-drv/win32/about.h new file mode 100644 index 0000000..f42c873 --- /dev/null +++ b/src/ui/ui-drv/win32/about.h @@ -0,0 +1,20 @@ +#define IDC_STATIC -1 + +#define DLG_VERFIRST 400 +#define IDC_COMPANY DLG_VERFIRST +#define IDC_FILEDESC DLG_VERFIRST+1 +#define IDC_PRODVER DLG_VERFIRST+2 +#define IDC_COPYRIGHT DLG_VERFIRST+3 +#define IDC_OSVERSION DLG_VERFIRST+4 +#define IDC_TRADEMARK DLG_VERFIRST+5 +#define DLG_VERLAST DLG_VERFIRST+5 +#define IDC_LICENSE DLG_VERFIRST+6 + +#define IDC_LABEL IDC_LICENSE+1 + + +#define IDS_APP_TITLE 500 +#define IDS_DISPLAYCHANGED 501 +#define IDS_VER_INFO_LANG 502 +#define IDS_VERSION_ERROR 503 +#define IDS_NO_HELP 504 diff --git a/src/ui/ui-drv/win32/about.rc b/src/ui/ui-drv/win32/about.rc new file mode 100644 index 0000000..cb5d3a4 --- /dev/null +++ b/src/ui/ui-drv/win32/about.rc @@ -0,0 +1,19 @@ +ABOUTBOX DIALOG DISCARDABLE 22, 17, 197, 74+4*18
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,162,2,32,14,WS_GROUP
+ ICON "BIG",IDC_STATIC,3,2,18,20
+ LTEXT "Free Sofware Foundation",IDC_COMPANY,30,2,130,8
+ LTEXT "XaoS - a realtime fractal zoomer",IDC_FILEDESC,30,10,121,8
+ RTEXT "3.5",IDC_PRODVER,136,10,17,8
+ LTEXT "Copyright 1996-2008 Jan Hubicka, Thomas Marsh and others",IDC_COPYRIGHT,30,18,167,8
+ LTEXT "OSVERSION",IDC_OSVERSION,46,34,138,8
+ LTEXT "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. \n\nThis program is distributed in the hope that it will be useful, 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. \n\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.",IDC_LICENSE,3,49,192,5*18
+ LTEXT "Crashing on:",IDC_LABEL,4,34,40,8
+ CONTROL "",IDC_STATIC,"Static",SS_BLACKRECT,2,31,194,1
+ CONTROL "",IDC_STATIC,"Static",SS_BLACKRECT,2,44,194,1
+END
+
+
diff --git a/src/ui/ui-drv/win32/dxguid.c b/src/ui/ui-drv/win32/dxguid.c new file mode 100644 index 0000000..5c6a2ae --- /dev/null +++ b/src/ui/ui-drv/win32/dxguid.c @@ -0,0 +1,1102 @@ +#include <aconfig.h> +#ifdef DDRAW_DRIVER +#include <ddraw.h> +#include <dinput.h> + +/* This is a replacement for microsofts dxguid.lib and parts of dinput.lib. */ + +#undef DEFINE_GUID +#define DEFINE_GUID(n,a,b,c,d,e,f,g,h,i,j,k) const GUID n = {a,b,c,{d,e,f,g,h,i,j,k}} + +/* DirectDraw */ +DEFINE_GUID(CLSID_DirectDraw, 0xD7B70EE0, 0x4340, 0x11CF, 0xB0, 0x63, 0x00, + 0x20, 0xAF, 0xC2, 0xCD, 0x35); +DEFINE_GUID(CLSID_DirectDrawClipper, 0x593817A0, 0x7DB3, 0x11CF, 0xA2, + 0xDE, 0x00, 0xAA, 0x00, 0xb9, 0x33, 0x56); +DEFINE_GUID(IID_IDirectDraw, 0x6C14DB80, 0xA733, 0x11CE, 0xA5, 0x21, 0x00, + 0x20, 0xAF, 0x0B, 0xE5, 0x60); +DEFINE_GUID(IID_IDirectDraw2, 0xB3A6F3E0, 0x2B43, 0x11CF, 0xA2, 0xDE, 0x00, + 0xAA, 0x00, 0xB9, 0x33, 0x56); +DEFINE_GUID(IID_IDirectDrawSurface, 0x6C14DB81, 0xA733, 0x11CE, 0xA5, 0x21, + 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); +DEFINE_GUID(IID_IDirectDrawSurface2, 0x57805885, 0x6eec, 0x11cf, 0x94, + 0x41, 0xa8, 0x23, 0x03, 0xc1, 0x0e, 0x27); +DEFINE_GUID(IID_IDirectDrawSurface3, 0xDA044E00, 0x69B2, 0x11D0, 0xA1, + 0xD5, 0x00, 0xAA, 0x00, 0xB8, 0xDF, 0xBB); + +DEFINE_GUID(IID_IDirectDrawPalette, 0x6C14DB84, 0xA733, 0x11CE, 0xA5, 0x21, + 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); +DEFINE_GUID(IID_IDirectDrawClipper, 0x6C14DB85, 0xA733, 0x11CE, 0xA5, 0x21, + 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); +DEFINE_GUID(IID_IDirectDrawColorControl, 0x4B9F0EE0, 0x0D7E, 0x11D0, 0x9B, + 0x06, 0x00, 0xA0, 0xC9, 0x03, 0xA3, 0xB8); + +DEFINE_GUID(IID_IDirectInputA, 0x89521360, 0xAA8A, 0x11CF, 0xBF, 0xC7, + 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361, 0xAA8A, 0x11CF, 0xBF, 0xC7, + 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662, 0xAA8A, 0x11CF, 0xBF, 0xC7, + 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663, 0xAA8A, 0x11CF, 0xBF, 0xC7, + 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); + +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680, 0xC92E, 0x11CF, 0xBF, + 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681, 0xC92E, 0x11CF, 0xBF, + 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInputDevice2A, 0x5944E682, 0xC92E, 0x11CF, 0xBF, + 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInputDevice2W, 0x5944E683, 0xC92E, 0x11CF, 0xBF, + 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0, 0x88D2, 0x11D0, 0x9A, 0xD0, + 0x00, 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_XAxis, 0xA36D02E0, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, + 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, + 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, + 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_RxAxis, 0xA36D02F4, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_RyAxis, 0xA36D02F5, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_RzAxis, 0xA36D02E3, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_Slider, 0xA36D02E4, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); + +DEFINE_GUID(GUID_Button, 0xA36D02F0, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_Key, 0x55728220, 0xD33C, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, + 0x53, 0x54, 0x00, 0x00); + +DEFINE_GUID(GUID_POV, 0xA36D02F2, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, 0x45, + 0x53, 0x54, 0x00, 0x00); + +DEFINE_GUID(GUID_Unknown, 0xA36D02F3, 0xC9F3, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60, 0xD5A0, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_SysKeyboard, 0x6F1D2B61, 0xD5A0, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_Joystick, 0x6F1D2B70, 0xD5A0, 0x11CF, 0xBF, 0xC7, 0x44, + 0x45, 0x53, 0x54, 0x00, 0x00); +DEFINE_GUID(GUID_ConstantForce, 0x13541C20, 0x8E33, 0x11D0, 0x9A, 0xD0, + 0x00, 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_RampForce, 0x13541C21, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Square, 0x13541C22, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Sine, 0x13541C23, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, 0xA0, + 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Triangle, 0x13541C24, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_SawtoothUp, 0x13541C25, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_SawtoothDown, 0x13541C26, 0x8E33, 0x11D0, 0x9A, 0xD0, + 0x00, 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Spring, 0x13541C27, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Damper, 0x13541C28, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Inertia, 0x13541C29, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_Friction, 0x13541C2A, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); +DEFINE_GUID(GUID_CustomForce, 0x13541C2B, 0x8E33, 0x11D0, 0x9A, 0xD0, 0x00, + 0xA0, 0xC9, 0xA0, 0x6E, 0x35); + + +DIOBJECTDATAFORMAT rgodf_c_dfDIKeyboard[] = { + {&GUID_Key, 0, -2147483636, 0} + , + {&GUID_Key, 1, -2147483380, 0} + , + {&GUID_Key, 2, -2147483124, 0} + , + {&GUID_Key, 3, -2147482868, 0} + , + {&GUID_Key, 4, -2147482612, 0} + , + {&GUID_Key, 5, -2147482356, 0} + , + {&GUID_Key, 6, -2147482100, 0} + , + {&GUID_Key, 7, -2147481844, 0} + , + {&GUID_Key, 8, -2147481588, 0} + , + {&GUID_Key, 9, -2147481332, 0} + , + {&GUID_Key, 10, -2147481076, 0} + , + {&GUID_Key, 11, -2147480820, 0} + , + {&GUID_Key, 12, -2147480564, 0} + , + {&GUID_Key, 13, -2147480308, 0} + , + {&GUID_Key, 14, -2147480052, 0} + , + {&GUID_Key, 15, -2147479796, 0} + , + {&GUID_Key, 16, -2147479540, 0} + , + {&GUID_Key, 17, -2147479284, 0} + , + {&GUID_Key, 18, -2147479028, 0} + , + {&GUID_Key, 19, -2147478772, 0} + , + {&GUID_Key, 20, -2147478516, 0} + , + {&GUID_Key, 21, -2147478260, 0} + , + {&GUID_Key, 22, -2147478004, 0} + , + {&GUID_Key, 23, -2147477748, 0} + , + {&GUID_Key, 24, -2147477492, 0} + , + {&GUID_Key, 25, -2147477236, 0} + , + {&GUID_Key, 26, -2147476980, 0} + , + {&GUID_Key, 27, -2147476724, 0} + , + {&GUID_Key, 28, -2147476468, 0} + , + {&GUID_Key, 29, -2147476212, 0} + , + {&GUID_Key, 30, -2147475956, 0} + , + {&GUID_Key, 31, -2147475700, 0} + , + {&GUID_Key, 32, -2147475444, 0} + , + {&GUID_Key, 33, -2147475188, 0} + , + {&GUID_Key, 34, -2147474932, 0} + , + {&GUID_Key, 35, -2147474676, 0} + , + {&GUID_Key, 36, -2147474420, 0} + , + {&GUID_Key, 37, -2147474164, 0} + , + {&GUID_Key, 38, -2147473908, 0} + , + {&GUID_Key, 39, -2147473652, 0} + , + {&GUID_Key, 40, -2147473396, 0} + , + {&GUID_Key, 41, -2147473140, 0} + , + {&GUID_Key, 42, -2147472884, 0} + , + {&GUID_Key, 43, -2147472628, 0} + , + {&GUID_Key, 44, -2147472372, 0} + , + {&GUID_Key, 45, -2147472116, 0} + , + {&GUID_Key, 46, -2147471860, 0} + , + {&GUID_Key, 47, -2147471604, 0} + , + {&GUID_Key, 48, -2147471348, 0} + , + {&GUID_Key, 49, -2147471092, 0} + , + {&GUID_Key, 50, -2147470836, 0} + , + {&GUID_Key, 51, -2147470580, 0} + , + {&GUID_Key, 52, -2147470324, 0} + , + {&GUID_Key, 53, -2147470068, 0} + , + {&GUID_Key, 54, -2147469812, 0} + , + {&GUID_Key, 55, -2147469556, 0} + , + {&GUID_Key, 56, -2147469300, 0} + , + {&GUID_Key, 57, -2147469044, 0} + , + {&GUID_Key, 58, -2147468788, 0} + , + {&GUID_Key, 59, -2147468532, 0} + , + {&GUID_Key, 60, -2147468276, 0} + , + {&GUID_Key, 61, -2147468020, 0} + , + {&GUID_Key, 62, -2147467764, 0} + , + {&GUID_Key, 63, -2147467508, 0} + , + {&GUID_Key, 64, -2147467252, 0} + , + {&GUID_Key, 65, -2147466996, 0} + , + {&GUID_Key, 66, -2147466740, 0} + , + {&GUID_Key, 67, -2147466484, 0} + , + {&GUID_Key, 68, -2147466228, 0} + , + {&GUID_Key, 69, -2147465972, 0} + , + {&GUID_Key, 70, -2147465716, 0} + , + {&GUID_Key, 71, -2147465460, 0} + , + {&GUID_Key, 72, -2147465204, 0} + , + {&GUID_Key, 73, -2147464948, 0} + , + {&GUID_Key, 74, -2147464692, 0} + , + {&GUID_Key, 75, -2147464436, 0} + , + {&GUID_Key, 76, -2147464180, 0} + , + {&GUID_Key, 77, -2147463924, 0} + , + {&GUID_Key, 78, -2147463668, 0} + , + {&GUID_Key, 79, -2147463412, 0} + , + {&GUID_Key, 80, -2147463156, 0} + , + {&GUID_Key, 81, -2147462900, 0} + , + {&GUID_Key, 82, -2147462644, 0} + , + {&GUID_Key, 83, -2147462388, 0} + , + {&GUID_Key, 84, -2147462132, 0} + , + {&GUID_Key, 85, -2147461876, 0} + , + {&GUID_Key, 86, -2147461620, 0} + , + {&GUID_Key, 87, -2147461364, 0} + , + {&GUID_Key, 88, -2147461108, 0} + , + {&GUID_Key, 89, -2147460852, 0} + , + {&GUID_Key, 90, -2147460596, 0} + , + {&GUID_Key, 91, -2147460340, 0} + , + {&GUID_Key, 92, -2147460084, 0} + , + {&GUID_Key, 93, -2147459828, 0} + , + {&GUID_Key, 94, -2147459572, 0} + , + {&GUID_Key, 95, -2147459316, 0} + , + {&GUID_Key, 96, -2147459060, 0} + , + {&GUID_Key, 97, -2147458804, 0} + , + {&GUID_Key, 98, -2147458548, 0} + , + {&GUID_Key, 99, -2147458292, 0} + , + {&GUID_Key, 100, -2147458036, 0} + , + {&GUID_Key, 101, -2147457780, 0} + , + {&GUID_Key, 102, -2147457524, 0} + , + {&GUID_Key, 103, -2147457268, 0} + , + {&GUID_Key, 104, -2147457012, 0} + , + {&GUID_Key, 105, -2147456756, 0} + , + {&GUID_Key, 106, -2147456500, 0} + , + {&GUID_Key, 107, -2147456244, 0} + , + {&GUID_Key, 108, -2147455988, 0} + , + {&GUID_Key, 109, -2147455732, 0} + , + {&GUID_Key, 110, -2147455476, 0} + , + {&GUID_Key, 111, -2147455220, 0} + , + {&GUID_Key, 112, -2147454964, 0} + , + {&GUID_Key, 113, -2147454708, 0} + , + {&GUID_Key, 114, -2147454452, 0} + , + {&GUID_Key, 115, -2147454196, 0} + , + {&GUID_Key, 116, -2147453940, 0} + , + {&GUID_Key, 117, -2147453684, 0} + , + {&GUID_Key, 118, -2147453428, 0} + , + {&GUID_Key, 119, -2147453172, 0} + , + {&GUID_Key, 120, -2147452916, 0} + , + {&GUID_Key, 121, -2147452660, 0} + , + {&GUID_Key, 122, -2147452404, 0} + , + {&GUID_Key, 123, -2147452148, 0} + , + {&GUID_Key, 124, -2147451892, 0} + , + {&GUID_Key, 125, -2147451636, 0} + , + {&GUID_Key, 126, -2147451380, 0} + , + {&GUID_Key, 127, -2147451124, 0} + , + {&GUID_Key, 128, -2147450868, 0} + , + {&GUID_Key, 129, -2147450612, 0} + , + {&GUID_Key, 130, -2147450356, 0} + , + {&GUID_Key, 131, -2147450100, 0} + , + {&GUID_Key, 132, -2147449844, 0} + , + {&GUID_Key, 133, -2147449588, 0} + , + {&GUID_Key, 134, -2147449332, 0} + , + {&GUID_Key, 135, -2147449076, 0} + , + {&GUID_Key, 136, -2147448820, 0} + , + {&GUID_Key, 137, -2147448564, 0} + , + {&GUID_Key, 138, -2147448308, 0} + , + {&GUID_Key, 139, -2147448052, 0} + , + {&GUID_Key, 140, -2147447796, 0} + , + {&GUID_Key, 141, -2147447540, 0} + , + {&GUID_Key, 142, -2147447284, 0} + , + {&GUID_Key, 143, -2147447028, 0} + , + {&GUID_Key, 144, -2147446772, 0} + , + {&GUID_Key, 145, -2147446516, 0} + , + {&GUID_Key, 146, -2147446260, 0} + , + {&GUID_Key, 147, -2147446004, 0} + , + {&GUID_Key, 148, -2147445748, 0} + , + {&GUID_Key, 149, -2147445492, 0} + , + {&GUID_Key, 150, -2147445236, 0} + , + {&GUID_Key, 151, -2147444980, 0} + , + {&GUID_Key, 152, -2147444724, 0} + , + {&GUID_Key, 153, -2147444468, 0} + , + {&GUID_Key, 154, -2147444212, 0} + , + {&GUID_Key, 155, -2147443956, 0} + , + {&GUID_Key, 156, -2147443700, 0} + , + {&GUID_Key, 157, -2147443444, 0} + , + {&GUID_Key, 158, -2147443188, 0} + , + {&GUID_Key, 159, -2147442932, 0} + , + {&GUID_Key, 160, -2147442676, 0} + , + {&GUID_Key, 161, -2147442420, 0} + , + {&GUID_Key, 162, -2147442164, 0} + , + {&GUID_Key, 163, -2147441908, 0} + , + {&GUID_Key, 164, -2147441652, 0} + , + {&GUID_Key, 165, -2147441396, 0} + , + {&GUID_Key, 166, -2147441140, 0} + , + {&GUID_Key, 167, -2147440884, 0} + , + {&GUID_Key, 168, -2147440628, 0} + , + {&GUID_Key, 169, -2147440372, 0} + , + {&GUID_Key, 170, -2147440116, 0} + , + {&GUID_Key, 171, -2147439860, 0} + , + {&GUID_Key, 172, -2147439604, 0} + , + {&GUID_Key, 173, -2147439348, 0} + , + {&GUID_Key, 174, -2147439092, 0} + , + {&GUID_Key, 175, -2147438836, 0} + , + {&GUID_Key, 176, -2147438580, 0} + , + {&GUID_Key, 177, -2147438324, 0} + , + {&GUID_Key, 178, -2147438068, 0} + , + {&GUID_Key, 179, -2147437812, 0} + , + {&GUID_Key, 180, -2147437556, 0} + , + {&GUID_Key, 181, -2147437300, 0} + , + {&GUID_Key, 182, -2147437044, 0} + , + {&GUID_Key, 183, -2147436788, 0} + , + {&GUID_Key, 184, -2147436532, 0} + , + {&GUID_Key, 185, -2147436276, 0} + , + {&GUID_Key, 186, -2147436020, 0} + , + {&GUID_Key, 187, -2147435764, 0} + , + {&GUID_Key, 188, -2147435508, 0} + , + {&GUID_Key, 189, -2147435252, 0} + , + {&GUID_Key, 190, -2147434996, 0} + , + {&GUID_Key, 191, -2147434740, 0} + , + {&GUID_Key, 192, -2147434484, 0} + , + {&GUID_Key, 193, -2147434228, 0} + , + {&GUID_Key, 194, -2147433972, 0} + , + {&GUID_Key, 195, -2147433716, 0} + , + {&GUID_Key, 196, -2147433460, 0} + , + {&GUID_Key, 197, -2147433204, 0} + , + {&GUID_Key, 198, -2147432948, 0} + , + {&GUID_Key, 199, -2147432692, 0} + , + {&GUID_Key, 200, -2147432436, 0} + , + {&GUID_Key, 201, -2147432180, 0} + , + {&GUID_Key, 202, -2147431924, 0} + , + {&GUID_Key, 203, -2147431668, 0} + , + {&GUID_Key, 204, -2147431412, 0} + , + {&GUID_Key, 205, -2147431156, 0} + , + {&GUID_Key, 206, -2147430900, 0} + , + {&GUID_Key, 207, -2147430644, 0} + , + {&GUID_Key, 208, -2147430388, 0} + , + {&GUID_Key, 209, -2147430132, 0} + , + {&GUID_Key, 210, -2147429876, 0} + , + {&GUID_Key, 211, -2147429620, 0} + , + {&GUID_Key, 212, -2147429364, 0} + , + {&GUID_Key, 213, -2147429108, 0} + , + {&GUID_Key, 214, -2147428852, 0} + , + {&GUID_Key, 215, -2147428596, 0} + , + {&GUID_Key, 216, -2147428340, 0} + , + {&GUID_Key, 217, -2147428084, 0} + , + {&GUID_Key, 218, -2147427828, 0} + , + {&GUID_Key, 219, -2147427572, 0} + , + {&GUID_Key, 220, -2147427316, 0} + , + {&GUID_Key, 221, -2147427060, 0} + , + {&GUID_Key, 222, -2147426804, 0} + , + {&GUID_Key, 223, -2147426548, 0} + , + {&GUID_Key, 224, -2147426292, 0} + , + {&GUID_Key, 225, -2147426036, 0} + , + {&GUID_Key, 226, -2147425780, 0} + , + {&GUID_Key, 227, -2147425524, 0} + , + {&GUID_Key, 228, -2147425268, 0} + , + {&GUID_Key, 229, -2147425012, 0} + , + {&GUID_Key, 230, -2147424756, 0} + , + {&GUID_Key, 231, -2147424500, 0} + , + {&GUID_Key, 232, -2147424244, 0} + , + {&GUID_Key, 233, -2147423988, 0} + , + {&GUID_Key, 234, -2147423732, 0} + , + {&GUID_Key, 235, -2147423476, 0} + , + {&GUID_Key, 236, -2147423220, 0} + , + {&GUID_Key, 237, -2147422964, 0} + , + {&GUID_Key, 238, -2147422708, 0} + , + {&GUID_Key, 239, -2147422452, 0} + , + {&GUID_Key, 240, -2147422196, 0} + , + {&GUID_Key, 241, -2147421940, 0} + , + {&GUID_Key, 242, -2147421684, 0} + , + {&GUID_Key, 243, -2147421428, 0} + , + {&GUID_Key, 244, -2147421172, 0} + , + {&GUID_Key, 245, -2147420916, 0} + , + {&GUID_Key, 246, -2147420660, 0} + , + {&GUID_Key, 247, -2147420404, 0} + , + {&GUID_Key, 248, -2147420148, 0} + , + {&GUID_Key, 249, -2147419892, 0} + , + {&GUID_Key, 250, -2147419636, 0} + , + {&GUID_Key, 251, -2147419380, 0} + , + {&GUID_Key, 252, -2147419124, 0} + , + {&GUID_Key, 253, -2147418868, 0} + , + {&GUID_Key, 254, -2147418612, 0} + , + {&GUID_Key, 255, -2147418356, 0} +}; + +const DIDATAFORMAT c_dfDIKeyboard = { 24, + 16, + 2, + 256, + 256, + rgodf_c_dfDIKeyboard +}; + +DIOBJECTDATAFORMAT rgodf_c_dfDIMouse[] = { + {&GUID_XAxis, 0, 16776963, 0} + , + {&GUID_YAxis, 4, 16776963, 0} + , + {&GUID_ZAxis, 8, -2130706685, 0} + , + {0, 12, 16776972, 0} + , + {0, 13, 16776972, 0} + , + {0, 14, -2130706676, 0} + , + {0, 15, -2130706676, 0} +}; + +const DIDATAFORMAT c_dfDIMouse = { 24, + 16, + 2, + 16, + 7, + rgodf_c_dfDIMouse +}; + +DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick[] = { + {&GUID_XAxis, 0, -2130706685, 256} + , + {&GUID_YAxis, 4, -2130706685, 256} + , + {&GUID_ZAxis, 8, -2130706685, 256} + , + {&GUID_RxAxis, 12, -2130706685, 256} + , + {&GUID_RyAxis, 16, -2130706685, 256} + , + {&GUID_RzAxis, 20, -2130706685, 256} + , + {&GUID_Slider, 24, -2130706685, 256} + , + {&GUID_Slider, 28, -2130706685, 256} + , + {&GUID_POV, 32, -2130706672, 0} + , + {&GUID_POV, 36, -2130706672, 0} + , + {&GUID_POV, 40, -2130706672, 0} + , + {&GUID_POV, 44, -2130706672, 0} + , + {0, 48, -2130706676, 0} + , + {0, 49, -2130706676, 0} + , + {0, 50, -2130706676, 0} + , + {0, 51, -2130706676, 0} + , + {0, 52, -2130706676, 0} + , + {0, 53, -2130706676, 0} + , + {0, 54, -2130706676, 0} + , + {0, 55, -2130706676, 0} + , + {0, 56, -2130706676, 0} + , + {0, 57, -2130706676, 0} + , + {0, 58, -2130706676, 0} + , + {0, 59, -2130706676, 0} + , + {0, 60, -2130706676, 0} + , + {0, 61, -2130706676, 0} + , + {0, 62, -2130706676, 0} + , + {0, 63, -2130706676, 0} + , + {0, 64, -2130706676, 0} + , + {0, 65, -2130706676, 0} + , + {0, 66, -2130706676, 0} + , + {0, 67, -2130706676, 0} + , + {0, 68, -2130706676, 0} + , + {0, 69, -2130706676, 0} + , + {0, 70, -2130706676, 0} + , + {0, 71, -2130706676, 0} + , + {0, 72, -2130706676, 0} + , + {0, 73, -2130706676, 0} + , + {0, 74, -2130706676, 0} + , + {0, 75, -2130706676, 0} + , + {0, 76, -2130706676, 0} + , + {0, 77, -2130706676, 0} + , + {0, 78, -2130706676, 0} + , + {0, 79, -2130706676, 0} +}; + +const DIDATAFORMAT c_dfDIJoystick = { 24, + 16, + 1, + 80, + 44, + rgodf_c_dfDIJoystick +}; + +DIOBJECTDATAFORMAT rgodf_c_dfDIJoystick2[] = { + {&GUID_XAxis, 0, -2130706685, 256} + , + {&GUID_YAxis, 4, -2130706685, 256} + , + {&GUID_ZAxis, 8, -2130706685, 256} + , + {&GUID_RxAxis, 12, -2130706685, 256} + , + {&GUID_RyAxis, 16, -2130706685, 256} + , + {&GUID_RzAxis, 20, -2130706685, 256} + , + {&GUID_Slider, 24, -2130706685, 256} + , + {&GUID_Slider, 28, -2130706685, 256} + , + {&GUID_POV, 32, -2130706672, 0} + , + {&GUID_POV, 36, -2130706672, 0} + , + {&GUID_POV, 40, -2130706672, 0} + , + {&GUID_POV, 44, -2130706672, 0} + , + {0, 48, -2130706676, 0} + , + {0, 49, -2130706676, 0} + , + {0, 50, -2130706676, 0} + , + {0, 51, -2130706676, 0} + , + {0, 52, -2130706676, 0} + , + {0, 53, -2130706676, 0} + , + {0, 54, -2130706676, 0} + , + {0, 55, -2130706676, 0} + , + {0, 56, -2130706676, 0} + , + {0, 57, -2130706676, 0} + , + {0, 58, -2130706676, 0} + , + {0, 59, -2130706676, 0} + , + {0, 60, -2130706676, 0} + , + {0, 61, -2130706676, 0} + , + {0, 62, -2130706676, 0} + , + {0, 63, -2130706676, 0} + , + {0, 64, -2130706676, 0} + , + {0, 65, -2130706676, 0} + , + {0, 66, -2130706676, 0} + , + {0, 67, -2130706676, 0} + , + {0, 68, -2130706676, 0} + , + {0, 69, -2130706676, 0} + , + {0, 70, -2130706676, 0} + , + {0, 71, -2130706676, 0} + , + {0, 72, -2130706676, 0} + , + {0, 73, -2130706676, 0} + , + {0, 74, -2130706676, 0} + , + {0, 75, -2130706676, 0} + , + {0, 76, -2130706676, 0} + , + {0, 77, -2130706676, 0} + , + {0, 78, -2130706676, 0} + , + {0, 79, -2130706676, 0} + , + {0, 80, -2130706676, 0} + , + {0, 81, -2130706676, 0} + , + {0, 82, -2130706676, 0} + , + {0, 83, -2130706676, 0} + , + {0, 84, -2130706676, 0} + , + {0, 85, -2130706676, 0} + , + {0, 86, -2130706676, 0} + , + {0, 87, -2130706676, 0} + , + {0, 88, -2130706676, 0} + , + {0, 89, -2130706676, 0} + , + {0, 90, -2130706676, 0} + , + {0, 91, -2130706676, 0} + , + {0, 92, -2130706676, 0} + , + {0, 93, -2130706676, 0} + , + {0, 94, -2130706676, 0} + , + {0, 95, -2130706676, 0} + , + {0, 96, -2130706676, 0} + , + {0, 97, -2130706676, 0} + , + {0, 98, -2130706676, 0} + , + {0, 99, -2130706676, 0} + , + {0, 100, -2130706676, 0} + , + {0, 101, -2130706676, 0} + , + {0, 102, -2130706676, 0} + , + {0, 103, -2130706676, 0} + , + {0, 104, -2130706676, 0} + , + {0, 105, -2130706676, 0} + , + {0, 106, -2130706676, 0} + , + {0, 107, -2130706676, 0} + , + {0, 108, -2130706676, 0} + , + {0, 109, -2130706676, 0} + , + {0, 110, -2130706676, 0} + , + {0, 111, -2130706676, 0} + , + {0, 112, -2130706676, 0} + , + {0, 113, -2130706676, 0} + , + {0, 114, -2130706676, 0} + , + {0, 115, -2130706676, 0} + , + {0, 116, -2130706676, 0} + , + {0, 117, -2130706676, 0} + , + {0, 118, -2130706676, 0} + , + {0, 119, -2130706676, 0} + , + {0, 120, -2130706676, 0} + , + {0, 121, -2130706676, 0} + , + {0, 122, -2130706676, 0} + , + {0, 123, -2130706676, 0} + , + {0, 124, -2130706676, 0} + , + {0, 125, -2130706676, 0} + , + {0, 126, -2130706676, 0} + , + {0, 127, -2130706676, 0} + , + {0, 128, -2130706676, 0} + , + {0, 129, -2130706676, 0} + , + {0, 130, -2130706676, 0} + , + {0, 131, -2130706676, 0} + , + {0, 132, -2130706676, 0} + , + {0, 133, -2130706676, 0} + , + {0, 134, -2130706676, 0} + , + {0, 135, -2130706676, 0} + , + {0, 136, -2130706676, 0} + , + {0, 137, -2130706676, 0} + , + {0, 138, -2130706676, 0} + , + {0, 139, -2130706676, 0} + , + {0, 140, -2130706676, 0} + , + {0, 141, -2130706676, 0} + , + {0, 142, -2130706676, 0} + , + {0, 143, -2130706676, 0} + , + {0, 144, -2130706676, 0} + , + {0, 145, -2130706676, 0} + , + {0, 146, -2130706676, 0} + , + {0, 147, -2130706676, 0} + , + {0, 148, -2130706676, 0} + , + {0, 149, -2130706676, 0} + , + {0, 150, -2130706676, 0} + , + {0, 151, -2130706676, 0} + , + {0, 152, -2130706676, 0} + , + {0, 153, -2130706676, 0} + , + {0, 154, -2130706676, 0} + , + {0, 155, -2130706676, 0} + , + {0, 156, -2130706676, 0} + , + {0, 157, -2130706676, 0} + , + {0, 158, -2130706676, 0} + , + {0, 159, -2130706676, 0} + , + {0, 160, -2130706676, 0} + , + {0, 161, -2130706676, 0} + , + {0, 162, -2130706676, 0} + , + {0, 163, -2130706676, 0} + , + {0, 164, -2130706676, 0} + , + {0, 165, -2130706676, 0} + , + {0, 166, -2130706676, 0} + , + {0, 167, -2130706676, 0} + , + {0, 168, -2130706676, 0} + , + {0, 169, -2130706676, 0} + , + {0, 170, -2130706676, 0} + , + {0, 171, -2130706676, 0} + , + {0, 172, -2130706676, 0} + , + {0, 173, -2130706676, 0} + , + {0, 174, -2130706676, 0} + , + {0, 175, -2130706676, 0} + , + {&GUID_XAxis, 176, -2130706685, 512} + , + {&GUID_YAxis, 180, -2130706685, 512} + , + {&GUID_ZAxis, 184, -2130706685, 512} + , + {&GUID_RxAxis, 188, -2130706685, 512} + , + {&GUID_RyAxis, 192, -2130706685, 512} + , + {&GUID_RzAxis, 196, -2130706685, 512} + , + {&GUID_Slider, 24, -2130706685, 512} + , + {&GUID_Slider, 28, -2130706685, 512} + , + {&GUID_XAxis, 208, -2130706685, 768} + , + {&GUID_YAxis, 212, -2130706685, 768} + , + {&GUID_ZAxis, 216, -2130706685, 768} + , + {&GUID_RxAxis, 220, -2130706685, 768} + , + {&GUID_RyAxis, 224, -2130706685, 768} + , + {&GUID_RzAxis, 228, -2130706685, 768} + , + {&GUID_Slider, 24, -2130706685, 768} + , + {&GUID_Slider, 28, -2130706685, 768} + , + {&GUID_XAxis, 240, -2130706685, 1024} + , + {&GUID_YAxis, 244, -2130706685, 1024} + , + {&GUID_ZAxis, 248, -2130706685, 1024} + , + {&GUID_RxAxis, 252, -2130706685, 1024} + , + {&GUID_RyAxis, 256, -2130706685, 1024} + , + {&GUID_RzAxis, 260, -2130706685, 1024} + , + {&GUID_Slider, 24, -2130706685, 1024} + , + {&GUID_Slider, 28, -2130706685, 1024} +}; + +const DIDATAFORMAT c_dfDIJoystick2 = { 24, + 16, + 1, + 272, + 164, + rgodf_c_dfDIJoystick2 +}; + + +/* DirectSound */ + +// Direct Sound Component GUID {47D4D946-62E8-11cf-93BC-444553540000} +DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, + 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +// DirectSound Capture Component GUID {B0210780-89CD-11d0-AF08-00A0C925CD16} +DEFINE_GUID(CLSID_DirectSoundCapture, 0xb0210780, 0x89cd, 0x11d0, 0xaf, + 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); +#endif diff --git a/src/ui/ui-drv/win32/installer/XaoS Installer.nsi b/src/ui/ui-drv/win32/installer/XaoS Installer.nsi new file mode 100644 index 0000000..cfd49ba --- /dev/null +++ b/src/ui/ui-drv/win32/installer/XaoS Installer.nsi @@ -0,0 +1,138 @@ +;--------------------------------
+;Include Modern UI
+
+ !include "MUI2.nsh"
+
+;--------------------------------
+;General
+
+ ;Name and file
+ Name "XaoS"
+ OutFile "XaoS Installer.exe"
+
+ ;Default installation folder
+ InstallDir "$PROGRAMFILES\XaoS"
+
+ ;Get installation folder from registry if available
+ InstallDirRegKey HKLM "Software\XaoS" ""
+
+ ;Request application privileges for Windows Vista
+ RequestExecutionLevel admin
+
+;--------------------------------
+;Variables
+
+ Var StartMenuFolder
+
+;--------------------------------
+;Interface Settings
+
+ !define MUI_HEADERIMAGE
+ !define MUI_HEADERIMAGE_BITMAP "XaoS.bmp"
+ !define MUI_ABORTWARNING
+
+;--------------------------------
+;Language Selection Dialog Settings
+
+ ;Remember the installer language
+ !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
+ !define MUI_LANGDLL_REGISTRY_KEY "Software\XaoS"
+ !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
+
+;--------------------------------
+;Pages
+
+ !insertmacro MUI_PAGE_WELCOME
+ !insertmacro MUI_PAGE_LICENSE "..\..\..\..\..\copying"
+ !insertmacro MUI_PAGE_DIRECTORY
+
+ ;Start Menu Folder Page Configuration
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\XaoS"
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+
+ !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
+
+ !insertmacro MUI_PAGE_INSTFILES
+ !insertmacro MUI_PAGE_FINISH
+
+ !insertmacro MUI_UNPAGE_WELCOME
+ !insertmacro MUI_UNPAGE_CONFIRM
+ !insertmacro MUI_UNPAGE_INSTFILES
+ !insertmacro MUI_UNPAGE_FINISH
+
+;--------------------------------
+;Languages
+
+ !insertmacro MUI_LANGUAGE "English"
+ !insertmacro MUI_LANGUAGE "French"
+ !insertmacro MUI_LANGUAGE "German"
+ !insertmacro MUI_LANGUAGE "Spanish"
+ !insertmacro MUI_LANGUAGE "Italian"
+ !insertmacro MUI_LANGUAGE "Czech"
+ !insertmacro MUI_LANGUAGE "Hungarian"
+ !insertmacro MUI_LANGUAGE "Romanian"
+
+;--------------------------------
+;Reserve Files
+
+ ;If you are using solid compression, files that are required before
+ ;the actual installation should be stored first in the data block,
+ ;because this will make your installer start faster.
+
+ !insertmacro MUI_RESERVEFILE_LANGDLL
+
+;--------------------------------
+;Installer Sections
+
+Section "XaoS" XaoS
+
+ SetOutPath "$INSTDIR"
+
+ File /r "XaoS\*"
+
+ ;Store installation folder
+ WriteRegStr HKLM "Software\XaoS" "" $INSTDIR
+
+ ;Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+
+ ;Create shortcuts
+ CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
+
+ SetOutPath "$INSTDIR\bin"
+
+ CreateShortCut "$SMPROGRAMS\$StartMenuFolder\XaoS.lnk" "$INSTDIR\bin\xaos.exe"
+
+ !insertmacro MUI_STARTMENU_WRITE_END
+
+SectionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+
+ RMDir /r /REBOOTOK "$INSTDIR"
+
+ !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
+
+ Delete "$SMPROGRAMS\$StartMenuFolder\XaoS.lnk"
+ Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
+ RMDir "$SMPROGRAMS\$StartMenuFolder"
+
+ DeleteRegKey /ifempty HKLM "Software\XaoS"
+
+SectionEnd
+
+;--------------------------------
+;Uninstaller Functions
+
+Function un.onInit
+
+ !insertmacro MUI_UNGETLANGUAGE
+
+FunctionEnd
\ No newline at end of file diff --git a/src/ui/ui-drv/win32/installer/XaoS.bmp b/src/ui/ui-drv/win32/installer/XaoS.bmp Binary files differnew file mode 100644 index 0000000..47b4b82 --- /dev/null +++ b/src/ui/ui-drv/win32/installer/XaoS.bmp diff --git a/src/ui/ui-drv/win32/resource.h b/src/ui/ui-drv/win32/resource.h new file mode 100644 index 0000000..596a030 --- /dev/null +++ b/src/ui/ui-drv/win32/resource.h @@ -0,0 +1,3 @@ +/*#define IDI_XAOS_ICON 128 + #define IDI_SMALL_ICON 129 */ +/*#define IDOK 0 */ diff --git a/src/ui/ui-drv/win32/small.ico b/src/ui/ui-drv/win32/small.ico Binary files differnew file mode 100644 index 0000000..8481328 --- /dev/null +++ b/src/ui/ui-drv/win32/small.ico diff --git a/src/ui/ui-drv/win32/ui_win32.c b/src/ui/ui-drv/win32/ui_win32.c new file mode 100644 index 0000000..fff810c --- /dev/null +++ b/src/ui/ui-drv/win32/ui_win32.c @@ -0,0 +1,1886 @@ +/* This file actually implements three drivers (win32 and DirectX + windowed/fullscreen) drivers, because they have a lot of common stuff. */ +#include <config.h> +#ifdef WIN32_DRIVER +#define _WIN32_WINNT 0x0501 /* Enable access to Windows XP APIs */ +#include <windows.h> +#ifdef HTML_HELP +#include <htmlhelp.h> +#endif +#ifdef DDRAW_DRIVER +#include <ddraw.h> +#endif +#include <malloc.h> +#include <string.h> +#include <stdio.h> +#include <xmenu.h> +#include <xerror.h> +#include "ui.h" +#include "ui_win32.h" +#include "resource.h" +#include "xio.h" +#include <cursor.h> + +#define MAXRESOLUTIONS 256 +#define DXWIDTH 320 +#define DXHEIGHT 200 +#define DXBPP 8 +#define WWIDTH (480+4*48) +#define WHEIGHT (360+4*36) + +#define DXFULLSCREEN 1 +#define DXWINDOWED 2 + +#define MOUSEWIDTH 16 +#define MOUSEHEIGHT 16 + +#ifdef HAVE_GETTEXT + +#include <libintl.h> + +#include <locale.h> + +#else + +#define gettext(STRING) STRING + +#endif + + + +HINSTANCE hInstance; +HWND hWnd; +CONST char *helptopic = "main"; + +struct ui_driver win32_driver; +struct ui_driver dxw_driver, dxf_driver; + +static int initialized = 0, needredraw = 0; + +static char *helpname = NULL; + +/* This variables are used by drivers in initializetion */ +static int windowpos; +static CONST char *size = "520x430"; +static CONST char *dxsize = "320x200x8"; + + +/* Display information */ +static int displayX, displayY, bitDepth; +static int lineSize; +static int fontWidth, fontHeight; +static HPALETTE hPalette = NULL; +static char *buffer1; +static char *buffer2; +static int currentbuff = 0; +static BITMAPINFO *bmp = NULL; + +/* Mouse */ +static int mouseX, mouseY, mouseButtons = 0; +static int captured = 0, tmpcaptured = 0; + +/* Keyboard state */ +static int altPressed; +static int arrowsPressed; + +/* WindowProc comunication variables */ +static BOOL closeFlag; +static int resized = 0; +static int active = 1; + +/* Curent class information */ +static HICON hIcon; +static HICON hIconSm; +static HFONT hFont = NULL; + +/* DirectX stuff */ +#ifdef DDRAW_DRIVER +int directX = 0; +static LPDIRECTDRAWPALETTE dxPalette = NULL; +static LPDIRECTDRAW lpDD = NULL; +static LPDIRECTDRAW2 lpDD2 = NULL; +static LPDIRECTDRAWSURFACE lpSurfaces[2], BackSurface[2]; +static DDSURFACEDESC surface[2]; +static CONST char *mousepointer = mouse_pointer_data; +static char *storeddata = NULL; +static HMODULE hModule = NULL; +static int oldmouseX, oldmouseY; +#else +#define directX 0 +#endif +static PUCHAR backpalette[256][4]; +static HMODULE hModule2; +static RECT rcWindow; +static RECT rcViewport; +static RECT rcScreen; +static int MyHelpMsg; +/*clipboard*/ +static WORD clipboard_format; + +/* forward declarations */ +#ifdef DDRAW_DRIVER +static void DeInitDD(void); +static void PaintDD(void); +static void UpdateMouseDD(void); +#endif +static void Paint(HDC hDC); +static void CalculateBITMAPINFO(void); +static void win32_display(void); +static void DeInitWindow(void); + +#ifdef DDRAW_DRIVER + /* FIXME: In windowed mode we don't support 8bpp yet! */ +#define DXSUPPORTEDDEPTH(fullscreen,depth) \ + (!(depth < 8 || (!fullscreen && depth != 16 && depth !=24 && depth != 32))) + +static char *store(char *data, int depth, int lpitch, int width, + int height, int xpos, int ypos) +{ + int d = depth / 8; + char *store = malloc(d * MOUSEWIDTH * MOUSEHEIGHT); + int y; + if (xpos + MOUSEWIDTH > width) + xpos = width - MOUSEWIDTH; + if (ypos + MOUSEHEIGHT > height) + ypos = height - MOUSEHEIGHT; + if (xpos < 0) + xpos = 0; + if (ypos < 0) + ypos = 0; + for (y = 0; y < MOUSEHEIGHT; y++) + memcpy(store + d * MOUSEWIDTH * y, + data + xpos * d + (ypos + y) * lpitch, MOUSEWIDTH * d); + return store; +} + +static void +restore(char *data, CONST char *store, int depth, int lpitch, int width, + int height, int xpos, int ypos) +{ + int y; + int d = depth / 8; + if (xpos + MOUSEWIDTH > width) + xpos = width - MOUSEWIDTH; + if (ypos + MOUSEHEIGHT > height) + ypos = height - MOUSEHEIGHT; + if (xpos < 0) + xpos = 0; + if (ypos < 0) + ypos = 0; + for (y = 0; y < MOUSEHEIGHT; y++) + memcpy(data + xpos * d + (ypos + y) * lpitch, + store + d * MOUSEWIDTH * y, MOUSEWIDTH * d); +} + +static void +drawmouse(char *data, CONST char *mouse, int depth, int lpitch, int width, + int height, int xpos, int ypos) +{ + int x, y, z, c; + int d = depth / 8; + for (y = 0; y < MOUSEWIDTH; y++) + for (x = 0; x < MOUSEWIDTH; x++) + if (mouse[x + MOUSEWIDTH * y] && x + xpos > 0 + && (x + xpos) < width && y + ypos > 0 + && y + ypos < height) { + c = mouse[x + MOUSEWIDTH * y] == 2 ? (d == + 1 ? 1 : 255) : 0; + for (z = 0; z < d; z++) + data[z + d * (x + xpos) + (y + ypos) * lpitch] = c; + } +} +#endif +static void getdimens(float *width, float *height) +{ + HDC hDC = GetDC(hWnd); + *width = GetDeviceCaps(hDC, HORZSIZE) / 10.0; + *height = GetDeviceCaps(hDC, VERTSIZE) / 10.0; + if (*width > 100 || *width < 1) + *width = 29.0; + if (*height > 100 || *height < 1) + *height = 21.0; + ReleaseDC(hWnd, hDC); +} + +static void getres(float *width, float *height) +{ + HDC hDC = GetDC(hWnd); + *width = 2.54 / GetDeviceCaps(hDC, LOGPIXELSX); + *height = 2.54 / GetDeviceCaps(hDC, LOGPIXELSY); + ReleaseDC(hWnd, hDC); +} + +/****************************************************************************** + Win32 driver helper routines + */ + +static LRESULT CALLBACK WindowProc(HWND hWnd, // handle to window + UINT uMsg, // message identifier + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter + ) +{ + PAINTSTRUCT paintStruct; + HDC hDC; + if (uMsg == (unsigned int) MyHelpMsg) { + win32_help(NULL, helptopic); + return 0; + } + switch (uMsg) { + case WM_COMMAND: + win32_pressed(wParam); + break; + case WM_SIZE: + // resize window + if (directX == DXFULLSCREEN) + return 0; + if (LOWORD(lParam) == 0 && HIWORD(lParam) == 0) { + active = 0; + break; + } /*Minimized window */ + active = 1; + if (displayX != LOWORD(lParam) || displayY != HIWORD(lParam)) + resized = 1; + displayX = LOWORD(lParam); + displayY = HIWORD(lParam); + break; + case WM_DISPLAYCHANGE: + if (directX == DXFULLSCREEN) + return 0; + mouseButtons = 0; + resized = 1; + hDC = GetDC(hWnd); + bitDepth = GetDeviceCaps(hDC, BITSPIXEL); + ReleaseDC(hWnd, hDC); + break; + case WM_CLOSE: + // close window + closeFlag = TRUE; + return 0; + case WM_MOUSEMOVE: + case WM_LBUTTONUP: + case WM_LBUTTONDOWN: + case WM_RBUTTONUP: + case WM_RBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MBUTTONDOWN: + // handle mouse move and mouse buttons + mouseButtons = wParam; + if (!captured) { + if (mouseButtons && !tmpcaptured) + SetCapture(hWnd), tmpcaptured = 1; + if (!mouseButtons && tmpcaptured) + ReleaseCapture(), tmpcaptured = 0; + } + mouseX = (short) LOWORD(lParam); + mouseY = (short) HIWORD(lParam); +#ifdef DDRAW_DRIVER + if (directX == DXFULLSCREEN) { + POINT p; + GetCursorPos(&p); + mouseX = p.x; + mouseY = p.y; + UpdateMouseDD(); + } +#endif + break; + case WM_PAINT: + // redraw screen + if (directX == DXFULLSCREEN) + return 0; + needredraw = 1; + if (GetUpdateRect(hWnd, NULL, FALSE)) { + HDC hDC = BeginPaint(hWnd, &paintStruct); + if (hDC) { +#ifdef DDRAW_DRIVER + if (directX) + PaintDD(); + else +#endif + Paint(hDC); + EndPaint(hWnd, &paintStruct); + } + } + return 0; + case WM_QUERYNEWPALETTE: + // windows calls this when window is reactivated. + if (directX == DXFULLSCREEN) + return 0; + hDC = GetDC(hWnd); +#ifdef DDRAW_DRIVER + if (directX == DXWINDOWED) { + if (dxPalette) { + IDirectDrawSurface_SetPalette(lpSurfaces[0], dxPalette); + IDirectDrawPalette_SetEntries(dxPalette, 0, 0, 255, + (PALETTEENTRY *) + backpalette); + } + } else +#endif + { + SelectPalette(hDC, hPalette, FALSE); + RealizePalette(hDC); + } + ReleaseDC(hWnd, hDC); + return TRUE; + case WM_MOVE: + if (directX != DXFULLSCREEN) { + GetWindowRect(hWnd, &rcWindow); + GetClientRect(hWnd, &rcViewport); + GetClientRect(hWnd, &rcScreen); + ClientToScreen(hWnd, (POINT *) & rcScreen.left); + ClientToScreen(hWnd, (POINT *) & rcScreen.right); + } + break; + case WM_SETCURSOR: + if (directX == DXFULLSCREEN) { + SetCursor(NULL); + return TRUE; + } + break; +#ifdef DDRAW_DRIVER + case WM_ACTIVATEAPP: + { + int oldactive = active; + mouseButtons = 0; + if (directX == DXFULLSCREEN) { + needredraw = 1; + active = (wParam == WA_ACTIVE) + || (wParam == WA_CLICKACTIVE) /*(BOOL) wParam */ ; + PaintDD(); + if (!oldactive && active && captured) + SetCursor(NULL), SetCapture(hWnd); + if (oldactive && !active && captured) + ReleaseCapture(); + return 0L; + } + } +#endif + break; + } + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} + +/*Create Xaos Window. It is either used for normal window mode or + as basis for DirectX */ +static int InitWindow(void) +{ + int width = CW_USEDEFAULT, height = CW_USEDEFAULT; + int xpos = CW_USEDEFAULT, ypos = CW_USEDEFAULT; + LOGPALETTE *logPalette; + WNDCLASS wndClass; + LOGFONT logFont; + ATOM a; + HDC hDC; + TEXTMETRIC textMetric; + HGLOBAL oldFont; + RECT r; + closeFlag = FALSE; + + altPressed = arrowsPressed = 0; + if (hIcon == NULL) + hIcon = LoadIcon(hInstance, "BIG"); + mouseButtons = 0; + mouseX = 0; + mouseY = 0; + { + static FARPROC proc; + if (hModule2 == NULL) { + hModule2 = LoadLibrary("user32"); + proc = GetProcAddress(hModule2, "RegisterClassExA"); + } + if (proc != NULL) { + WNDCLASSEX ExWndClass; + memset(&ExWndClass, 0, sizeof(WNDCLASSEX)); + if (hIconSm == NULL) + hIconSm = LoadIcon(hInstance, "SMALL"); + ExWndClass.hIconSm = hIconSm; + memset(&ExWndClass, 0, sizeof(WNDCLASSEX)); + ExWndClass.style = CS_OWNDC; + ExWndClass.cbSize = sizeof(WNDCLASSEX); + ExWndClass.lpfnWndProc = WindowProc; + ExWndClass.hInstance = hInstance; + ExWndClass.hIcon = hIcon; + ExWndClass.hCursor = LoadCursor(NULL, IDC_ARROW); + ExWndClass.lpszClassName = "XaosWindow"; + ExWndClass.hbrBackground = + (HBRUSH) GetStockObject(BLACK_BRUSH); + a = (ATOM) proc(&ExWndClass); + } else { + memset(&wndClass, 0, sizeof(WNDCLASS)); + wndClass.style = CS_OWNDC; + wndClass.lpfnWndProc = WindowProc; + wndClass.hInstance = hInstance; + wndClass.hIcon = hIcon; + wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndClass.lpszClassName = "XaosWindow"; + wndClass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH); + a = RegisterClass(&wndClass); + } + } + if (!a) { + x_error("Unable to create windows class"); + return 0; + } + + /* First time use defaut size, otherwise use saved sizes */ + if (sscanf(size, "%ix%ix", &width, &height) != 2) { + width = WWIDTH; + height = WHEIGHT; + } + if (windowpos) { + xpos = rcWindow.left; + ypos = rcWindow.top; + width = rcWindow.right - rcWindow.left; + height = rcWindow.bottom - rcWindow.top; + } + + /* create main window */ + if (directX == DXFULLSCREEN) + hWnd = + CreateWindowEx(WS_EX_TOPMOST, "XaoSWindow", "XaoS", WS_POPUP, + 0, 0, GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), NULL, NULL, + hInstance, NULL); + else + + hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "XaoSWindow", "XaoS", + WS_OVERLAPPEDWINDOW | WS_EX_LEFTSCROLLBAR, + xpos, ypos, width, height, NULL, NULL, + hInstance, NULL); + + if (!hWnd) { + x_error("Unable to create app window"); + return 0; + } + + clipboard_format = RegisterClipboardFormat("image/x-xaos.position"); + + + /* create font */ + memset(&logFont, 0, sizeof(LOGFONT)); + hDC = CreateDC("DISPLAY", NULL, NULL, NULL); + logFont.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72); + logFont.lfWeight = FW_NORMAL; + logFont.lfPitchAndFamily = FIXED_PITCH; + strcpy(logFont.lfFaceName, "Courier"); + + hFont = CreateFontIndirect(&logFont); + oldFont = SelectObject(hDC, hFont); + GetTextMetrics(hDC, &textMetric); + SelectObject(hDC, oldFont); + DeleteDC(hDC); + + fontHeight = textMetric.tmHeight; + fontWidth = textMetric.tmAveCharWidth; + + ShowWindow(hWnd, SW_NORMAL); + + GetClientRect(hWnd, &r); + displayX = r.right; + displayY = r.bottom; + + /* create palette */ + CalculateBITMAPINFO(); /* calculate BITMAPINFO structure */ + logPalette = malloc(sizeof(LOGPALETTE) + 4 * 256); + logPalette->palVersion = 0x300; + logPalette->palNumEntries = 256; + memcpy(logPalette->palPalEntry, bmp->bmiColors, 4 * 256); + hPalette = CreatePalette(logPalette); + free(logPalette); + + /* select and realize palette */ + hDC = GetDC(hWnd); + SelectPalette(hDC, hPalette, FALSE); + RealizePalette(hDC); + ReleaseDC(hWnd, hDC); + + // increase priority of XaoS + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); + + MyHelpMsg = RegisterWindowMessage(HELPMSGSTRING); + + return 1; +} + +static void DeInitWindow() +{ + if (tmpcaptured) + ReleaseCapture(); + if (directX != DXFULLSCREEN) + windowpos = 1, GetWindowRect(hWnd, &rcWindow); + /* normalize priority */ + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); + if (helpname) + WinHelp(hWnd, helpname, HELP_QUIT, 0), free(helpname), helpname = + NULL; + + /* destroy windows and other objects */ + DeleteObject(hFont); + DestroyWindow(hWnd); + UnregisterClass("XaosWindow", hInstance); + if (bmp) { + free(bmp); + bmp = NULL; + } + if (hModule2 != NULL) + FreeLibrary(hModule2); + hModule2 = NULL; + win32_uninitializewindows(); +} + +/* Display buffer to screen */ +static void Paint(HDC hDC) +{ + if (!initialized || !buffer1) + return; + StretchDIBits(hDC, 0, 0, displayX, displayY, + 0, 0, displayX, displayY, + (currentbuff == 0) ? buffer1 : buffer2, + bmp, DIB_RGB_COLORS, SRCCOPY); + needredraw = 0; +} + + + +static int Init(void) +{ + HDC hDC; + buffer1 = buffer2 = NULL; + + // get bit depth + hDC = CreateDC("DISPLAY", NULL, NULL, NULL); + bitDepth = GetDeviceCaps(hDC, BITSPIXEL); + if (bitDepth < 8) + bitDepth = 16; + if (bitDepth < 10) + bitDepth = 8; + if (bitDepth >= 10 && bitDepth < 20) + bitDepth = 16; + if (bitDepth >= 20 && bitDepth < 28) + bitDepth = 24; + if (bitDepth >= 32 && bitDepth < 32) + bitDepth = 32; + DeleteDC(hDC); + + // create windows and other objects + if (!InitWindow()) + return 0; + + CalculateBITMAPINFO(); /* calculate BITMAPINFO structure */ + + + return 1; +} + +static void getmouse(int *mx, int *my, int *mb) +{ + *mb = 0; + if (mouseButtons & MK_LBUTTON) + *mb |= 256; + if (mouseButtons & MK_MBUTTON) + *mb |= 512; + if (mouseButtons & MK_RBUTTON) + *mb |= 1024; + *mx = mouseX; + *my = mouseY; +} + +static void +Processevents(int wait, int *mx, int *my, int *mb, int *k, int *c) +{ + MSG msg; + int r; + if (wait) { + // wait for message if in wait mode + r = GetMessage(&msg, hWnd, 0, 0); + wait = 0; + } else { + // don't wait for message + r = PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE); + } +#if 0 + if (needredraw) { + if (directX) + PaintDD(); + else + win32_display(); + } +#endif + if (r > 0) { + if (msg.message == WM_CHAR) { + // ascii char + *c = msg.wParam; + } + if (msg.message == WM_KEYUP) + switch (msg.wParam) { + case VK_MENU: + altPressed = 0; + break; + case VK_UP: + arrowsPressed &= ~4; + break; + case VK_DOWN: + arrowsPressed &= ~8; + break; + case VK_LEFT: + arrowsPressed &= ~1; + break; + case VK_RIGHT: + arrowsPressed &= ~2; + break; + } + if (msg.message == WM_KEYDOWN) { + // any key + switch (msg.wParam) { + case VK_MENU: + /*x_message("Alt"); */ + altPressed = 1; + break; + case VK_UP: + *c = UIKEY_UP; + arrowsPressed |= 4; + break; + case VK_DOWN: + *c = UIKEY_DOWN; + arrowsPressed |= 8; + break; + case VK_LEFT: + *c = UIKEY_LEFT; + arrowsPressed |= 1; + break; + case VK_RIGHT: + *c = UIKEY_RIGHT; + arrowsPressed |= 2; + break; + case VK_ESCAPE: + *c = UIKEY_ESC; + break; + case VK_BACK: + *c = UIKEY_BACKSPACE; + break; + case VK_TAB: + *c = UIKEY_TAB; + break; + case VK_HOME: + *c = UIKEY_HOME; + break; + case VK_END: + *c = UIKEY_END; + break; + case VK_PRIOR: + *c = UIKEY_PGUP; + break; + case VK_NEXT: + *c = UIKEY_PGDOWN; + break; +#ifdef DDRAW_DRIVER + case VK_RETURN: + /*x_message("Enter %i",altPressed); */ + if (altPressed) { + HDC hDC; + CONST char *cmd; + CONST menuitem *item; + if (directX == DXFULLSCREEN) { + int depth; + cmd = "dX-windowed"; + hDC = CreateDC("DISPLAY", NULL, NULL, NULL); + depth = GetDeviceCaps(hDC, BITSPIXEL); + DeleteDC(hDC); + if (!DXSUPPORTEDDEPTH(0, depth)) + cmd = "win32"; + } else { + cmd = "dX-fullscreen"; + } + item = menu_findcommand(cmd); + ui_menuactivate(item, NULL); + } + break; +#endif + } + } + // forward messages to window + TranslateMessage(&msg); + DispatchMessage(&msg); + } + getmouse(mx, my, mb); // get mouse position + + *k = arrowsPressed; + + if (closeFlag) + *c = -2; // force quit if so requested + +} + +// calculate BITMAPINFO structure. It is used to copy bitmaps +static void CalculateBITMAPINFO() +{ + int i; + if (!bmp) + bmp = (BITMAPINFO *) malloc(sizeof(BITMAPINFOHEADER) + 4 * 256); + + memset(bmp, 0, sizeof(BITMAPINFOHEADER)); + bmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmp->bmiHeader.biWidth = displayX; + bmp->bmiHeader.biHeight = -displayY; + bmp->bmiHeader.biPlanes = 1; + bmp->bmiHeader.biBitCount = bitDepth; + + // create default palette + for (i = 0; i < 256; i++) { + bmp->bmiColors[i].rgbRed = i; + bmp->bmiColors[i].rgbGreen = i; + bmp->bmiColors[i].rgbBlue = i; + } +} + +#ifdef DDRAW_DRIVER + +/************************************************************************************** + DirectDraw driver helper routines + */ +static char *resstr[MAXRESOLUTIONS]; +static struct resolutions { + int width, height; +} ressize[MAXRESOLUTIONS]; +static int nresolutions; +/* callback for DirectX resolutions */ +static HRESULT WINAPI +EnumModesCallback(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) +{ + if (nresolutions < MAXRESOLUTIONS) + if (lpDDSurfaceDesc->ddpfPixelFormat.u1.dwRGBBitCount == 8 || + lpDDSurfaceDesc->ddpfPixelFormat.u1.dwRGBBitCount == 16 || + lpDDSurfaceDesc->ddpfPixelFormat.u1.dwRGBBitCount == 24 || + lpDDSurfaceDesc->ddpfPixelFormat.u1.dwRGBBitCount == 32) { + int i; + char s[20]; + for (i = 0; i < nresolutions; i++) + if ((int) ressize[i].width == + (int) lpDDSurfaceDesc->dwWidth + && (int) ressize[i].height == + (int) lpDDSurfaceDesc->dwHeight) + return DDENUMRET_OK; + ressize[nresolutions].width = lpDDSurfaceDesc->dwWidth; + ressize[nresolutions].height = lpDDSurfaceDesc->dwHeight; + sprintf(s, "%ix%i", lpDDSurfaceDesc->dwWidth, + lpDDSurfaceDesc->dwHeight); + resstr[nresolutions] = strdup(s); + nresolutions++; + } + return DDENUMRET_OK; +} + +typedef HRESULT WINAPI(*ddrawcreateptr) (GUID FAR * lpGUID, + LPDIRECTDRAW FAR * lplpDD, + IUnknown FAR * pUnkOuter); +static ddrawcreateptr DirectDrawCreatePtr; + +static int ResizeDD(int fullscreen) +{ + HRESULT ddrval; + DDSURFACEDESC ddsd; + /*DDCAPS2 ddscaps; */ + LPDIRECTDRAWCLIPPER pClipper; + int dxwidth; + int dxheight; + int dxbpp; + + // free DirectX objects + if (lpSurfaces[0]) + IDirectDrawSurface_Release(lpSurfaces[0]); + lpSurfaces[0] = NULL; + if (dxPalette) + IDirectDrawPalette_Release(dxPalette); + dxPalette = NULL; + /* Set cooperative level */ + ddrval = IDirectDraw2_SetCooperativeLevel(lpDD2, hWnd, + fullscreen + ? (DDSCL_FULLSCREEN | + DDSCL_EXCLUSIVE | + DDSCL_ALLOWREBOOT) + : DDSCL_NORMAL); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to set cooperative level"); + return 0; + } + + if (fullscreen) { + if (sscanf(dxsize, "%ix%ix%i", &dxwidth, &dxheight, &dxbpp) != 3) { + dxwidth = DXWIDTH; + dxheight = DXHEIGHT; + dxbpp = DXBPP; + } + displayX = dxwidth; + displayY = dxheight; + bitDepth = dxbpp; + if (bitDepth < 10) + bitDepth = 8; + if (bitDepth >= 10 && bitDepth < 20) + bitDepth = 16; + if (bitDepth >= 20 && bitDepth < 28) + bitDepth = 24; + if (bitDepth >= 32 && bitDepth < 32) + bitDepth = 32; + + /* set resolution and bit depth */ + ddrval = + IDirectDraw2_SetDisplayMode(lpDD2, displayX, displayY, + bitDepth, 0, 0); + if (ddrval != DD_OK) { + /* The display mode cannot be changed. + The mode is either not supported or + another application has exclusive mode. + + Try 320x200x256 and 640x480x256 modes before giving up */ + displayX = 320; + displayY = 200; + bitDepth = 8; + ddrval = + IDirectDraw2_SetDisplayMode(lpDD2, displayX, displayY, + bitDepth, 0, 0); + if (ddrval != DD_OK) { + displayY = 240; + if (ddrval != DD_OK) { + displayX = 640; + displayY = 480; + ddrval = + IDirectDraw2_SetDisplayMode(lpDD2, displayX, + displayY, bitDepth, 0, + 0); + if (ddrval != DD_OK) { + /* Bad luck... give up. */ + DeInitDD(); + return 0; + } + } + } + } + SetRect(&rcViewport, 0, 0, displayX, displayY); + rcScreen = rcViewport; + } else { + /* Get the dimensions of the viewport and screen bounds */ + GetClientRect(hWnd, &rcViewport); + GetClientRect(hWnd, &rcScreen); + ClientToScreen(hWnd, (POINT *) & rcScreen.left); + ClientToScreen(hWnd, (POINT *) & rcScreen.right); + /*bitDepth = GetDeviceCaps (hDC, BITSPIXEL); */ + + /* Create clipper object for window */ + ddrval = IDirectDraw_CreateClipper(lpDD, 0, &pClipper, NULL); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to create clipper object"); + return 0; + } + /* Asociate it */ + IDirectDrawClipper_SetHWnd(pClipper, 0, hWnd); + } + /* Create the primary surface with one back buffer */ + CalculateBITMAPINFO(); // calculate BITMAPINFO structure + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + ddrval = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpSurfaces[0], NULL); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to create flipping surface"); + return 0; + } + + if (!fullscreen) { + IDirectDrawSurface_SetClipper(lpSurfaces[0], pClipper); + IDirectDrawClipper_Release(pClipper); + if (IDirectDrawSurface_GetSurfaceDesc(lpSurfaces[0], &ddsd) != + DD_OK) { + DeInitDD(); + x_error("Failed to get pixel format"); + return 0; + } + bitDepth = ddsd.ddpfPixelFormat.u1.dwRGBBitCount; + } + + if (bitDepth == 8) { + /* create palette */ + ddrval = + IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT, + (LPPALETTEENTRY) bmp->bmiColors, + &dxPalette, NULL); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to create palette"); + return 0; + } + + /* set palette */ + IDirectDrawSurface_SetPalette(lpSurfaces[0], dxPalette); + } + if (fullscreen) + SetCursor(NULL); + needredraw = 1; + return 1; + +} + +/* init DirectX */ +static int InitDD(int fullscreen) +{ + HRESULT ddrval; + HDC hDC; + directX = fullscreen ? DXFULLSCREEN : DXWINDOWED; + + if (!hModule) + hModule = LoadLibrary("ddraw"); + if (!hModule) { + /*x_error ("Unable to load DirectX (ddraw.dll)"); */ + return 0; + } + /* DirectDraw don't support 16 color modes. Don't even try to initialize + it then. Also avoid unsupported bit depths in the windowed driver */ + hDC = CreateDC("DISPLAY", NULL, NULL, NULL); + bitDepth = GetDeviceCaps(hDC, BITSPIXEL); + DeleteDC(hDC); + + if (!DXSUPPORTEDDEPTH(fullscreen, bitDepth)) + return 0; + + + DirectDrawCreatePtr = + (ddrawcreateptr) GetProcAddress(hModule, "DirectDrawCreate"); + if (!DirectDrawCreatePtr) { + x_error + ("Unable to get hook DirectDrawCreate in ddraw.dll. Check your DirectX installation"); + return 0; + } + + lpDD = NULL; + lpDD2 = NULL; + lpSurfaces[0] = NULL; + lpSurfaces[1] = NULL; + buffer1 = buffer2 = NULL; + + bitDepth = 8; + + InitWindow(); + UpdateWindow(hWnd); + SetFocus(hWnd); + + + /* contact DirectX */ + ddrval = DirectDrawCreatePtr(NULL, &lpDD, NULL); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to create DirectDraw object"); + return 0; + } + + /* get IDirectDraw2 interface */ + ddrval = + IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, + (LPVOID *) & lpDD2); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to get DirectDraw2 object"); + return 0; + } + /* enumerate modes */ +#ifdef DDRAW_DRIVER + if (!nresolutions && directX == DXFULLSCREEN) + IDirectDraw2_EnumDisplayModes(lpDD2, 0, NULL, NULL, + EnumModesCallback); +#endif + + + if (!ResizeDD(fullscreen)) + return 0; + if (fullscreen) { + SetCapture(hWnd); // make sure no other windows get mouse messages + + captured = 1; + } + + return 1; +} + +/* uninitialize DirectX */ +static void DeInitDD(void) +{ + if (captured) + ReleaseCapture(), captured = 0; // free mouse + + // free DirectX objects + if (lpSurfaces[0]) + IDirectDrawSurface_Release(lpSurfaces[0]); + lpSurfaces[0] = NULL; + if (BackSurface[0]) + IDirectDrawSurface_Release(BackSurface[0]); + BackSurface[0] = NULL; + if (BackSurface[1]) + IDirectDrawSurface_Release(BackSurface[1]); + BackSurface[1] = NULL; + if (dxPalette) + IDirectDrawPalette_Release(dxPalette); + dxPalette = NULL; + if (lpDD2) + IDirectDraw2_Release(lpDD2); + lpDD2 = NULL; + if (lpDD) + IDirectDraw_Release(lpDD); + lpDD = NULL; + DeInitWindow(); + if (hModule != NULL) + FreeLibrary(hModule), hModule = NULL; + hWnd = NULL; + directX = 0; +} + +static LRESULT CALLBACK WindowProc(HWND hwnd, // handle to window + UINT uMsg, // message identifier + WPARAM wParam, // first message parameter + LPARAM lParam // second message parameter + ); +static void UpdateMouseDD() +{ + DDSURFACEDESC m_surface; + PUCHAR dst; + DWORD ddrval; + memset(&m_surface, 0, sizeof(DDSURFACEDESC)); + m_surface.dwSize = sizeof(DDSURFACEDESC); + ddrval = IDirectDrawSurface_Lock(lpSurfaces[0], NULL, &m_surface, + DDLOCK_WAIT, NULL); + if (ddrval != DD_OK) { + return; + } + + dst = (PUCHAR) m_surface.lpSurface; + if (storeddata) { + restore(dst, storeddata, bitDepth, m_surface.u1.lPitch, displayX, + displayY, oldmouseX, oldmouseY); + free(storeddata); + } + storeddata = + store(dst, bitDepth, m_surface.u1.lPitch, displayX, displayY, + mouseX, mouseY); + drawmouse(dst, mousepointer, bitDepth, m_surface.u1.lPitch, displayX, + displayY, mouseX, mouseY); + oldmouseX = mouseX; + oldmouseY = mouseY; + IDirectDrawSurface_Unlock(lpSurfaces[0], m_surface.lpSurface); +} + +/* Display buffer */ +static void PaintDD() +{ + DWORD ddrval; + if (!IsWindowVisible(hWnd) || !active || !initialized + || !BackSurface[0]) + return; + IDirectDrawSurface_Unlock(BackSurface[0], surface[0].lpSurface); + IDirectDrawSurface_Unlock(BackSurface[1], surface[1].lpSurface); + if (directX == DXFULLSCREEN) { + if (storeddata) + free(storeddata), storeddata = NULL; + storeddata = + store(currentbuff ? buffer2 : buffer1, bitDepth, lineSize, + displayX, displayY, mouseX, mouseY); + drawmouse(currentbuff ? buffer2 : buffer1, mousepointer, bitDepth, + lineSize, displayX, displayY, mouseX, mouseY); + ddrval = + IDirectDrawSurface_BltFast(lpSurfaces[0], 0, 0, + BackSurface[currentbuff], &rcScreen, + FALSE); + restore(currentbuff ? buffer2 : buffer1, storeddata, bitDepth, + lineSize, displayX, displayY, mouseX, mouseY); + oldmouseX = mouseX; + oldmouseY = mouseY; + } else { + ddrval = IDirectDrawSurface_Blt(lpSurfaces[0], &rcScreen, + BackSurface[currentbuff], + &rcViewport, DDBLT_WAIT, NULL); + } + if (ddrval != DD_OK) { + if ((int) ddrval == (int) DDERR_SURFACELOST) { + IDirectDrawSurface_Restore(lpSurfaces[0]); + IDirectDrawSurface_Restore(BackSurface[0]); + IDirectDrawSurface_Restore(BackSurface[1]); + ddrval = IDirectDrawSurface_Blt(lpSurfaces[0], &rcScreen, + BackSurface[currentbuff], + &rcViewport, DDBLT_WAIT, NULL); + //if (ddrval == DDERR_SURFACELOST) resized=1; /*We've lost our fractal*/ + } + } + ddrval = IDirectDrawSurface_Lock(BackSurface[0], NULL, &surface[0], + DDLOCK_WAIT, NULL); + ddrval = IDirectDrawSurface_Lock(BackSurface[1], NULL, &surface[1], + DDLOCK_WAIT, NULL); + if (buffer1 != (char *) surface[0].lpSurface || + buffer2 != (char *) surface[1].lpSurface) { + DeInitDD(); + x_fatalerror + ("Unexpected event - buffers moved! Please contact authors!"); + } + needredraw = 0; + +} +#endif + +/************************************************************************************** + Drivers implementation + */ + + + +static void flip_buffers(void) +{ + currentbuff ^= 1; +} + + +static void processevents(int wait, int *mx, int *my, int *mb, int *k) +{ + int c = -1; + *mb = 0; + *k = 0; + Processevents(wait, mx, my, mb, k, &c); + if (c > -1) { + ui_key(c); + } + + if (c == -2) + ui_quit(); // -2 signals program exit + + if (resized) { + ui_resize(); // tell Xaos to resize + + } +} + +static void print(int x, int y, CONST char *text) +{ + HDC hDC; + static char current[256]; + char s[256]; +#ifdef DDRAW_DRIVER + if (directX == DXFULLSCREEN) { + HGLOBAL oldFont; + if (IDirectDrawSurface_GetDC(lpSurfaces[0], &hDC) != DD_OK) + return; + SetTextColor(hDC, 0xffffff); + SetBkColor(hDC, 0x000000); + oldFont = SelectObject(hDC, hFont); + ExtTextOut(hDC, x, y, 0, NULL, text, strlen(text), NULL); + SelectObject(hDC, oldFont); + IDirectDrawSurface_ReleaseDC(lpSurfaces[0], hDC); + return; + } +#endif + if (!text[0]) + strcpy(s, "XaoS"); + else + sprintf(s, "XaoS - %s", text); + if (strcmp(current, s)) + strcpy(current, s), SetWindowText(hWnd, s); +} + +static void mousetype(int type) +{ + char *cursor; + switch (type) { + default: + case 0: + cursor = IDC_ARROW; + break; + case 1: + cursor = IDC_WAIT; + break; + case 2: + cursor = IDC_NO; + break; + } + SetCursor(LoadCursor(NULL, cursor)); +} + +static void set_palette(ui_palette pal1, int start, int end) +{ + PUCHAR pal = (PUCHAR) pal1; + HDC hDC; + int i; + // store new palette entries locally + memcpy(backpalette + 4 * start, pal, (end - start) * 4); + for (i = start; i <= end; i++) { + bmp->bmiColors[i].rgbRed = *(pal + 4 * (i - start) + 0); + bmp->bmiColors[i].rgbGreen = *(pal + 4 * (i - start) + 1); + bmp->bmiColors[i].rgbBlue = *(pal + 4 * (i - start) + 2); + bmp->bmiColors[i].rgbReserved = 0; + } + // update window/screen +#ifdef DDRAW_DRIVER + if (directX) { + IDirectDrawPalette_SetEntries(dxPalette, 0, start, end - start + 1, + (PALETTEENTRY *) pal); + } else +#endif + { + SetPaletteEntries(hPalette, start, end - start + 1, + (PALETTEENTRY *) pal); + hDC = GetDC(hWnd); + UnrealizeObject(hPalette); + RealizePalette(hDC); + ReleaseDC(hWnd, hDC); + win32_display(); + } +} + +static void win32_copy(struct uih_context *uih) +{ + char *c = ui_getpos(); + HANDLE hData = GlobalAlloc(GMEM_DDESHARE, strlen(c) + 1); + char *data; + if (!hData) { + x_error("Out of memory"); + free(c); + return; + } + if (!(data = GlobalLock(hData))) { + x_error("Out of memory"); + free(c); + return; + } + memcpy(hData, c, strlen(c) + 1); + GlobalUnlock(hData); + if (OpenClipboard(hWnd)) { + EmptyClipboard(); + SetClipboardData(clipboard_format, hData); + } + free(c); +} + +static void win32_paste(void) +{ + if (OpenClipboard(hWnd)) { + HANDLE hClipData; + char *text; + if (!(hClipData = GetClipboardData(clipboard_format))) { + CloseClipboard(); + return; + } + if (!(text = GlobalLock(hClipData))) { + x_error("Out of memory"); + CloseClipboard(); + } + ui_loadstr(strdup(text)); + GlobalUnlock(hClipData); + CloseClipboard(); + } +} + +#define MAX_MENUITEMS_I18N 7 +static menuitem menuitems_i18n[MAX_MENUITEMS_I18N]; + +int uiw_no_menuitems_i18n, uiw_no_cutpasteitems_i18n; + +static menuitem *cutpasteitems; +static void add_cutpasteitems() +{ + // General method (not needed currently): + int no_menuitems_i18n = uiw_no_menuitems_i18n; /* This variable must be local. */ + MENUSEPARATOR_I("edit"); + MENUNOP_I("edit", NULL, gettext("Copy"), "copy", 0, win32_copy); + MENUNOP_I("edit", NULL, gettext("Paste"), "paste", 0, win32_paste); + MENUNOP_I("misc", NULL, "Generate .dlg files", "genresources", 0, + win32_genresources); + MENUSEPARATOR_I("helpmenu"); + MENUNOP_I("helpmenu", NULL, gettext("About"), "about", 0, AboutBox); + no_menuitems_i18n -= uiw_no_menuitems_i18n; + cutpasteitems = &(menuitems_i18n[uiw_no_menuitems_i18n]); + uiw_no_cutpasteitems_i18n = no_menuitems_i18n; + menu_add(cutpasteitems, uiw_no_cutpasteitems_i18n); + uiw_no_menuitems_i18n += no_menuitems_i18n; + +} + + +static int win32_init(void) +{ + int r; + +#ifdef DDRAW_DRIVER + directX = 0; +#endif + r = Init(); + if (!r) + return r; + win32_driver.textwidth = fontWidth; + win32_driver.textheight = fontHeight; + getres(&win32_driver.width, &win32_driver.height); + win32_createrootmenu(); + uiw_no_menuitems_i18n = 0; + add_cutpasteitems(); + return r; +} + +static void win32_uninitialize(void) +{ + DeInitWindow(); + menu_delete(cutpasteitems, uiw_no_cutpasteitems_i18n); +} + +static void win32_getsize(int *width, int *height) +{ + resized = 0; + *width = displayX; + *height = displayY; + switch (bitDepth) { + case 8: + win32_driver.imagetype = UI_C256; + break; + case 16: + /* Windows seems to always use 15bpp mode */ + win32_driver.imagetype = UI_TRUECOLOR16; + win32_driver.rmask = 31 * 32 * 32; + win32_driver.gmask = 31 * 32; + win32_driver.bmask = 31; + break; + case 24: + win32_driver.imagetype = UI_TRUECOLOR24; + win32_driver.rmask = 0xff0000; + win32_driver.gmask = 0x00ff00; + win32_driver.bmask = 0x0000ff; + break; + case 32: + win32_driver.imagetype = UI_TRUECOLOR; + win32_driver.rmask = 0xff0000; + win32_driver.gmask = 0x00ff00; + win32_driver.bmask = 0x0000ff; + break; + } + CalculateBITMAPINFO(); +} + + + +static void win32_display() +{ + HDC hDC = GetDC(hWnd); + if (IsWindowVisible(hWnd)) + Paint(hDC); + ReleaseDC(hWnd, hDC); +} + +static int win32_alloc_buffers(char **b1, char **b2) +{ + currentbuff = 0; + // calculate DWORD aligned line length + lineSize = displayX * ((bitDepth + 7) / 8); + lineSize += 3 - ((lineSize - 1) & 3); + + buffer1 = (char *) malloc(displayY * lineSize); + buffer2 = (char *) malloc(displayY * lineSize); + *b1 = buffer1; + *b2 = buffer2; + initialized = 1; + return lineSize; +} + +static void win32_free_buffers(char *b1, char *b2) +{ + initialized = 0; + free(buffer1); + free(buffer2); + buffer1 = buffer2 = NULL; +} + +static CONST char *CONST dx_depth[] = { "8bpp (256 colors)", + "16bpp (65536 colors)", + "24bpp (16777216 colors)", + "32bpp (16777216 colors)", + NULL +}; + +#ifdef DDRAW_DRIVER +static menudialog dx_resdialog[] = { + DIALOGCHOICE("Resolution", resstr, 0), + DIALOGCHOICE("Depth", dx_depth, 0), + {NULL} +}; + +static menudialog *dx_resizedialog(struct uih_context *c) +{ + int i; + switch (bitDepth) { + case 8: + dx_resdialog[1].defint = 0; + break; + case 16: + dx_resdialog[1].defint = 1; + break; + case 24: + dx_resdialog[1].defint = 2; + break; + case 32: + dx_resdialog[1].defint = 3; + } + for (i = 0; i < MAXRESOLUTIONS; i++) + if (displayX == ressize[i].width && displayY == ressize[i].height) { + dx_resdialog[0].defint = i; + break; + } + return dx_resdialog; +} + +static void dx_resize(struct uih_context *c, dialogparam * p) +{ + static char s[10]; + CONST static char *CONST st[] = { "8", "16", "24", "32" }; + sprintf(s, "%sx%s", resstr[p[0].dint], st[p[1].dint]); + dxsize = s; + resized = 1; + ui_call_resize(); +} + +int uiw_no_resizeitems_i18n; + +static menuitem *resizeitems; + +static void add_resizeitems() +{ + // General method, it's needed: + int no_menuitems_i18n = uiw_no_menuitems_i18n; /* This variable must be local. */ + MENUCDIALOG_I("ui", "=", gettext("Resize"), "resize", 0, dx_resize, + dx_resizedialog); + no_menuitems_i18n -= uiw_no_menuitems_i18n; + resizeitems = &(menuitems_i18n[uiw_no_menuitems_i18n]); + uiw_no_resizeitems_i18n = no_menuitems_i18n; + menu_add(resizeitems, uiw_no_resizeitems_i18n); + uiw_no_menuitems_i18n += no_menuitems_i18n; + +} + + +static int dx_alloc_buffers(char **b1, char **b2) +{ + DWORD ddrval; + DDSURFACEDESC ddsd; + int i; + currentbuff = 0; + memset(surface, 0, sizeof(DDSURFACEDESC) * 2); + memset(&ddsd, 0, sizeof(DDSURFACEDESC)); + ddsd.dwSize = sizeof(ddsd); + if (IDirectDrawSurface_GetSurfaceDesc(lpSurfaces[0], &ddsd) != DD_OK) { + DeInitDD(); + x_error("Failed to get pixel format"); + return 0; + } + for (i = 0; i < 2; i++) { + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; + ddsd.dwWidth = displayX; + ddsd.dwHeight = displayY; + ddsd.ddsCaps.dwCaps = + DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + + ddrval = + IDirectDraw_CreateSurface(lpDD, &ddsd, &BackSurface[i], NULL); + if (ddrval != DD_OK) { + DeInitDD(); + x_error("Failed to create back surface"); + return 0; + } + } + for (i = 0; i < 2; i++) { + surface[i].dwSize = sizeof(DDSURFACEDESC); + ddrval = IDirectDrawSurface_Lock(BackSurface[i], NULL, surface + i, + DDLOCK_WAIT, NULL); + if (ddrval != DD_OK) { + DeInitDD(); + x_fatalerror("Failed to lock offscreen surfaces"); + } + } + buffer1 = *b1 = (char *) surface[0].lpSurface; + buffer2 = *b2 = (char *) surface[1].lpSurface; + lineSize = surface[0].u1.lPitch; + initialized = 1; + return lineSize; +} + +static void dx_free_buffers(char *b1, char *b2) +{ + IDirectDrawSurface_Unlock(BackSurface[0], surface[0].lpSurface); + IDirectDrawSurface_Unlock(BackSurface[1], surface[1].lpSurface); + if (BackSurface[0]) + IDirectDrawSurface_Release(BackSurface[0]); + if (BackSurface[1]) + IDirectDrawSurface_Release(BackSurface[1]); + BackSurface[0] = NULL; + BackSurface[1] = NULL; + initialized = 0; + buffer1 = buffer2 = NULL; +} + +static int dx_imgparams(void) +{ + DDSURFACEDESC s; + memset(&s, 0, sizeof(s)); + s.dwSize = sizeof(s); + if (IDirectDrawSurface_GetSurfaceDesc(lpSurfaces[0], &s) != DD_OK) { + DeInitDD(); + x_error("Failed to get pixel format"); + return 0; + } + switch (s.ddpfPixelFormat.u1.dwRGBBitCount) { + case 8: + dxw_driver.imagetype = UI_C256; + dxf_driver.imagetype = UI_C256; + break; + case 16: + case 15: + dxw_driver.imagetype = UI_TRUECOLOR16; + dxf_driver.imagetype = UI_TRUECOLOR16; + break; + case 24: + dxw_driver.imagetype = UI_TRUECOLOR24; + dxf_driver.imagetype = UI_TRUECOLOR24; + break; + case 32: + dxw_driver.imagetype = UI_TRUECOLOR; + dxf_driver.imagetype = UI_TRUECOLOR; + break; + default: + x_fatalerror + ("Unsupported bit depth! Only 8bpp, 16bpp, 24bpp and 32bpp modes supported\n"); + return 0; + } + dxw_driver.rmask = s.ddpfPixelFormat.u2.dwRBitMask; + dxw_driver.gmask = s.ddpfPixelFormat.u3.dwGBitMask; + dxw_driver.bmask = s.ddpfPixelFormat.u4.dwBBitMask; + dxf_driver.rmask = s.ddpfPixelFormat.u2.dwRBitMask; + dxf_driver.gmask = s.ddpfPixelFormat.u3.dwGBitMask; + dxf_driver.bmask = s.ddpfPixelFormat.u4.dwBBitMask; + dxf_driver.textwidth = fontWidth; + dxf_driver.textheight = fontHeight; + dxw_driver.textwidth = fontWidth; + dxw_driver.textheight = fontHeight; + return 1; +} + +static int dxw_init(void) +{ + int r; + + r = InitDD(0); + if (!r) + return r; + + if (!dx_imgparams()) + return 0; + win32_createrootmenu(); + getres(&dxw_driver.width, &dxw_driver.height); + uiw_no_menuitems_i18n = 0; + add_cutpasteitems(); + return r; +} + +static int dxf_init(void) +{ + int r; + + getdimens(&dxf_driver.width, &dxf_driver.height); + r = InitDD(1); + if (!r) + return r; + + if (!dx_imgparams()) + return 0; + uiw_no_menuitems_i18n = 0; + add_resizeitems(); + add_cutpasteitems(); + return r; +} + + + +static void dx_uninitialize(void) +{ + if (directX == DXFULLSCREEN) + menu_delete(resizeitems, uiw_no_resizeitems_i18n); + menu_delete(cutpasteitems, uiw_no_cutpasteitems_i18n); + DeInitDD(); +} + + + + +static void dx_getsize(int *width, int *height) +{ + if (resized) { + resized = 0; + if (!ResizeDD(directX == DXFULLSCREEN)) { + DeInitDD(); + x_fatalerror("Failed to resize"); + } + if (!dx_imgparams()) { + DeInitDD(); + x_fatalerror("Internal program error #34234"); + } + } + *width = displayX; + *height = displayY; + CalculateBITMAPINFO(); +} + +static void dx_mousetype(int type) +{ + switch (type) { + default: + case 0: + mousepointer = mouse_pointer_data; + break; + case 1: + mousepointer = wait_pointer_data; + break; + case 2: + mousepointer = replay_pointer_data; + break; + } + UpdateMouseDD(); +} +#endif + +void win32_help(struct uih_context *c, CONST char *name) +{ +#ifdef HTML_HELP + FILE *f; + char *n; + if (helpname == NULL) { + if (directX == DXFULLSCREEN) + ShowWindow(hWnd, SW_MINIMIZE); + n = xio_fixpath("\01\\help\\xaoshelp.chm"); + if ((f = fopen(n, "r"))) { + fclose(f); + } else { + free(n); + n = xio_fixpath("\01\\..\\help\\xaoshelp.chm"); + if ((f = fopen(n, "r"))) { + fclose(f); + } else + n = strdup("..\\help\\xaoshelp.chm"); + } + helpname = n; + } + HH_AKLINK link; + link.cbStruct = sizeof(HH_AKLINK) ; + link.fReserved = FALSE ; + link.pszKeywords = name ; + link.pszUrl = NULL ; + link.pszMsgText = NULL ; + link.pszMsgTitle = NULL ; + link.pszWindow = NULL ; + link.fIndexOnFail = TRUE ; + + if (!HtmlHelp(hWnd, helpname, HH_ALINK_LOOKUP, (DWORD) &link)) { + x_error("Could not display help for topic %s from file %s", name, helpname); + } +#else + x_error("Help support not included in this executable."); +#endif +} + + +static struct params params[] = { + {"", P_HELP, NULL, "Win32 driver options:"}, + {"-size", P_STRING, &size, + "Window size in format WIDTHxHEIGHT (320x200)"}, + {NULL, 0, NULL, NULL} +}; + +static struct params dxfparams[] = { + {"", P_HELP, NULL, "DirectX fullscreen driver options:"}, + {"-mode", P_STRING, &dxsize, + "Select preffered graphics mode in format WIDTHxHEIGHTxDEPTH (320x200x8)"}, + {NULL, 0, NULL, NULL} +}; + +static struct params dxwparams[] = { + {"", P_HELP, NULL, "DirectX windowed driver options:"}, + {"-size", P_STRING, &size, + "Window size in format WIDTHxHEIGHT (320x200)"}, + {NULL, 0, NULL, NULL} +}; + +extern int XaoS_main(int argc, char **argv); +int STDCALL +WinMain(HINSTANCE hInstance1, + HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + static char name0[256]; + static char *argv[256]; + int argc = 1; + int i; + + GetModuleFileName(hInstance1, name0, 256); + /* Allocate everything virtually - be on the safe side */ + argv[0] = strdup(name0); + lpCmdLine = strdup(lpCmdLine); + + for (i = 0; lpCmdLine[i]; i++) { + if (lpCmdLine[i] == ' ' || lpCmdLine[i] == '\t') + lpCmdLine[i] = 0; + else if (!i || !lpCmdLine[i - 1]) + argv[argc] = lpCmdLine + i, argc++; + } + + /* Attach to parent console if available so output will be visible */ + if (AttachConsole(ATTACH_PARENT_PROCESS)) { + /* make sure stdout is not already redirected before redefining */ + if (_fileno(stdout) == -1 || _get_osfhandle(fileno(stdout)) == -1) + freopen("CON", "w", stdout); + } + + hInstance = hInstance1; + return XaoS_main(argc, argv); +} + +static CONST struct gui_driver win32_gui_driver = { + win32_dorootmenu, + win32_enabledisable, + win32_menu, + win32_dialog, + win32_help +}; + +static CONST struct gui_driver win32_fullscreen_gui_driver = { + NULL, + NULL, + NULL, + NULL, + win32_help +}; + +struct ui_driver win32_driver = { + "win32", + win32_init, + win32_getsize, + processevents, + getmouse, + win32_uninitialize, + NULL, // win32_set_color, + set_palette, + print, + win32_display, + win32_alloc_buffers, + win32_free_buffers, + flip_buffers, + mousetype, + NULL, + 16 + 16, + 12, + params, + PIXELSIZE | UPDATE_AFTER_PALETTE, + 0.0, 0.0, + 0, 0, + UI_C256, + 0, 256, 255, + 0, 0, 0, + &win32_gui_driver +}; + +#ifdef DDRAW_DRIVER +struct ui_driver dxw_driver = { + "dX-window", + dxw_init, + dx_getsize, + processevents, + getmouse, + dx_uninitialize, + NULL, // dx_set_color, + set_palette, + print, + PaintDD, + dx_alloc_buffers, + dx_free_buffers, + flip_buffers, + mousetype, + NULL, + 16 + 16, + 12, + dxwparams, + PIXELSIZE, + 0.0, 0.0, + 0, 0, + UI_C256, + 0, 256, 255, + 0, 0, 0, + &win32_gui_driver +}; + +struct ui_driver dxf_driver = { + "dX-fullscreen", + dxf_init, + dx_getsize, + processevents, + getmouse, + dx_uninitialize, + NULL, // dx_set_color, + set_palette, + print, + PaintDD, + dx_alloc_buffers, + dx_free_buffers, + flip_buffers, + dx_mousetype, + NULL, + 16 + 16, + 12, + dxfparams, + FULLSCREEN | SCREENSIZE, + 0.0, 0.0, + 0, 0, + UI_C256, + 0, 256, 255, + 0, 0, 0, + &win32_fullscreen_gui_driver +}; +#endif + +void x_message(const char *text, ...) +{ + va_list ap; + char buf[4096]; + va_start(ap, text); + vsprintf(buf, text, ap); + if (directX == DXFULLSCREEN) + ShowWindow(hWnd, SW_MINIMIZE); + MessageBox(NULL, buf, "XaoS", MB_OK | MB_ICONINFORMATION); + va_end(ap); +} + +void x_error(const char *text, ...) +{ + va_list ap; + char buf[4096]; + va_start(ap, text); + vsprintf(buf, text, ap); + if (directX == DXFULLSCREEN) + ShowWindow(hWnd, SW_MINIMIZE); + MessageBox(NULL, buf, "XaoS have problem", MB_OK | MB_ICONEXCLAMATION); + va_end(ap); +} + +void x_fatalerror(const char *text, ...) +{ + va_list ap; + char buf[4096]; + va_start(ap, text); + vsprintf(buf, text, ap); + if (directX == DXFULLSCREEN) + ShowWindow(hWnd, SW_MINIMIZE); + MessageBox(NULL, buf, "Unrecovable XaoS error", MB_OK | MB_ICONSTOP); + va_end(ap); + exit(1); +} + + +#endif /* WIN32_DRIVER */ diff --git a/src/ui/ui-drv/win32/ui_win32.h b/src/ui/ui-drv/win32/ui_win32.h new file mode 100644 index 0000000..cd64526 --- /dev/null +++ b/src/ui/ui-drv/win32/ui_win32.h @@ -0,0 +1,20 @@ + +#ifndef UI_WIN32_H +#include <windows.h> +#include <ui.h> +extern int directX; +extern CONST char *helptopic; +extern HWND hWnd; +extern HINSTANCE hInstance; +HMENU win32_createrootmenu(void); +void win32_pressed(int id); +void win32_dorootmenu(struct uih_context *uih, CONST char *name); +void win32_enabledisable(struct uih_context *uih, CONST char *name); +void win32_menu(struct uih_context *c, CONST char *name); +void win32_uninitializewindows(void); +void win32_dialog(struct uih_context *uih, CONST char *name); +void win32_genresources(struct uih_context *uih); +void win32_help(struct uih_context *uih, CONST char *name); +void CenterWindow(HWND hwndChild, HWND hwndParent); +void AboutBox(void); +#endif diff --git a/src/ui/ui-drv/win32/version.rc b/src/ui/ui-drv/win32/version.rc new file mode 100644 index 0000000..2606338 --- /dev/null +++ b/src/ui/ui-drv/win32/version.rc @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+1 VERSIONINFO
+ FILEVERSION 3,5,0,0
+ PRODUCTVERSION 3,5,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "Brought to you by Jan Hubicka, Thomas Marsh and many others\0"
+ VALUE "CompanyName", "Free Software Foundation\0"
+ VALUE "FileDescription", "XaoS - a realtime fractal zoomer\0"
+ VALUE "FileVersion", "0.0\0"
+ VALUE "InternalName", "XaoS\0"
+ VALUE "LegalCopyright", "Copyright 1996-2008 Jan Hubicka, Thomas Marsh and many others. Many parts are copyrighted by their authors. See the source distribution\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "\0"
+ VALUE "ProductName", "XaoS\0"
+ VALUE "ProductVersion", "3.5\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 0x04E4, 0x411, 0x04E4
+ END
+END
diff --git a/src/ui/ui-drv/win32/windialo.c b/src/ui/ui-drv/win32/windialo.c new file mode 100644 index 0000000..dd0a9e6 --- /dev/null +++ b/src/ui/ui-drv/win32/windialo.c @@ -0,0 +1,471 @@ +#include <windows.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include <stdio.h> +#include <config.h> +/*#include <filter.h> + #include <ui_helper.h> */ +#include <xerror.h> +#include <xldio.h> +#include <ui.h> +#include <xmenu.h> +#include "ui_win32.h" + +#ifdef HAVE_GETTEXT +#include <libintl.h> +#else +#define gettext(STRING) STRING +#endif + +TCHAR text[100]; + +#define QUESTIONSTART 100 +#define ITEMSTART 10 +#define PERITEM 5 + +#define OK 1 +#define CANCEL 2 +#define HELP 3 + +static struct dialogrecord { + CONST menuitem *item; + CONST menudialog *dialog; + int nitems; + HWND windialog; + struct uih_context *c; + struct dialogrecord *next, *prev; +} *firstdialog = NULL; +static CONST char *win32_getextension(CONST char *ch) +{ + int i = 0; + while (ch[i]) { + if (ch[i] == '*') + return (ch + i + 1); + i++; + } + return ch + i; +} + +static char *win32_dofiledialog(struct uih_context *uih, + CONST menuitem * item, + CONST menudialog * dialog) +{ + OPENFILENAME ofn; + char szDirName[256]; + char szFile[256], szFileTitle[256]; + UINT i, p; + char szFilter[256]; + + helptopic = item->shortname; + szDirName[0] = 0; + /*GetSystemDirectory(szDirName, sizeof(szDirName)); */ + szFile[0] = 0; + if (dialog[0].type == DIALOG_OFILE) { + strcpy(szFile, dialog[0].defstr); + for (i = 0; dialog[0].defstr[i] && dialog[0].defstr[i] != '*'; + i++); + szFile[i] = 0; + strcpy(szFile, + ui_getfile(szFile, win32_getextension(dialog[0].defstr))); + } + + for (i = 0; dialog[0].defstr[i] && dialog[0].defstr[i] != '*'; i++) + if (!dialog[0].defstr[i]) + i = 0; + strcpy(szFilter, dialog[0].defstr + i); + p = strlen(szFilter); + strcpy(szFilter + p + 1, dialog[0].defstr + i); + p += strlen(szFilter + p + 1) + 1; + strcpy(szFilter + p + 1, "All files"); + p += strlen(szFilter + p + 1) + 1; + strcpy(szFilter + p + 1, "*.*"); + p += strlen(szFilter + p + 1) + 1; + szFilter[p + 1] = 0; + + memset(&ofn, 0, sizeof(OPENFILENAME)); + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hWnd; + ofn.lpstrFilter = szFilter; + ofn.nFilterIndex = 1; + ofn.lpstrFile = szFile; + ofn.nMaxFile = sizeof(szFile); + ofn.lpstrFileTitle = szFileTitle; + ofn.nMaxFileTitle = sizeof(szFileTitle); + ofn.lpstrInitialDir = szDirName; + ofn.Flags = + OFN_SHOWHELP | OFN_PATHMUSTEXIST | (dialog[0].type == + DIALOG_IFILE ? + OFN_FILEMUSTEXIST : + OFN_OVERWRITEPROMPT); + if (dialog[0].type == DIALOG_IFILE) + i = GetOpenFileName(&ofn); + else + i = GetSaveFileName(&ofn); + helptopic = "main"; + if (i) { + return (strdup(ofn.lpstrFile)); + } + return NULL; +} + + +static void +win32_filedialog(struct uih_context *uih, CONST menuitem * item, + CONST menudialog * dialog) +{ + char *name = win32_dofiledialog(uih, item, dialog); + if (name) { + dialogparam *param = malloc(sizeof(dialogparam)); + param->dstring = name; + ui_menuactivate(item, param); + } +} + +static void win32_freedialog(struct dialogrecord *r) +{ + if (r->next) + r->next->prev = r->prev; + if (r->prev) + r->prev->next = r->next; + else + firstdialog = r->next; + free(r); +} + +static int win32_dodialog(struct dialogrecord *r, HWND hDLG) +{ + dialogparam *p = calloc(sizeof(*p), r->nitems); + int i; + char s[256]; + for (i = 0; i < r->nitems; i++) { + switch (r->dialog[i].type) { + case DIALOG_IFILE: + case DIALOG_OFILE: + case DIALOG_STRING: + case DIALOG_KEYSTRING: + GetDlgItemText(hDLG, i * PERITEM + ITEMSTART, s, sizeof(s)); + p[i].dstring = strdup(s); + break; + case DIALOG_INT: + GetDlgItemText(hDLG, i * PERITEM + ITEMSTART, s, sizeof(s)); + p[i].dint = r->dialog[i].defint; + sscanf(s, "%i", &p[i].dint); + break; + case DIALOG_FLOAT: + GetDlgItemText(hDLG, i * PERITEM + ITEMSTART, s, sizeof(s)); + p[i].number = r->dialog[i].deffloat; + p[i].number = x_strtold(s, NULL); + break; + case DIALOG_COORD: + GetDlgItemText(hDLG, i * PERITEM + ITEMSTART, s, sizeof(s)); + p[i].dcoord[0] = r->dialog[i].deffloat; + p[i].dcoord[0] = x_strtold(s, NULL); + GetDlgItemText(hDLG, i * PERITEM + ITEMSTART + 1, s, + sizeof(s)); + p[i].dcoord[1] = r->dialog[i].deffloat2; + p[i].dcoord[1] = x_strtold(s, NULL); + break; + case DIALOG_CHOICE: + /*x_message("Choice is not implemented yet"); */ + { + int y; + y = LOWORD(SendDlgItemMessage + (hDLG, i * PERITEM + ITEMSTART, CB_GETCURSEL, 0, + 0L)); + p[i].dint = + LOWORD(SendDlgItemMessage + (hDLG, i * PERITEM + ITEMSTART, CB_GETITEMDATA, + (WPARAM) y, 0L)); + } + } + } + ui_menuactivate(r->item, p); + return 1; +} + +static BOOL APIENTRY +DialogHandler(HWND hDLG, UINT message, UINT wParam, LONG lParam) +{ + struct dialogrecord *rec = firstdialog; + int i; +/* while(rec->windialog!=hDLG) rec=rec->next; */ + if (!rec->windialog) + rec->windialog = hDLG; + switch (message) { + case WM_INITDIALOG: + /*x_message("Creating dialog"); */ + ShowWindow(hDLG, SW_HIDE); + /*CenterWindow (hDLG, GetWindow (hDLG, GW_OWNER)); */ + if (GetWindowText(hDLG, text, GetWindowTextLength(hDLG) + 1) > 0); + SetWindowText(hDLG, gettext(text)); + SetDlgItemText(hDLG, OK, gettext("OK")); + SetDlgItemText(hDLG, CANCEL, gettext("Cancel")); + SetDlgItemText(hDLG, HELP, gettext("Help")); + for (i = 0; rec->dialog[i].question; i++) { + if (GetDlgItemText + (hDLG, i * PERITEM + QUESTIONSTART, text, 100) > 0) + SetDlgItemText(hDLG, i * PERITEM + QUESTIONSTART, + gettext(text)); + switch (rec->dialog[i].type) { + char s[256]; + case DIALOG_STRING: + case DIALOG_IFILE: + case DIALOG_OFILE: + SetDlgItemText(hDLG, i * PERITEM + ITEMSTART, + rec->dialog[i].defstr); + break; + case DIALOG_INT: + sprintf(s, "%i", rec->dialog[i].defint); + SetDlgItemText(hDLG, i * PERITEM + ITEMSTART, s); + break; + case DIALOG_COORD: + sprintf(s, "%g", (double) rec->dialog[i].deffloat2); + SetDlgItemText(hDLG, i * PERITEM + ITEMSTART + 1, s); + /*Fall trought */ + case DIALOG_FLOAT: + sprintf(s, "%g", (double) rec->dialog[i].deffloat); + SetDlgItemText(hDLG, i * PERITEM + ITEMSTART, s); + break; + case DIALOG_CHOICE: + { + CONST char **strings = + (CONST char **) rec->dialog[i].defstr; + int y; + int pos; + for (y = 0; strings[y]; y++) { + pos = + LOWORD(SendDlgItemMessage + (hDLG, i * PERITEM + ITEMSTART, + CB_ADDSTRING, (WPARAM) 0, + (LPARAM) (LPSTR) strings[y])); + /*x_message("%s %i",strings[y],pos); */ + SendMessage(GetDlgItem + (hDLG, i * PERITEM + ITEMSTART), + CB_SETITEMDATA, (WPARAM) pos, y); + if (y == rec->dialog[i].defint) { + pos = + SendMessage(GetDlgItem + (hDLG, + i * PERITEM + ITEMSTART), + CB_SETCURSEL, (WPARAM) pos, + 0L); + /*x_message("Default %i",pos); */ + } + } + pos = + LOWORD(SendDlgItemMessage + (hDLG, i * PERITEM + ITEMSTART, CB_GETCOUNT, + (WPARAM) 0, 0)); + /*x_message("Count %i",pos); */ + } + break; + } + } + CenterWindow(hDLG, GetWindow(hDLG, GW_OWNER)); + ShowWindow(hDLG, SW_SHOW); + return (TRUE); + case WM_SYSCOMMAND: + if (wParam == SC_CLOSE) { + EndDialog(hDLG, 0); + return (TRUE); + } + break; + case WM_COMMAND: + if (wParam == OK) { + if (win32_dodialog(rec, hDLG)) { + EndDialog(hDLG, 0); + return (TRUE); + } + } + if (wParam == CANCEL) { + EndDialog(hDLG, 0); + return (TRUE); + } + if (wParam == HELP) { + win32_help(rec->c, rec->item->shortname); + return (TRUE); + } + { + int i = (wParam - ITEMSTART) / PERITEM; + int pos = (wParam - ITEMSTART) % PERITEM; + if (i >= 0 && i < rec->nitems) { + if (pos == 1 + && (rec->dialog[i].type == DIALOG_IFILE + || rec->dialog[i].type == DIALOG_OFILE)) { + /*x_message("File dialog\n"); */ + char *file = + win32_dofiledialog(rec->c, rec->item, + rec->dialog + i); + if (file) { + SetDlgItemText(hDLG, wParam - 1, file); + free(file); + } + } + } + } + break; + } + return FALSE; +} + +#define INPUTSIZE 20 +#define XBORDER 0 +#define YBORDER 5 +#define XSEP 4 + +#define CHARWIDTH 4 +#define MINWIDTH ((7*3)*CHARWIDTH) +#define LINEHEIGHT 14 +#define TEXTHEIGHT 11 + +static FILE *file; +static void +win32_outputdialog(struct uih_context *uih, CONST struct menuitem *item) +{ + CONST menudialog *dialog; + int leftsize = 0; + int rightsize = 0; + int width, height; + int i; + rightsize = INPUTSIZE; + if (item->type != MENU_DIALOG && item->type != MENU_CUSTOMDIALOG) + return; + if (item->flags & MENUFLAG_NOMENU) + return; + dialog = menu_getdialog(uih, item); + for (i = 0; dialog[i].question; i++) { + if (leftsize < (int) strlen(dialog[i].question)) + leftsize = strlen(dialog[i].question); + } + if (i == 1 + && (dialog[0].type == DIALOG_IFILE + || dialog[0].type == DIALOG_OFILE)) + return; + leftsize = XBORDER + leftsize * CHARWIDTH + XSEP; + rightsize = XBORDER + rightsize * CHARWIDTH; + width = leftsize + rightsize; + if (width < MINWIDTH) + width = MINWIDTH; + height = 2 * YBORDER + (i + 1) * LINEHEIGHT; + fprintf(file, "%sBox DIALOG %i, %i, %i, %i\n", item->shortname, 52, + 57, width, height); + fprintf(file, "STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU\n"); + fprintf(file, "CAPTION \"%s\"\n", item->name); + fprintf(file, "FONT 8, \"MS Shell Dlg\"\n"); + fprintf(file, "BEGIN\n"); + for (i = 0; dialog[i].question; i++) { + fprintf(file, " RTEXT \"%s\", %i, %i, %i, %i, %i, WS_GROUP\n", + dialog[i].question, + i * PERITEM + QUESTIONSTART, + 0, YBORDER + i * LINEHEIGHT, leftsize - XSEP, TEXTHEIGHT); + switch (dialog[i].type) { + case DIALOG_INT: + case DIALOG_FLOAT: + case DIALOG_STRING: + case DIALOG_KEYSTRING: + fprintf(file, + " EDITTEXT %i, %i, %i, %i, %i, ES_AUTOHSCROLL | WS_TABSTOP\n", + i * PERITEM + ITEMSTART, leftsize, + i * LINEHEIGHT + YBORDER, rightsize - XSEP, + TEXTHEIGHT); + break; + case DIALOG_COORD: + fprintf(file, + " EDITTEXT %i, %i, %i, %i, %i, ES_AUTOHSCROLL | WS_TABSTOP\n", + i * PERITEM + ITEMSTART, leftsize, + i * LINEHEIGHT + YBORDER, + (rightsize - XSEP - 4 * CHARWIDTH) / 2, TEXTHEIGHT); + fprintf(file, + " EDITTEXT %i, %i, %i, %i, %i, ES_AUTOHSCROLL | WS_TABSTOP\n", + i * PERITEM + ITEMSTART + 1, + leftsize + (rightsize - XSEP + CHARWIDTH) / 2, + i * LINEHEIGHT + YBORDER, + (rightsize - XSEP - 4 * CHARWIDTH) / 2, TEXTHEIGHT); + fprintf(file, " RTEXT \"+\", -1, %i, %i, %i, %i\n", + leftsize + (rightsize - XSEP - 2 * CHARWIDTH) / 2, + YBORDER + i * LINEHEIGHT, CHARWIDTH, TEXTHEIGHT); + fprintf(file, " RTEXT \"i\", -1, %i, %i, %i, %i\n", + leftsize + rightsize - XSEP - CHARWIDTH, + YBORDER + i * LINEHEIGHT, CHARWIDTH, TEXTHEIGHT); + break; + case DIALOG_CHOICE: + fprintf(file, + " COMBOBOX %i, %i, %i, %i, %i, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\n", + i * PERITEM + ITEMSTART, leftsize, + i * LINEHEIGHT + YBORDER, rightsize - XSEP, + TEXTHEIGHT * 10); + break; + case DIALOG_IFILE: + case DIALOG_OFILE: +#define BROWSEWIDTH ((strlen("Browse")+1)*CHARWIDTH) + fprintf(file, + " EDITTEXT %i, %i, %i, %i, %i, ES_AUTOHSCROLL | WS_TABSTOP\n", + i * PERITEM + ITEMSTART, leftsize, + i * LINEHEIGHT + YBORDER, + rightsize - 2 * XSEP - BROWSEWIDTH, TEXTHEIGHT); + fprintf(file, + " PUSHBUTTON \"Browse\", %i, %i, %i, %i, %i, WS_GROUP\n", + i * PERITEM + ITEMSTART + 1, + leftsize + rightsize - XSEP - BROWSEWIDTH, + i * LINEHEIGHT + YBORDER, BROWSEWIDTH, TEXTHEIGHT); + break; + } + } + fprintf(file, + " DEFPUSHBUTTON \"&OK\", %i, %i, %i, %i, %i, WS_GROUP\n", OK, + XSEP / 2, i * LINEHEIGHT + YBORDER, width / 3 - XSEP, 14); + fprintf(file, " PUSHBUTTON \"&Cancel\", %i, %i, %i, %i, %i\n", CANCEL, + width / 3 + XSEP / 2, i * LINEHEIGHT + YBORDER, + width / 3 - XSEP, 14); + fprintf(file, " PUSHBUTTON \"&Help\", %i, %i, %i, %i, %i\n", HELP, + 2 * width / 3 + XSEP / 2, i * LINEHEIGHT + YBORDER, + width / 3 - XSEP, 14); + fprintf(file, "END\n"); +} + +void win32_genresources(struct uih_context *uih) +{ + file = fopen("xaos.dlg", "w"); + menu_forall(uih, win32_outputdialog); + fclose(file); + +} + +void win32_dialog(struct uih_context *uih, CONST char *name) +{ + CONST menuitem *item = menu_findcommand(name); + CONST menudialog *dialog; + int nitems; + char s[256]; + + if (!item) + return; + dialog = menu_getdialog(uih, item); + if (!dialog) + return; + for (nitems = 0; dialog[nitems].question; nitems++); + if (nitems == 1 + && (dialog[0].type == DIALOG_IFILE + || dialog[0].type == DIALOG_OFILE)) + win32_filedialog(uih, item, dialog); + else { + struct dialogrecord *r = calloc(sizeof(*r), 1); + r->next = firstdialog; + firstdialog = r; + r->prev = NULL; + r->item = item; + r->nitems = nitems; + r->dialog = dialog; + r->c = uih; + sprintf(s, "%sBox", item->shortname); + if (DialogBox(hInstance, s, hWnd, DialogHandler) == -1) { + /*r->windialog=CreateDialog (hInstance, s, hWnd, DialogHandler); + if(r->windialog==NULL) { */ + x_message("Failed to create dialog %s", item->shortname); + win32_freedialog(r); + } + win32_freedialog(r); + /*x_message("Dialog (%s %i %s) not implemented", name, nitems, dialog[0].question); */ + } +} diff --git a/src/ui/ui-drv/win32/winmenu.c b/src/ui/ui-drv/win32/winmenu.c new file mode 100644 index 0000000..d04f941 --- /dev/null +++ b/src/ui/ui-drv/win32/winmenu.c @@ -0,0 +1,243 @@ +#include <windows.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> +#include <config.h> +/*#include <filter.h> + #include <ui_helper.h> */ +#include <xerror.h> +#include <ui.h> +#include <xmenu.h> +#include "ui_win32.h" +#define IDMUL 64 +#define MAIN 0 +#define POPUP 1 +#define WSUBMENU 2 +struct menurecord { + int type; + int id; + struct uih_context *c; + CONST menuitem *item; + struct menurecord *nextrecord; + struct menurecord *prevrecord; + HMENU menu; + struct menurecord *submenu; + struct menurecord *nextsubmenu; +} *firstrecord; +struct menurecord rootmenu; + +static void win32_appendmenu(struct uih_context *c, + struct menurecord *menu); +HMENU win32_createrootmenu() +{ + /*printf("Createrootmenu\n"); */ + rootmenu.id = 0; + rootmenu.menu = CreateMenu(); + rootmenu.nextrecord = firstrecord; + rootmenu.prevrecord = NULL; + firstrecord = &rootmenu; + rootmenu.nextsubmenu = NULL; + rootmenu.submenu = NULL; + /*printf("Createrootmenu OK\n"); */ + return rootmenu.menu; +}; + +static struct menurecord *win32_createmenu(struct uih_context *c, + CONST char *name, int type) +{ + struct menurecord *m = calloc(sizeof(*m), 1); + static int id = 1; + /*printf("Createmenu %s\n",name); */ + m->id = id++; + m->type = type; + if (type != POPUP) + m->menu = CreateMenu(); + else + m->menu = CreatePopupMenu(); + m->c = c; + m->item = menu_findcommand(name); + m->nextrecord = firstrecord; + m->prevrecord = NULL; + firstrecord = m; + m->nextsubmenu = NULL; + m->submenu = NULL; + win32_appendmenu(c, m); + /*printf("Createmenu OK\n"); */ + return m; +}; + +static void +win32_appendmenu(struct uih_context *c, struct menurecord *menu) +{ + int i, y, hotkeyed; + CONST menuitem *item; + char out[256]; + char used[256]; + memset(used, 0, 256); + /*printf("Appendmenu %s\n",menu->item->shortname); */ + for (i = 0; (item = menu_item(menu->item->shortname, i)) != NULL; i++) { + struct menurecord *submenu = NULL; + int flags = MF_ENABLED | MF_STRING; + if (item->type == MENU_SEPARATOR) + flags |= MF_SEPARATOR; + if (item->type == MENU_SUBMENU) { + submenu = win32_createmenu(c, item->shortname, WSUBMENU); + flags |= MF_POPUP; + submenu->nextsubmenu = menu->submenu; + menu->submenu = submenu; + } + if (item->flags & (MENUFLAG_RADIO | MENUFLAG_CHECKBOX) && + menu_enabled(item, c)) + flags |= MF_CHECKED; + /*printf(" %s\n",item->name); */ + + hotkeyed = 0; + for (y = 0; item->name[y]; y++) { + if (!hotkeyed) { + unsigned char c = tolower(item->name[y]); + if (((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) + && !used[c]) + used[c] = 1, hotkeyed = 1, out[y] = '&'; + } + out[y + hotkeyed] = item->name[y]; + } + out[y + hotkeyed] = 0; + if (item->type == MENU_CUSTOMDIALOG || item->type == MENU_DIALOG) + strcat(out, "..."); + if (menu->type != MAIN && item->key) { + strcat(out, "\t"); + strcat(out, item->key); + } + AppendMenu(menu->menu, flags, + (submenu != + NULL ? (UINT) submenu->menu : (UINT) (menu->id * + IDMUL + i)), + out); + + } + /*printf("Appendmenu OK\n"); */ +} + +static void win32_freestructures(struct menurecord *menu) +{ + struct menurecord *sub, *nextsub; + /*printf("Freestructures\n"); */ + sub = menu->submenu; + while (sub != NULL) { + nextsub = sub->nextsubmenu; + win32_freestructures(sub); + sub = nextsub; + } + if (menu->nextrecord) + menu->nextrecord->prevrecord = menu->prevrecord; + if (menu->prevrecord) + menu->prevrecord->nextrecord = menu->nextrecord; + else + firstrecord = menu->nextrecord; + free(menu); +} + +void win32_pressed(int id) +{ + struct menurecord *menu = firstrecord; + /*printf("Pressed\n"); */ + while (menu) { + if (id / IDMUL == menu->id) { + ui_menuactivate(menu_item(menu->item->shortname, id % IDMUL), + NULL); + return; + } + menu = menu->nextrecord; + } + x_error("Unknown menu"); +} + +/* first destroy the old contents */ +void win32_dorootmenu(struct uih_context *uih, CONST char *name) +{ + struct menurecord *sub, *nextsub; + /*printf("dorootmenu %s\n",name); */ + /* Delete the old entries */ + while (DeleteMenu(rootmenu.menu, 0, MF_BYPOSITION)); + sub = rootmenu.submenu; + rootmenu.c = uih; + while (sub != NULL) { + nextsub = sub->nextsubmenu; + win32_freestructures(sub); + sub = nextsub; + } + rootmenu.item = menu_findcommand(name); + rootmenu.submenu = NULL; + win32_appendmenu(uih, &rootmenu); + SetMenu(hWnd, rootmenu.menu); + /*printf("OK\n"); */ +} + +/* Check all created menus to see if there is the changed item and do changes + as neccesary. + + This implementation is rather ugly and slow. Try if it is fast enought + and change it otherwise */ +void win32_enabledisable(struct uih_context *uih, CONST char *name) +{ + CONST struct menuitem *chgitem = menu_findcommand(name); + CONST struct menuitem *item; + struct menurecord *menu = firstrecord; + int i; + int checked = menu_enabled(chgitem, uih); + while (menu) { + if (menu->item != NULL) + for (i = 0; + (item = menu_item(menu->item->shortname, i)) != NULL; + i++) { + if (item == chgitem) { + if (chgitem->flags & MENUFLAG_RADIO && checked) { + int y; + for (y = 0; + (item = + menu_item(menu->item->shortname, y)) != NULL; + y++) + if (item->flags & MENUFLAG_RADIO) + CheckMenuItem(menu->menu, + menu->id * IDMUL + y, + MF_BYCOMMAND | MF_UNCHECKED); + } + CheckMenuItem(menu->menu, menu->id * IDMUL + i, + MF_BYCOMMAND | (checked ? MF_CHECKED : + MF_UNCHECKED)); + } + } + menu = menu->nextrecord; + } +} + +void win32_menu(struct uih_context *c, CONST char *name) +{ + + POINT p; + struct menurecord *m = firstrecord; + + /*Delete records about all popups, since they are closed now */ + while (m) { + if (m->type == POPUP) { + DestroyMenu(m->menu), win32_freestructures(m); + break; + } + m = m->nextrecord; + } + m = win32_createmenu(c, name, POPUP); + GetCursorPos(&p); + /*printf("menu %s %i %i\n",name,p.x,p.y); */ + TrackPopupMenu(m->menu, 0, p.x, p.y, 0, hWnd, 0); +} + +void win32_uninitializewindows() +{ + while (firstrecord) { + struct menurecord *r = firstrecord; + while (r->type == WSUBMENU) + r = r->nextrecord; + DestroyMenu(r->menu); + win32_freestructures(r); + } +} diff --git a/src/ui/ui-drv/win32/xaos.dlg b/src/ui/ui-drv/win32/xaos.dlg new file mode 100644 index 0000000..132a122 --- /dev/null +++ b/src/ui/ui-drv/win32/xaos.dlg @@ -0,0 +1,228 @@ +lettersBox DIALOG 52, 57, 160, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Letters per second"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Letters per second:", 100, 0, 5, 76, 11, WS_GROUP
+ EDITTEXT 10, 80, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 49, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 55, 19, 49, 14
+ PUSHBUTTON "&Help", 3, 108, 19, 49, 14
+END
+commandBox DIALOG 52, 57, 136, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Command"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Your command:", 100, 0, 5, 52, 11, WS_GROUP
+ EDITTEXT 10, 56, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 41, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 47, 19, 41, 14
+ PUSHBUTTON "&Help", 3, 92, 19, 41, 14
+END
+renderanimBox DIALOG 52, 57, 204, 192
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Render animation"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "File to render:", 100, 0, 5, 120, 11, WS_GROUP
+ EDITTEXT 10, 124, 5, 44, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ PUSHBUTTON "Browse", 11, 172, 5, 28, 11, WS_GROUP
+ RTEXT "Basename:", 105, 0, 19, 120, 11, WS_GROUP
+ EDITTEXT 15, 124, 19, 44, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ PUSHBUTTON "Browse", 16, 172, 19, 28, 11, WS_GROUP
+ RTEXT "Width:", 110, 0, 33, 120, 11, WS_GROUP
+ EDITTEXT 20, 124, 33, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Height:", 115, 0, 47, 120, 11, WS_GROUP
+ EDITTEXT 25, 124, 47, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Real width (cm):", 120, 0, 61, 120, 11, WS_GROUP
+ EDITTEXT 30, 124, 61, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Real height (cm):", 125, 0, 75, 120, 11, WS_GROUP
+ EDITTEXT 35, 124, 75, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Framerate:", 130, 0, 89, 120, 11, WS_GROUP
+ EDITTEXT 40, 124, 89, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Image type:", 135, 0, 103, 120, 11, WS_GROUP
+ COMBOBOX 45, 124, 103, 76, 110, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Antialiasing:", 140, 0, 117, 120, 11, WS_GROUP
+ COMBOBOX 50, 124, 117, 76, 110, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Always recalculate:", 145, 0, 131, 120, 11, WS_GROUP
+ COMBOBOX 55, 124, 131, 76, 110, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Calculate MPEG motion vectors:", 150, 0, 145, 120, 11, WS_GROUP
+ COMBOBOX 60, 124, 145, 76, 110, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ RTEXT "Recommended I frame distance:", 155, 0, 159, 120, 11, WS_GROUP
+ EDITTEXT 65, 124, 159, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 173, 64, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 70, 173, 64, 14
+ PUSHBUTTON "&Help", 3, 138, 173, 64, 14
+END
+textBox DIALOG 52, 57, 104, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Display text"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Text:", 100, 0, 5, 20, 11, WS_GROUP
+ EDITTEXT 10, 24, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 30, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 36, 19, 30, 14
+ PUSHBUTTON "&Help", 3, 71, 19, 30, 14
+END
+colorBox DIALOG 52, 57, 108, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Color"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Color:", 100, 0, 5, 24, 11, WS_GROUP
+ COMBOBOX 10, 28, 5, 76, 110, CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 32, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 38, 19, 32, 14
+ PUSHBUTTON "&Help", 3, 74, 19, 32, 14
+END
+usrformBox DIALOG 52, 57, 116, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "User formula"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Formula:", 100, 0, 5, 32, 11, WS_GROUP
+ EDITTEXT 10, 36, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 34, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 40, 19, 34, 14
+ PUSHBUTTON "&Help", 3, 79, 19, 34, 14
+END
+usrformInitBox DIALOG 52, 57, 144, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "User initialization"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Initialization:", 100, 0, 5, 60, 11, WS_GROUP
+ EDITTEXT 10, 64, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 44, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 50, 19, 44, 14
+ PUSHBUTTON "&Help", 3, 98, 19, 44, 14
+END
+uimandelbrotBox DIALOG 52, 57, 128, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Mandelbrot mode"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Julia-seed:", 100, 0, 5, 44, 11, WS_GROUP
+ EDITTEXT 10, 48, 5, 30, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ EDITTEXT 11, 88, 5, 30, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "+", -1, 82, 5, 4, 11
+ RTEXT "i", -1, 120, 5, 4, 11
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 38, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 44, 19, 38, 14
+ PUSHBUTTON "&Help", 3, 87, 19, 38, 14
+END
+uiperturbationBox DIALOG 52, 57, 136, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Perturbation"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Perturbation:", 100, 0, 5, 52, 11, WS_GROUP
+ EDITTEXT 10, 56, 5, 30, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ EDITTEXT 11, 96, 5, 30, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "+", -1, 90, 5, 4, 11
+ RTEXT "i", -1, 128, 5, 4, 11
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 41, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 47, 19, 41, 14
+ PUSHBUTTON "&Help", 3, 92, 19, 41, 14
+END
+uiviewBox DIALOG 52, 57, 112, 66
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "View"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Center:", 100, 0, 5, 28, 11, WS_GROUP
+ EDITTEXT 10, 32, 5, 30, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ EDITTEXT 11, 72, 5, 30, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "+", -1, 66, 5, 4, 11
+ RTEXT "i", -1, 104, 5, 4, 11
+ RTEXT "Radius:", 105, 0, 19, 28, 11, WS_GROUP
+ EDITTEXT 15, 32, 19, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Angle:", 110, 0, 33, 28, 11, WS_GROUP
+ EDITTEXT 20, 32, 33, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 47, 33, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 39, 47, 33, 14
+ PUSHBUTTON "&Help", 3, 76, 47, 33, 14
+END
+paletteBox DIALOG 52, 57, 152, 66
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Custom palette"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Algorithm number:", 100, 0, 5, 68, 11, WS_GROUP
+ EDITTEXT 10, 72, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Seed:", 105, 0, 19, 68, 11, WS_GROUP
+ EDITTEXT 15, 72, 19, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ RTEXT "Shift:", 110, 0, 33, 68, 11, WS_GROUP
+ EDITTEXT 20, 72, 33, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 47, 46, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 52, 47, 46, 14
+ PUSHBUTTON "&Help", 3, 103, 47, 46, 14
+END
+cyclingspeedBox DIALOG 52, 57, 156, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Color cycling speed"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Frames per second:", 100, 0, 5, 72, 11, WS_GROUP
+ EDITTEXT 10, 76, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 48, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 54, 19, 48, 14
+ PUSHBUTTON "&Help", 3, 106, 19, 48, 14
+END
+shiftpaletteBox DIALOG 52, 57, 112, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Shift palette"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Amount:", 100, 0, 5, 28, 11, WS_GROUP
+ EDITTEXT 10, 32, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 33, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 39, 19, 33, 14
+ PUSHBUTTON "&Help", 3, 76, 19, 33, 14
+END
+maxiterBox DIALOG 52, 57, 128, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Iterations"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Iterations:", 100, 0, 5, 44, 11, WS_GROUP
+ EDITTEXT 10, 48, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 38, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 44, 19, 38, 14
+ PUSHBUTTON "&Help", 3, 87, 19, 38, 14
+END
+bailoutBox DIALOG 52, 57, 116, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Bailout"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Bailout:", 100, 0, 5, 32, 11, WS_GROUP
+ EDITTEXT 10, 36, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 34, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 40, 19, 34, 14
+ PUSHBUTTON "&Help", 3, 79, 19, 34, 14
+END
+rotationspeedBox DIALOG 52, 57, 168, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Rotation speed"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Rotations per second:", 100, 0, 5, 84, 11, WS_GROUP
+ EDITTEXT 10, 88, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 52, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 58, 19, 52, 14
+ PUSHBUTTON "&Help", 3, 114, 19, 52, 14
+END
+speedBox DIALOG 52, 57, 140, 38
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Zooming speed"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ RTEXT "Zooming speed:", 100, 0, 5, 56, 11, WS_GROUP
+ EDITTEXT 10, 60, 5, 76, 11, ES_AUTOHSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "&OK", 1, 2, 19, 42, 14, WS_GROUP
+ PUSHBUTTON "&Cancel", 2, 48, 19, 42, 14
+ PUSHBUTTON "&Help", 3, 95, 19, 42, 14
+END
diff --git a/src/ui/ui-drv/win32/xaos.exe.manifest b/src/ui/ui-drv/win32/xaos.exe.manifest new file mode 100644 index 0000000..9a3a947 --- /dev/null +++ b/src/ui/ui-drv/win32/xaos.exe.manifest @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> +<assemblyIdentity version="3.5.0.0" processorArchitecture="X86" name="net.sourceforge.XaoS" type="win32" /> +<description>Your application description here.</description> +<dependency> +<dependentAssembly> +<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> +</dependentAssembly> +</dependency> +</assembly> diff --git a/src/ui/ui-drv/win32/xaos.ico b/src/ui/ui-drv/win32/xaos.ico Binary files differnew file mode 100644 index 0000000..54a99cf --- /dev/null +++ b/src/ui/ui-drv/win32/xaos.ico diff --git a/src/ui/ui-drv/win32/xaos.rc b/src/ui/ui-drv/win32/xaos.rc new file mode 100644 index 0000000..5564505 --- /dev/null +++ b/src/ui/ui-drv/win32/xaos.rc @@ -0,0 +1,16 @@ +/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+#include <windows.h>
+#include "resource.h"
+#include "about.h"
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "xaos.exe.manifest"
+BIG ICON DISCARDABLE "xaos.ico"
+SMALL ICON DISCARDABLE "small.ico"
+
+#include "xaos.dlg"
+#include "version.rc"
+#include "about.rc"
|