Commit e399fc36 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 0.4.10

Mon Nov 22 13:58:56 1993 David Metcalfe <david@prism.demon.co.uk> * [windows/scroll.c] Preliminary implementations of ScrollWindow, ScrollDC and ScrollWindowEx. Nov 21, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Optimization of redraw during 'Add' or 'Insert'. * [controls/scroll.c] Optimization of WM_PAINT during 'thumbtracking'. * [controls/button.c] Add of beta implement of 'BS_OWNERDRAW' * [controls/static.c] Style 'SS_ICON' new supported. * [misc/message.c] Begin of implemantation of MB_XXX styles. * [loader/resource.c] Function LoadIcon() : now prepare transparency Bitmap mask. Function LoadCursor() : now prepare a 'X pixmapcursor'. New function SetCursor() : not finished. New function ShowCursor() : not finished. New function AccessResource() : stub. * [obj/dib.c] Function DrawIcon(): deugging phase of icon transparency mask. * [loader/library.c] new file for news functions LoadLibrary() & FreeLibrary(). * [sysres.dll] Resources only 16bits DLL for System Resources, icons, etc... Sun Nov 14 14:39:06 1993 julliard@di.epfl.ch (Alexandre Julliard) * [include/dialog.h] [windows/dialog.c] Simplified dialog template parsing. Implemented DialogBoxIndirect(). * [windows/win.c] Fixed bug in CreateWindow() when aborting window creation. Modified UpdateWindow() to only update visible windows. Implemented IsWindow(). Nov 14, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Listbox control window : new messages. * [controls/combo.c] Combo box control window : new messages. * [misc/message.c] Moved stub MessageBox() to this new file. Implemented of a callback, now MessageBox show a window. * [loader/resource.c] New function DestroyIcon() New function DestroyCursor() Filled stub LoadIcon() Filled stub LoadCursor() Bug fixed in FindResourceByName() : missing lseek(). * [obj/dib.c] New function DrawIcon() * [windows/win.c] New function CloseWindow() New function OpenIcon() New function IsIconic() New Function FindWindow() Sun Nov 14 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de) * [loader/selector.c] Wrote AllocCStoDSAlias() and AllocDStoCSAlias() Sun Nov 14 08:27:19 1993 Bob Amstadt (bob at amscons) * [loader/selector.c] Wrote AllocSelector() and PrestoChangoSelector(). YUK! Sat Nov 13 13:56:42 1993 Bob Amstadt (bob at amscons) * [loader/resource.c] Wrote FindResource(), LoadResource(), LockResource(), and FreeResource() * [include/segmem.h] [loader/selector.c] [loader/signal.h] Changed selector allocation method. Sun Nov 10 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de) * [if1632/callback.c if1632/call.S if1632/user.spec] added Catch (KERNEL.55) and Throw (KERNEL.56) Nov 7, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/scroll.c] Scroll bar control window Bug resolved : Painting message before scroll visible. * [controls/listbox.c] Listbox control window Destroy cleanup. * [controls/combo.c] Combo box control window Destroy cleanup. * [controls/button.c] GetCheck Message now return is state. * [windows/win.c] New function IsWindowVisible()
parent 0e607784
Mon Nov 22 13:58:56 1993 David Metcalfe <david@prism.demon.co.uk>
* [windows/scroll.c]
Preliminary implementations of ScrollWindow, ScrollDC and
ScrollWindowEx.
Nov 21, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/listbox.c]
Optimization of redraw during 'Add' or 'Insert'.
* [controls/scroll.c]
Optimization of WM_PAINT during 'thumbtracking'.
* [controls/button.c]
Add of beta implement of 'BS_OWNERDRAW'
* [controls/static.c]
Style 'SS_ICON' new supported.
* [misc/message.c]
Begin of implemantation of MB_XXX styles.
* [loader/resource.c]
Function LoadIcon() : now prepare transparency Bitmap mask.
Function LoadCursor() : now prepare a 'X pixmapcursor'.
New function SetCursor() : not finished.
New function ShowCursor() : not finished.
New function AccessResource() : stub.
* [obj/dib.c]
Function DrawIcon(): deugging phase of icon transparency mask.
* [loader/library.c]
new file for news functions LoadLibrary() & FreeLibrary().
* [sysres.dll]
Resources only 16bits DLL for System Resources, icons, etc...
----------------------------------------------------------------------
Sun Nov 14 14:39:06 1993 julliard@di.epfl.ch (Alexandre Julliard)
* [include/dialog.h] [windows/dialog.c]
Simplified dialog template parsing.
Implemented DialogBoxIndirect().
* [windows/win.c]
Fixed bug in CreateWindow() when aborting window creation.
Modified UpdateWindow() to only update visible windows.
Implemented IsWindow().
Nov 14, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/listbox.c]
Listbox control window : new messages.
* [controls/combo.c]
Combo box control window : new messages.
* [misc/message.c]
Moved stub MessageBox() to this new file.
Implemented of a callback, now MessageBox show a window.
* [loader/resource.c]
New function DestroyIcon()
New function DestroyCursor()
Filled stub LoadIcon()
Filled stub LoadCursor()
Bug fixed in FindResourceByName() : missing lseek().
* [obj/dib.c]
New function DrawIcon()
* [windows/win.c]
New function CloseWindow()
New function OpenIcon()
New function IsIconic()
New Function FindWindow()
Sun Nov 14 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de)
* [loader/selector.c]
Wrote AllocCStoDSAlias() and AllocDStoCSAlias()
Sun Nov 14 08:27:19 1993 Bob Amstadt (bob at amscons)
* [loader/selector.c]
Wrote AllocSelector() and PrestoChangoSelector(). YUK!
Sat Nov 13 13:56:42 1993 Bob Amstadt (bob at amscons)
* [loader/resource.c]
Wrote FindResource(), LoadResource(), LockResource(),
and FreeResource()
* [include/segmem.h] [loader/selector.c] [loader/signal.h]
Changed selector allocation method.
Sun Nov 10 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de)
* [if1632/callback.c if1632/call.S if1632/user.spec]
added Catch (KERNEL.55) and Throw (KERNEL.56)
Nov 7, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/scroll.c]
Scroll bar control window
Bug resolved : Painting message before scroll visible.
* [controls/listbox.c]
Listbox control window
Destroy cleanup.
* [controls/combo.c]
Combo box control window
Destroy cleanup.
* [controls/button.c]
GetCheck Message now return is state.
* [windows/win.c]
New function IsWindowVisible()
Mon Nov 1 14:40:21 1993 julliard@di.epfl.ch (Alexandre Julliard)
* [if1632/user.spec]
......
######################################################################
# These variables are inherited by the sub-makefiles
DEBUGOPTS=-DDEBUG_RESOURCE
DEBUGOPTS=
COPTS=-O2 -m486
INCLUDE_DIR=include
LDFLAGS=
......
......@@ -31,6 +31,19 @@ For example, to run Windows' solitaire:
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occassionally it will crash.
WHAT'S NEW with version 0.4.10: (see ChangeLog for details)
- Bug fixes
- More scroll bar functions
- More icon and cursor handling
WHAT'S NEW with version 0.4.9: (see ChangeLog for details)
- Bug fixes
- real MessageBox()
- New resource functions
- Icon functions
- Selector manipulation functions
- Catch()/Throw()
WHAT'S NEW with version 0.4.7: (see ChangeLog for details)
- More dialog box functions
- More DOS interrupts
......
......@@ -9,6 +9,7 @@ static char Copyright2[] = "Copyright David Metcalfe, 1993";
#include <windows.h>
#include "win.h"
#include "user.h"
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
......@@ -48,6 +49,10 @@ static LONG UB_Paint(HWND hWnd);
static LONG UB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
static LONG UB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
static LONG UB_KillFocus(HWND hWnd);
static LONG OB_Paint(HWND hWnd);
static LONG OB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
static LONG OB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
static LONG OB_KillFocus(HWND hWnd);
typedef struct
{
......@@ -60,7 +65,7 @@ typedef struct
LONG (*getCheckfn)();
} BTNFN;
#define MAX_BTN_TYPE 10
#define MAX_BTN_TYPE 12
static BTNFN btnfn[MAX_BTN_TYPE] =
{
......@@ -153,7 +158,25 @@ static BTNFN btnfn[MAX_BTN_TYPE] =
(LONG(*)())RB_KillFocus,
(LONG(*)())RB_SetCheck,
(LONG(*)())RB_GetCheck
}
},
{
(LONG(*)())NULL, /* Not defined */
(LONG(*)())NULL,
(LONG(*)())NULL,
(LONG(*)())NULL,
(LONG(*)())NULL,
(LONG(*)())NULL,
(LONG(*)())NULL
},
{
(LONG(*)())OB_Paint, /* BS_OWNERDRAW */
(LONG(*)())OB_LButtonDown,
(LONG(*)())OB_LButtonUp,
(LONG(*)())NULL,
(LONG(*)())OB_KillFocus,
(LONG(*)())NULL,
(LONG(*)())NULL
},
};
......@@ -239,7 +262,7 @@ LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
case BM_GETCHECK:
if (btnfn[style].getCheckfn)
(btnfn[style].getCheckfn)(hWnd);
return (btnfn[style].getCheckfn)(hWnd);
break;
default:
......@@ -954,3 +977,91 @@ static LONG UB_KillFocus(HWND hWnd)
UpdateWindow(hWnd);
}
/**********************************************************************
* Ownerdrawn Button Functions
*/
static LONG OB_Paint(HWND hWnd)
{
PAINTSTRUCT ps;
HDC hDC;
RECT rc;
HANDLE hDis;
LPDRAWITEMSTRUCT lpdis;
WND *wndPtr = WIN_FindWndPtr(hWnd);
hDC = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rc);
hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
lpdis->hDC = hDC;
lpdis->itemID = 0;
CopyRect(&lpdis->rcItem, &rc);
lpdis->CtlID = wndPtr->wIDmenu;
lpdis->CtlType = ODT_BUTTON;
lpdis->itemAction = ODA_DRAWENTIRE;
/* printf("ownerdrawn button WM_DRAWITEM CtrlID=%X\n", lpdis->CtlID);*/
SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis);
USER_HEAP_FREE(hDis);
EndPaint(hWnd, &ps);
}
static LONG OB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
{
HDC hDC;
RECT rc;
HANDLE hDis;
LPDRAWITEMSTRUCT lpdis;
WND *wndPtr = WIN_FindWndPtr(hWnd);
/* SetFocus(hWnd); */
SetCapture(hWnd);
hDC = GetDC(hWnd);
GetClientRect(hWnd, &rc);
if (PtInRect(&rc, MAKEPOINT(lParam)))
NOTIFY_PARENT(hWnd, BN_CLICKED);
GetClientRect(hWnd, &rc);
hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
lpdis->hDC = hDC;
lpdis->itemID = 0;
CopyRect(&lpdis->rcItem, &rc);
lpdis->CtlID = wndPtr->wIDmenu;
lpdis->CtlType = ODT_BUTTON;
lpdis->itemAction = ODA_SELECT;
SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis);
USER_HEAP_FREE(hDis);
ReleaseDC(hWnd, hDC);
}
static LONG OB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
{
HDC hDC;
RECT rc;
HANDLE hDis;
LPDRAWITEMSTRUCT lpdis;
WND *wndPtr = WIN_FindWndPtr(hWnd);
ReleaseCapture();
hDC = GetDC(hWnd);
GetClientRect(hWnd, &rc);
if (PtInRect(&rc, MAKEPOINT(lParam)))
NOTIFY_PARENT(hWnd, BN_CLICKED);
GetClientRect(hWnd, &rc);
hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
lpdis->hDC = hDC;
lpdis->itemID = 0;
CopyRect(&lpdis->rcItem, &rc);
lpdis->CtlID = wndPtr->wIDmenu;
lpdis->CtlType = ODT_BUTTON;
lpdis->itemAction = ODA_SELECT;
SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis);
USER_HEAP_FREE(hDis);
ReleaseDC(hWnd, hDC);
}
static LONG OB_KillFocus(HWND hWnd)
{
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
}
......@@ -74,16 +74,20 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
WND *wndPtr;
LPHEADCOMBO lphc;
char str[128];
PAINTSTRUCT paintstruct;
static RECT rectsel;
switch(message)
{
case WM_CREATE:
CreateComboStruct(hwnd);
wndPtr = WIN_FindWndPtr(hwnd);
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
#ifdef DEBUG_COMBO
printf("Combo WM_CREATE %lX !\n", lphc);
#endif
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
lphc->hWndDrop = CreateWindow("BUTTON", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
width - 16, 0, 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
......@@ -94,25 +98,23 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | WS_VSCROLL | LBS_NOTIFY,
wndPtr->rectClient.left, wndPtr->rectClient.top + 16, width, height,
wndPtr->hwndParent, 1, wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd));
/*
ShowWindow(lphc->hWndLBox, SW_HIDE);
*/
InvalidateRect(lphc->hWndEdit, NULL, TRUE);
UpdateWindow(lphc->hWndEdit);
InvalidateRect(lphc->hWndDrop, NULL, TRUE);
UpdateWindow(lphc->hWndDrop);
#ifdef DEBUG_COMBO
printf("Combo Creation Drop=%X LBox=%X!\n", lphc->hWndDrop, lphc->hWndLBox);
#endif
return 0;
case WM_DESTROY:
lphc = ComboGetStorageHeader(hwnd);
if (lphc == 0) return 0;
DestroyWindow(lphc->hWndDrop);
DestroyWindow(lphc->hWndEdit);
/*
DestroyWindow(lphc->hWndLBox);
*/
free(lphc);
*((LPHEADCOMBO *)&wndPtr->wExtra[1]) = 0;
#ifdef DEBUG_COMBO
printf("Combo WM_DESTROY !\n");
printf("Combo WM_DESTROY %lX !\n", lphc);
#endif
return 0;
......@@ -128,24 +130,33 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
ShowWindow(lphc->hWndLBox, SW_SHOW);
/*
SetFocus(lphc->hWndLBox);
*/
}
else {
/*
SetFocus(lphc->hWndEdit);
*/
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
printf("combo hide\n");
if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
}
}
}
if (LOWORD(lParam) == lphc->hWndLBox) {
switch(HIWORD(lParam))
{
case LBN_SELCHANGE:
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
lphc->dwState = lphc->dwState & (CB_SHOWDROPDOWN ^ 0xFFFF);
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
}
SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu,
MAKELONG(hwnd, CBN_SELCHANGE));
break;
......@@ -165,6 +176,8 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
case WM_CTLCOLOR:
return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam));
case WM_PAINT:
BeginPaint( hwnd, &paintstruct );
EndPaint( hwnd, &paintstruct );
lphc = ComboGetStorageHeader(hwnd);
InvalidateRect(lphc->hWndEdit, NULL, TRUE);
UpdateWindow(lphc->hWndEdit);
......@@ -175,17 +188,6 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
UpdateWindow(lphc->hWndLBox);
}
break;
case WM_MOUSEMOVE:
if ((wParam & MK_LBUTTON) != 0) {
y = HIWORD(lParam);
if (y < 4) {
lphc = ComboGetStorageHeader(hwnd);
}
GetClientRect(hwnd, &rect);
if (y > (rect.bottom - 4)) {
lphc = ComboGetStorageHeader(hwnd);
}
}
case CB_ADDSTRING:
#ifdef DEBUG_COMBO
printf("CB_ADDSTRING '%s' !\n", (LPSTR)lParam);
......@@ -196,6 +198,10 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
printf("CB_GETLBTEXT #%u !\n", wParam);
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam));
case CB_GETLBTEXTLEN:
printf("CB_GETLBTEXTLEN !\n");
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam));
case CB_INSERTSTRING:
printf("CB_INSERTSTRING '%s' !\n", (LPSTR)lParam);
lphc = ComboGetStorageHeader(hwnd);
......@@ -210,17 +216,65 @@ LONG COMBOBOX_ComboBoxWndProc( HWND hwnd, WORD message,
return(SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L));
case CB_DIR:
printf("ComboBox CB_DIR !\n");
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_DIR, wParam, lParam));
case CB_FINDSTRING:
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam));
case CB_GETCOUNT:
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L));
case CB_GETCURSEL:
printf("ComboBox CB_GETCURSEL !\n");
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L));
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L));
case CB_SETCURSEL:
printf("ComboBox CB_SETCURSEL wParam=%x !\n", wParam);
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, wParam, 0L));
printf("ComboBox CB_SETCURSEL wParam=%X !\n", wParam);
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_SETCURSEL, wParam, 0L));
case CB_GETEDITSEL:
printf("ComboBox CB_GETEDITSEL !\n");
lphc = ComboGetStorageHeader(hwnd);
/* return(SendMessage(lphc->hWndEdit, EM_GETSEL, 0, 0L)); */
break;
case CB_SETEDITSEL:
printf("ComboBox CB_SETEDITSEL lParam=%lX !\n", lParam);
lphc = ComboGetStorageHeader(hwnd);
/* return(SendMessage(lphc->hWndEdit, EM_SETSEL, 0, lParam)); */
break;
case CB_SELECTSTRING:
printf("ComboBox CB_SELECTSTRING !\n");
lphc = ComboGetStorageHeader(hwnd);
break;
case CB_SHOWDROPDOWN:
printf("ComboBox CB_SHOWDROPDOWN !\n");
lphc = ComboGetStorageHeader(hwnd);
lphc->dwState = lphc->dwState | CB_SHOWDROPDOWN;
if (wParam != 0) {
ShowWindow(lphc->hWndLBox, SW_SHOW);
}
else {
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
ShowWindow(lphc->hWndLBox, SW_HIDE);
SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu,
MAKELONG(hwnd, CBN_DROPDOWN));
}
break;
case CB_GETITEMDATA:
printf("ComboBox CB_GETITEMDATA wParam=%X !\n", wParam);
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0L));
break;
case CB_SETITEMDATA:
printf("ComboBox CB_SETITEMDATA wParam=%X lParam=%lX !\n", wParam, lParam);
lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam));
break;
case CB_LIMITTEXT:
printf("ComboBox CB_LIMITTEXT !\n");
lphc = ComboGetStorageHeader(hwnd);
/* return(SendMessage(lphc->hWndEdit, EM_LIMITTEXT, wParam, 0L)); */
break;
default:
return DefWindowProc( hwnd, message, wParam, lParam );
......@@ -235,6 +289,10 @@ LPHEADCOMBO ComboGetStorageHeader(HWND hwnd)
WND *wndPtr;
LPHEADCOMBO lphc;
wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == 0) {
printf("Bad Window handle on ComboBox !\n");
return 0;
}
lphc = *((LPHEADCOMBO *)&wndPtr->wExtra[1]);
return lphc;
}
......@@ -246,6 +304,10 @@ int CreateComboStruct(HWND hwnd)
WND *wndPtr;
LPHEADCOMBO lphc;
wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == 0) {
printf("Bad Window handle on ComboBox !\n");
return 0;
}
lphc = (LPHEADCOMBO)malloc(sizeof(HEADCOMBO));
*((LPHEADCOMBO *)&wndPtr->wExtra[1]) = lphc;
lphc->dwState = 0;
......
......@@ -107,6 +107,9 @@ LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
case WM_CREATE:
CreateListBoxStruct(hwnd);
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
#ifdef DEBUG_LISTBOX
printf("ListBox WM_CREATE %lX !\n", lphl);
#endif
createStruct = (CREATESTRUCT *)lParam;
if (HIWORD(createStruct->lpCreateParams) != 0)
lphl->hWndLogicParent = (HWND)HIWORD(createStruct->lpCreateParams);
......@@ -122,10 +125,14 @@ LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
return 0;
case WM_DESTROY:
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == 0) return 0;
ListBoxResetContent(hwnd);
DestroyWindow(lphl->hWndScroll);
free(lphl);
printf("ListBox WM_DESTROY !\n");
*((LPHEADLIST *)&wndPtr->wExtra[1]) = 0;
#ifdef DEBUG_LISTBOX
printf("ListBox WM_DESTROY %lX !\n", lphl);
#endif
return 0;
case WM_VSCROLL:
......@@ -164,6 +171,10 @@ LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
return 0;
case WM_LBUTTONDOWN:
/*
SetFocus(hwnd);
*/
SetCapture(hwnd);
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return 0;
lphl->PrevSelected = lphl->ItemSelected;
......@@ -174,6 +185,7 @@ LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
UpdateWindow(hwnd);
return 0;
case WM_LBUTTONUP:
ReleaseCapture();
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return 0;
if (lphl->PrevSelected != lphl->ItemSelected)
......@@ -248,8 +260,10 @@ LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
case LB_DIR:
printf("ListBox LB_DIR !\n");
wRet = ListBoxDirectory(hwnd, wParam, (LPSTR)lParam);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
if (IsWindowVisible(hwnd)) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
return wRet;
case LB_ADDSTRING:
wRet = ListBoxAddString(hwnd, (LPSTR)lParam);
......@@ -315,30 +329,38 @@ LONG LISTBOX_ListBoxWndProc( HWND hwnd, WORD message,
printf("ListBox LB_SETCURSEL wParam=%x !\n", wParam);
#endif
wRet = ListBoxSetCurSel(hwnd, wParam);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
if (IsWindowVisible(hwnd)) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
return wRet;
case LB_SETSEL:
printf("ListBox LB_SETSEL wParam=%x lParam=%lX !\n", wParam, lParam);
wRet = ListBoxSetSel(hwnd, wParam);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
if (IsWindowVisible(hwnd)) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
return wRet;
case LB_SETTOPINDEX:
printf("ListBox LB_SETTOPINDEX wParam=%x !\n", wParam);
lphl = ListBoxGetStorageHeader(hwnd);
lphl->FirstVisible = wParam;
SetScrollPos(lphl->hWndScroll, WM_VSCROLL, lphl->FirstVisible, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
if (IsWindowVisible(hwnd)) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
break;
case LB_SETITEMHEIGHT:
#ifdef DEBUG_LISTBOX
printf("ListBox LB_SETITEMHEIGHT wParam=%x lParam=%lX !\n", wParam, lParam);
#endif
wRet = ListBoxSetItemHeight(hwnd, wParam, lParam);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
if (IsWindowVisible(hwnd)) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
return wRet;
default:
......@@ -381,6 +403,10 @@ void StdDrawListBox(HWND hwnd)
char C[128];
h = 0;
hdc = BeginPaint( hwnd, &ps );
if (!IsWindowVisible(hwnd)) {
EndPaint( hwnd, &ps );
return;
}
GetClientRect(hwnd, &rect);
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) goto EndOfPaint;
......@@ -425,7 +451,6 @@ void OwnerDrawListBox(HWND hwnd)
{
LPHEADLIST lphl;
LPLISTSTRUCT lpls;
HANDLE hTemp;
PAINTSTRUCT ps;
HBRUSH hBrush;
HWND hWndParent;
......@@ -435,6 +460,10 @@ void OwnerDrawListBox(HWND hwnd)
char C[128];
h = 0;
hdc = BeginPaint( hwnd, &ps );
if (!IsWindowVisible(hwnd)) {
EndPaint( hwnd, &ps );
return;
}
GetClientRect(hwnd, &rect);
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) goto EndOfPaint;
......@@ -465,11 +494,9 @@ void OwnerDrawListBox(HWND hwnd)
lpls->dis.rcItem.right, lpls->dis.rcItem.bottom);
printf("LBOX WM_DRAWITEM Parent=%X &dis=%lX CtlID=%u !\n",
hWndParent, (LONG)&lpls->dis, lpls->dis.CtlID);
#endif
printf("LBOX WM_DRAWITEM '%s' !\n", lpls->dis.itemData);
#endif
SendMessage(lphl->hWndLogicParent, WM_DRAWITEM, i, (LPARAM)&lpls->dis);
GlobalUnlock(hTemp);
GlobalFree(hTemp);
if (lpls->dis.itemState != 0) {
InvertRect(hdc, &lpls->dis.rcItem);
}
......@@ -575,7 +602,8 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
lplsnew->dis.itemID = lphl->ItemsCount;
lplsnew->dis.itemData = (DWORD)newstr;
lplsnew->hData = hTemp;
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount,
(lphl->FirstVisible != 1));
if (lphl->FirstVisible >= (lphl->ItemsCount - lphl->ItemsVisible)) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......@@ -625,7 +653,8 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
lplsnew->dis.itemID = lphl->ItemsCount;
lplsnew->dis.itemData = (DWORD)newstr;
lplsnew->hData = hTemp;
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount, TRUE);
SetScrollRange(lphl->hWndScroll, WM_VSCROLL, 1, lphl->ItemsCount,
(lphl->FirstVisible != 1));
if (((lphl->ItemsCount - lphl->FirstVisible) == lphl->ItemsVisible) &&
(lphl->ItemsVisible != 0))
ShowWindow(lphl->hWndScroll, SW_NORMAL);
......@@ -768,10 +797,10 @@ int ListBoxSetCurSel(HWND hwnd, WORD wIndex)
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return LB_ERR;
lphl->ItemSelected = LB_ERR;
if (wIndex < 1 || wIndex > lphl->ItemsCount) return LB_ERR;
if (wIndex < 0 || wIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
for(i = 1; i <= lphl->ItemsCount; i++) {
for(i = 0; i < lphl->ItemsCount; i++) {
lpls2 = lpls;
lpls = (LPLISTSTRUCT)lpls->lpNext;
if (i == wIndex)
......@@ -797,10 +826,10 @@ int ListBoxSetSel(HWND hwnd, WORD wIndex)
UINT i;
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return LB_ERR;
if (wIndex < 1 || wIndex > lphl->ItemsCount) return LB_ERR;
if (wIndex < 0 || wIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
for(i = 1; i <= lphl->ItemsCount; i++) {
for(i = 0; i < lphl->ItemsCount; i++) {
lpls2 = lpls;
lpls = (LPLISTSTRUCT)lpls->lpNext;
if (i == wIndex) {
......
......@@ -86,11 +86,15 @@ LONG SCROLLBAR_ScrollBarWndProc( HWND hwnd, WORD message,
#endif
return 0;
case WM_DESTROY:
lphs = ScrollBarGetStorageHeader(hwnd);
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
if (lphs == 0) return 0;
#ifdef DEBUG_SCROLL
printf("ScrollBar WM_DESTROY %lX !\n", lphs);
#endif
DestroyWindow(lphs->hWndUp);
DestroyWindow(lphs->hWndDown);
free(lphs);
printf("ScrollBar WM_DESTROY !\n");
*((LPHEADSCROLL *)&wndPtr->wExtra[1]) = 0;
return 0;
case WM_COMMAND:
......@@ -105,10 +109,17 @@ LONG SCROLLBAR_ScrollBarWndProc( HWND hwnd, WORD message,
if (LOWORD(lParam) == lphs->hWndDown)
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_LINEDOWN, MAKELONG(0, hwnd));
/*
SetFocus(hwnd);
*/
return 0;
case WM_LBUTTONDOWN:
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
/*
SetFocus(hwnd);
*/
SetCapture(hwnd);
GetClientRect(hwnd, &rect);
if (lphs->Direction == WM_VSCROLL) {
y = HIWORD(lParam);
......@@ -152,11 +163,13 @@ LONG SCROLLBAR_ScrollBarWndProc( HWND hwnd, WORD message,
}
break;
case WM_LBUTTONUP:
lphs = ScrollBarGetStorageHeader(hwnd);
lphs->ThumbActive = FALSE;
ReleaseCapture();
break;
case WM_KEYDOWN:
printf("ScrollBar WM_KEYDOWN wParam %X!\n", wParam);
printf("ScrollBar WM_KEYDOWN wParam %X !\n", wParam);
break;
case WM_PAINT:
StdDrawScrollBar(hwnd);
......@@ -192,6 +205,10 @@ LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hwnd, WND **wndPtr)
WND *Ptr;
LPHEADSCROLL lphs;
*(wndPtr) = Ptr = WIN_FindWndPtr(hwnd);
if (Ptr == 0) {
printf("Bad Window handle on ScrollBar !\n");
return 0;
}
lphs = *((LPHEADSCROLL *)&Ptr->wExtra[1]);
return lphs;
}
......@@ -202,6 +219,10 @@ LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd)
WND *wndPtr;
LPHEADSCROLL lphs;
wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == 0) {
printf("Bad Window handle on ScrollBar !\n");
return 0;
}
lphs = *((LPHEADSCROLL *)&wndPtr->wExtra[1]);
return lphs;
}
......@@ -209,49 +230,53 @@ LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd)
void StdDrawScrollBar(HWND hwnd)
{
LPHEADSCROLL lphs;
PAINTSTRUCT ps;
HBRUSH hBrush;
HDC hdc;
RECT rect;
UINT i, w, h, siz;
char C[128];
hdc = BeginPaint( hwnd, &ps );
hBrush = SendMessage(GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc,
MAKELONG(hwnd, CTLCOLOR_SCROLLBAR));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(LTGRAY_BRUSH);
lphs = ScrollBarGetStorageHeader(hwnd);
if (lphs == NULL) goto EndOfPaint;
GetClientRect(hwnd, &rect);
w = rect.right - rect.left;
h = rect.bottom - rect.top;
if (lphs->Direction == WM_VSCROLL) {
rect.top += w;
rect.bottom -= w;
}
else {
rect.left += h;
rect.right -= h;
}
FillRect(hdc, &rect, hBrush);
if (lphs->Direction == WM_VSCROLL)
SetRect(&rect, 0, lphs->CurPix + w,
w, lphs->CurPix + (w << 1));
else
SetRect(&rect, lphs->CurPix + h,
0, lphs->CurPix + (h << 1), h);
FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
InflateRect(&rect, -1, -1);
FillRect(hdc, &rect, GetStockObject(LTGRAY_BRUSH));
DrawReliefRect(hdc, rect, 2, 0);
InflateRect(&rect, -3, -3);
DrawReliefRect(hdc, rect, 1, 1);
EndOfPaint:
LPHEADSCROLL lphs;
PAINTSTRUCT ps;
HBRUSH hBrush;
HDC hdc;
RECT rect;
UINT i, w, h, siz;
char C[128];
hdc = BeginPaint( hwnd, &ps );
if (!IsWindowVisible(hwnd)) {
EndPaint( hwnd, &ps );
InvalidateRect(lphs->hWndUp, NULL, TRUE);
UpdateWindow(lphs->hWndUp);
InvalidateRect(lphs->hWndDown, NULL, TRUE);
UpdateWindow(lphs->hWndDown);
return;
}
hBrush = SendMessage(GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc,
MAKELONG(hwnd, CTLCOLOR_SCROLLBAR));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(LTGRAY_BRUSH);
lphs = ScrollBarGetStorageHeader(hwnd);
if (lphs == NULL) goto EndOfPaint;
GetClientRect(hwnd, &rect);
w = rect.right - rect.left;
h = rect.bottom - rect.top;
if (lphs->Direction == WM_VSCROLL) {
rect.top += w;
rect.bottom -= w;
}
else {
rect.left += h;
rect.right -= h;
}
FillRect(hdc, &rect, hBrush);
if (lphs->Direction == WM_VSCROLL)
SetRect(&rect, 0, lphs->CurPix + w, w, lphs->CurPix + (w << 1));
else
SetRect(&rect, lphs->CurPix + h, 0, lphs->CurPix + (h << 1), h);
FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
InflateRect(&rect, -1, -1);
FillRect(hdc, &rect, GetStockObject(LTGRAY_BRUSH));
DrawReliefRect(hdc, rect, 2, 0);
InflateRect(&rect, -3, -3);
DrawReliefRect(hdc, rect, 1, 1);
if (!lphs->ThumbActive) {
InvalidateRect(lphs->hWndUp, NULL, TRUE);
UpdateWindow(lphs->hWndUp);
InvalidateRect(lphs->hWndDown, NULL, TRUE);
UpdateWindow(lphs->hWndDown);
}
EndOfPaint:
EndPaint( hwnd, &ps );
}
......@@ -264,16 +289,22 @@ int CreateScrollBarStruct(HWND hwnd)
LPHEADSCROLL lphs;
wndPtr = WIN_FindWndPtr(hwnd);
lphs = (LPHEADSCROLL)malloc(sizeof(HEADSCROLL));
if (lphs == 0) {
printf("Bad Memory Alloc on ScrollBar !\n");
return 0;
}
#ifdef DEBUG_SCROLL
printf("CreateScrollBarStruct %lX !\n", lphs);
#endif
*((LPHEADSCROLL *)&wndPtr->wExtra[1]) = lphs;
lphs->ThumbActive;
lphs->ThumbActive = FALSE;
lphs->MinVal = 0;
lphs->MaxVal = 100;
lphs->CurVal = 0;
lphs->CurPix = 0;
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
lphs = ScrollBarGetStorageHeader(hwnd);
if (lphs == NULL) return 0;
if (width <= height)
{
lphs->MaxPix = height - 3 * width;
......@@ -308,7 +339,7 @@ int GetScrollPos(HWND hwnd, int nBar)
{
LPHEADSCROLL lphs;
lphs = ScrollBarGetStorageHeader(hwnd);
if (lphs == NULL) return;
if (lphs == NULL) return 0;
return lphs->CurVal;
}
......@@ -330,7 +361,7 @@ int SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL bRedraw)
int nRet;
LPHEADSCROLL lphs;
lphs = ScrollBarGetStorageHeader(hwnd);
if (lphs == NULL) return;
if (lphs == NULL) return 0;
nRet = lphs->CurVal;
lphs->CurVal = (short)nPos;
if (lphs->MaxVal != lphs->MinVal)
......@@ -343,7 +374,7 @@ int SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL bRedraw)
printf("SetScrollPos min=%d max=%d\n",
lphs->MinVal, lphs->MaxVal);
#endif
if (bRedraw) {
if ((bRedraw) && (IsWindowVisible(hwnd))) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
......@@ -367,7 +398,7 @@ void SetScrollRange(HWND hwnd, int nBar, int MinPos, int MaxPos, BOOL bRedraw)
#ifdef DEBUG_SCROLL
printf("SetScrollRange min=%d max=%d\n", lphs->MinVal, lphs->MaxVal);
#endif
if (bRedraw) {
if ((bRedraw) && (IsWindowVisible(hwnd))) {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
......
......@@ -16,6 +16,8 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
static LONG PaintTextfn(HWND hwnd);
static LONG PaintRectfn(HWND hwnd);
static LONG PaintFramefn(HWND hwnd);
static LONG PaintIconfn(HWND hwnd);
static COLORREF color_windowframe, color_background, color_window,
color_windowtext;
......@@ -37,7 +39,7 @@ static STATICFN staticfn[MAX_STATIC_TYPE] =
{ (LONG(*)())PaintTextfn }, /* SS_LEFT */
{ (LONG(*)())PaintTextfn }, /* SS_CENTER */
{ (LONG(*)())PaintTextfn }, /* SS_RIGHT */
{ (LONG(*)())NULL }, /* SS_ICON */
{ (LONG(*)())PaintIconfn }, /* SS_ICON */
{ (LONG(*)())PaintRectfn }, /* SS_BLACKRECT */
{ (LONG(*)())PaintRectfn }, /* SS_GRAYRECT */
{ (LONG(*)())PaintRectfn }, /* SS_WHITERECT */
......@@ -65,17 +67,22 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
break;
case WM_CREATE:
if (style < 0L || style >= (LONG)DIM(staticfn))
if (style < 0L || style >= (LONG)DIM(staticfn)) {
lResult = -1L;
else
{
/* initialise colours */
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_background = GetSysColor(COLOR_BACKGROUND);
color_window = GetSysColor(COLOR_WINDOW);
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
lResult = 0L;
}
break;
}
/* initialise colours */
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_background = GetSysColor(COLOR_BACKGROUND);
color_window = GetSysColor(COLOR_WINDOW);
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
lResult = 0L;
if (style == SS_ICON) {
/*
SetWindowPos(hWnd, (HWND)NULL, 0, 0, 32, 32,
SWP_NOZORDER | SWP_NOMOVE);
*/
}
break;
case WM_PAINT:
......@@ -259,6 +266,35 @@ static LONG PaintFramefn(HWND hwnd)
}
static LONG PaintIconfn(HWND hwnd)
{
WND *wndPtr;
PAINTSTRUCT ps;
RECT rc;
HDC hdc;
LPSTR textPtr;
HICON hIcon;
wndPtr = WIN_FindWndPtr(hwnd);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc);
FillRect(hdc, &rc, GetStockObject(WHITE_BRUSH));
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
printf("SS_ICON : textPtr='%s' / left=%d top=%d right=%d bottom=%d \n",
textPtr, rc.left, rc.top, rc.right, rc.bottom);
/*
SetWindowPos(hwnd, (HWND)NULL, 0, 0, 32, 32,
SWP_NOZORDER | SWP_NOMOVE);
GetClientRect(hwnd, &rc);
printf("SS_ICON : textPtr='%s' / left=%d top=%d right=%d bottom=%d \n",
textPtr, rc.left, rc.top, rc.right, rc.bottom);
*/
hIcon = LoadIcon(wndPtr->hInstance, textPtr);
DrawIcon(hdc, rc.left, rc.top, hIcon);
EndPaint(hwnd, &ps);
GlobalUnlock(hwnd);
}
......
......@@ -15,11 +15,12 @@ return_value:
/**********************************************************************
* Places to keep info about the current 32-bit stack frame.
*/
saved_esp:
.globl _IF1632_Saved32_esp,_IF1632_Saved32_ebp,_IF1632_Saved32_ss
_IF1632_Saved32_esp:
.long 0
saved_ebp:
_IF1632_Saved32_ebp:
.long 0
saved_ss:
_IF1632_Saved32_ss:
.word 0
/**********************************************************************
......@@ -64,9 +65,9 @@ _CallToInit16:
* Save our registers
*/
pushal
pushl saved_esp
pushl saved_ebp
pushw saved_ss
pushl _IF1632_Saved32_esp
pushl _IF1632_Saved32_ebp
pushw _IF1632_Saved32_ss
/*
* Get target address.
......@@ -78,9 +79,9 @@ _CallToInit16:
/*
* Put stack registers where we can get them after stack switch.
*/
movw %ss,saved_ss
movl %esp,saved_esp
movl %ebp,saved_ebp
movw %ss,_IF1632_Saved32_ss
movl %esp,_IF1632_Saved32_esp
movl %ebp,_IF1632_Saved32_ebp
/*
* Load initial registers
......@@ -130,16 +131,16 @@ _CallToInit16:
movw %ax,%fs
movw %ax,%gs
popl %eax
movw saved_ss,%ss
movl saved_esp,%esp
movl saved_ebp,%ebp
movw _IF1632_Saved32_ss,%ss
movl _IF1632_Saved32_esp,%esp
movl _IF1632_Saved32_ebp,%ebp
/*
* Restore registers, but do not destroy return value.
*/
popw saved_ss
popl saved_ebp
popl saved_esp
popw _IF1632_Saved32_ss
popl _IF1632_Saved32_ebp
popl _IF1632_Saved32_esp
movl %eax,return_value
popal
movl return_value,%eax
......@@ -173,13 +174,13 @@ _CallTo16:
/*
* Switch to 16-bit stack
*/
pushl saved_esp
pushl saved_ebp
pushw saved_ss
pushl _IF1632_Saved32_esp
pushl _IF1632_Saved32_ebp
pushw _IF1632_Saved32_ss
movw %ss,saved_ss
movl %esp,saved_esp
movl %ebp,saved_ebp
movw %ss,_IF1632_Saved32_ss
movl %esp,_IF1632_Saved32_esp
movl %ebp,_IF1632_Saved32_ebp
movw _IF1632_Saved16_ss,%ss
movl _IF1632_Saved16_esp,%esp
......@@ -215,13 +216,13 @@ _CallTo16:
movl %esp,_IF1632_Saved16_esp
movl %ebp,_IF1632_Saved16_ebp
movw saved_ss,%ss
movl saved_esp,%esp
movl saved_ebp,%ebp
movw _IF1632_Saved32_ss,%ss
movl _IF1632_Saved32_esp,%esp
movl _IF1632_Saved32_ebp,%ebp
popw saved_ss
popl saved_ebp
popl saved_esp
popw _IF1632_Saved32_ss
popl _IF1632_Saved32_ebp
popl _IF1632_Saved32_esp
movl %eax,return_value
movw return_value+2,%dx
......@@ -276,9 +277,9 @@ _CallTo32:
movl %esp,_IF1632_Saved16_esp
movl %ebp,_IF1632_Saved16_ebp
movw saved_ss,%ss
movl saved_esp,%esp
movl saved_ebp,%ebp
movw _IF1632_Saved32_ss,%ss
movl _IF1632_Saved32_esp,%esp
movl _IF1632_Saved32_ebp,%ebp
/*
* Call entry point
......
......@@ -5,10 +5,16 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "callback.h"
#include "wine.h"
#include "segmem.h"
#include <setjmp.h>
extern unsigned short SelectorOwners[];
extern unsigned short IF1632_Saved16_ss;
extern unsigned long IF1632_Saved16_ebp;
extern unsigned long IF1632_Saved16_esp;
extern unsigned short IF1632_Saved32_ss;
extern unsigned long IF1632_Saved32_ebp;
extern unsigned long IF1632_Saved32_esp;
extern struct segment_descriptor_s *MakeProcThunks;
struct thunk_s
......@@ -169,3 +175,77 @@ void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam)
(*func)(xPos, yPos, lParam);
}
}
/* ------------------------------------------------------------------------ */
/*
* The following functions realize the Catch/Throw functionality.
* My thought is to use the setjmp, longjmp combination to do the
* major part of this one. All I have to remember, in addition to
* whatever the jmp_buf contains, is the contents of the 16-bit
* sp, bp and ss. I do this by storing them in the structure passed
* to me by the 16-bit program (including my own jmp_buf...).
* Hopefully there isn't any program that modifies the contents!
* Bad thing: I have to save part of the stack, since this will
* get reused on the next call after my return, leaving it in an
* undefined state.
*/
#define STACK_DEPTH_16 28
struct special_buffer {
jmp_buf buffer;
long regs [6];
char stack_part [STACK_DEPTH_16];
} *sb;
int Catch (LPCATCHBUF cbuf)
{
WORD retval;
jmp_buf *tmp_jmp;
char *stack16 = (char *) (((unsigned int)IF1632_Saved16_ss << 16) +
(IF1632_Saved16_esp & 0xffff));
sb = malloc (sizeof (struct special_buffer));
sb -> regs [0] = IF1632_Saved16_esp;
sb -> regs [1] = IF1632_Saved16_ebp;
sb -> regs [2] = IF1632_Saved16_ss & 0xffff;
sb -> regs [3] = IF1632_Saved32_esp;
sb -> regs [4] = IF1632_Saved32_ebp;
sb -> regs [5] = IF1632_Saved32_ss & 0xffff;
memcpy (sb -> stack_part, stack16, STACK_DEPTH_16);
tmp_jmp = &sb -> buffer;
*((struct special_buffer **)cbuf) = sb;
if ((retval = setjmp (*tmp_jmp)))
{
IF1632_Saved16_esp = sb -> regs [0];
IF1632_Saved16_ebp = sb -> regs [1];
IF1632_Saved16_ss = sb -> regs [2] & 0xffff;
IF1632_Saved32_esp = sb -> regs [3];
IF1632_Saved32_ebp = sb -> regs [4];
IF1632_Saved32_ss = sb -> regs [5] & 0xffff;
stack16 = (char *) (((unsigned int)IF1632_Saved16_ss << 16) +
(IF1632_Saved16_esp & 0xffff));
memcpy (stack16, sb -> stack_part, STACK_DEPTH_16);
#ifdef DEBUG_CATCH
printf ("Been thrown here: %d, retval = %d\n", sb, retval);
#endif
free ((void *) sb);
return (retval);
} else {
#ifdef DEBUG_CATCH
printf ("Will somtime get thrown here: %d\n", sb);
#endif
return (retval);
}
}
void Throw (LPCATCHBUF cbuf, int val)
{
sb = *((struct special_buffer **)cbuf);
#ifdef DEBUG_CATCH
printf ("Throwing to: %d\n", sb);
#endif
longjmp (sb -> buffer, val);
}
......@@ -32,11 +32,14 @@ length 415
50 pascal GetProcAddress(word ptr) GetProcAddress(1 2)
51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
52 pascal FreeProcInstance(ptr) FreeProcInstance(1)
55 pascal Catch(ptr) Catch (1)
56 pascal Throw(ptr word) Throw(1 2)
59 pascal WriteProfileString(ptr ptr ptr) WriteProfileString(1 2 3)
60 pascal FindResource(word ptr ptr) FindResource(1 2 3)
61 pascal LoadResource(word word) LoadResource(1 2)
62 pascal LockResource(word) LockResource(1)
63 pascal FreeResource(word) FreeResource(1)
64 pascal AccessResource(word word) AccessResource(1 2)
74 pascal OpenFile(ptr ptr word) KERNEL_OpenFile(1 2 3)
81 pascal _lclose(word) KERNEL__lclose(1)
82 pascal _lread(word ptr word) KERNEL__lread(1 2 3)
......@@ -48,6 +51,8 @@ length 415
91 register InitTask(word word word word word
word word word word word)
KERNEL_InitTask()
95 pascal LoadLibrary(ptr) LoadLibrary(1)
96 pascal FreeLibrary(word) FreeLibrary(1)
102 register DOS3Call(word word word word word
word word word word word)
KERNEL_DOS3Call()
......@@ -67,6 +72,11 @@ length 415
163 pascal GlobalLRUOldest(word) ReturnArg(1)
164 pascal GlobalLRUNewest(word) ReturnArg(1)
166 pascal WinExec(ptr word) WinExec(1 2)
170 pascal AllocCStoDSAlias(word) AllocDStoCSAlias(1)
171 pascal AllocDStoCSAlias(word) AllocDStoCSAlias(1)
175 pascal AllocSelector(word) AllocSelector(1)
176 pascal FreeSelector(word) FreeSelector(1)
177 pascal PrestoChangoSelector(word word) PrestoChangoSelector(1 2)
178 equate __WINFLAGS 0x413
184 return GlobalDOSAlloc 4 0
185 return GlobalDOSFree 2 0
......
......@@ -166,10 +166,17 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
break;
case DLL_ARGTYPE_LONG:
case DLL_ARGTYPE_FARPTR:
ip = (int *) ((char *) arg_ptr + offset);
arg_table[i] = *ip;
break;
case DLL_ARGTYPE_FARPTR:
ip = (int *) ((char *) arg_ptr + offset);
if (*ip & 0xffff0000)
arg_table[i] = SAFEMAKEPTR((unsigned) *ip >> 16, *ip);
else
arg_table[i] = *ip;
break;
}
}
......
......@@ -15,6 +15,8 @@ length 540
15 pascal GetCurrentTime() GetTickCount()
18 pascal SetCapture(word) SetCapture(1)
19 pascal ReleaseCapture() ReleaseCapture()
20 pascal SetDoubleClickTime(word) SetDoubleClickTime(1)
21 pascal GetDoubleClickTime() GetDoubleClickTime()
22 pascal SetFocus(word) SetFocus(1)
23 pascal GetFocus() GetFocus()
31 pascal IsIconic(word) IsIconic(1)
......@@ -28,16 +30,24 @@ length 540
41 pascal CreateWindow(ptr ptr long s_word s_word s_word s_word word word word ptr)
CreateWindow(1 2 3 4 5 6 7 8 9 10 11)
42 pascal ShowWindow(word word) ShowWindow(1 2)
43 pascal CloseWindow(word) CloseWindow(1)
44 pascal OpenIcon(word) OpenIcon(1)
46 pascal GetParent(word) GetParent(1)
47 pascal IsWindow(word) IsWindow(1)
48 pascal IsChild(word word) IsChild(1 2)
49 pascal IsWindowVisible(word) IsWindowVisible(1)
50 pascal FindWindow(ptr ptr) FindWindow(1 2)
53 pascal DestroyWindow(word) DestroyWindow(1)
56 pascal MoveWindow(word word word word word word)
MoveWindow(1 2 3 4 5 6)
57 pascal RegisterClass(ptr) RegisterClass(1)
61 pascal ScrollWindow(word s_word s_word ptr ptr) ScrollWindow(1 2 3 4 5)
62 pascal SetScrollPos(word word word word) SetScrollPos(1 2 3 4)
64 pascal SetScrollRange(word word word word word) SetScrollRange(1 2 3 4 5)
66 pascal GetDC(word) GetDC(1)
68 pascal ReleaseDC(word word) ReleaseDC(1 2)
69 pascal SetCursor(word word) SetCursor(1 2)
71 pascal ShowCursor(word word) ShowCursor(1 2)
72 pascal SetRect(ptr s_word s_word s_word s_word) SetRect(1 2 3 4 5)
73 pascal SetRectEmpty(ptr) SetRectEmpty(1)
74 pascal CopyRect(ptr ptr) CopyRect(1 2)
......@@ -50,6 +60,7 @@ length 540
81 pascal FillRect(word ptr word) FillRect(1 2 3)
82 pascal InvertRect(word ptr) InvertRect(1 2)
83 pascal FrameRect(word ptr word) FrameRect(1 2 3)
84 pascal DrawIcon(word s_word s_word word) DrawIcon(1 2 3 4)
85 pascal DrawText(word ptr s_word ptr word) DrawText(1 2 3 4 5)
87 pascal DialogBox(word ptr word ptr) DialogBox(1 2 3 4)
88 pascal EndDialog(word s_word) EndDialog(1 2)
......@@ -109,8 +120,11 @@ length 540
181 pascal SetSysColors(word ptr ptr) SetSysColors(1 2 3)
182 pascal KillSystemTimer(word word) KillSystemTimer(1 2)
190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
218 pascal DialogBoxIndirect(word word word ptr) DialogBoxIndirect(1 2 3 4)
219 pascal CreateDialogIndirect(word ptr word ptr)
CreateDialogIndirect(1 2 3 4)
221 pascal ScrollDC(word s_word s_word ptr ptr word ptr)
ScrollDC(1 2 3 4 5 6 7)
227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3)
228 pascal GetNextDlgTabItem(word word word) GetNextDlgTabItem(1 2 3)
229 pascal GetTopWindow(word) GetTopWindow(1)
......@@ -118,6 +132,9 @@ length 540
232 pascal SetWindowPos(word word word word word word word)
SetWindowPos(1 2 3 4 5 6 7)
237 pascal GetUpdateRgn(word word word) GetUpdateRgn(1 2 3)
239 pascal DialogBoxParam(word ptr word ptr long) DialogBoxParam(1 2 3 4 5)
240 pascal DialogBoxIndirectParam(word word word ptr long)
DialogBoxIndirectParam(1 2 3 4 5)
241 pascal CreateDialogParam(word ptr word ptr long)
CreateDialogParam(1 2 3 4 5)
242 pascal CreateDialogIndirectParam(word ptr word ptr long)
......@@ -128,6 +145,8 @@ length 540
277 pascal GetDlgCtrlID(word) GetDlgCtrlID(1)
286 pascal GetDesktopWindow() GetDesktopWindow()
288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
319 pascal ScrollWindowEx(word s_word s_word ptr ptr word ptr word)
ScrollWindowEx(1 2 3 4 5 6 7 8)
324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5)
334 pascal GetQueueStatus(word) GetQueueStatus(1)
......@@ -149,6 +168,8 @@ length 540
452 pascal CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
word word word ptr)
CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
457 pascal DestroyIcon(word) DestroyIcon(1)
458 pascal DestroyCursor(word) DestroyCursor(1)
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
472 pascal AnsiNext(ptr) AnsiNext(1 )
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
/*
* structure definitions for CURSOR
*
* Copyright Martin Ayotte, 1993
*
*/
typedef struct {
BYTE Width;
BYTE Reserved1;
BYTE Height;
BYTE Reserved2;
WORD curXHotspot;
WORD curYHotspot;
DWORD curDIBSize;
DWORD curDIBOffset;
} CURSORDESCRIP;
typedef struct {
CURSORDESCRIP descriptor;
HBITMAP hBitmap;
Display *display;
Pixmap pixshape;
Pixmap pixmask;
Cursor xcursor;
} CURSORALLOC;
......@@ -54,15 +54,6 @@ typedef struct
} DLGCONTROLHEADER;
/* Dialog control data */
typedef struct
{
DLGCONTROLHEADER * header;
LPSTR class;
LPSTR text;
} DLGCONTROL;
/* Dialog template */
typedef struct
{
......@@ -72,7 +63,6 @@ typedef struct
LPSTR caption;
WORD pointSize;
LPSTR faceName;
DLGCONTROL * controls;
} DLGTEMPLATE;
......
/*
* structure definitions for ICON
*
* Copyright Martin Ayotte, 1993
*
*/
typedef struct {
BYTE Width;
BYTE Height;
BYTE ColorCount;
BYTE Reserved1;
WORD Reserved2;
WORD Reserved3;
DWORD icoDIBSize;
DWORD icoDIBOffset;
} ICONDESCRIP;
typedef struct {
ICONDESCRIP descriptor;
HBITMAP hBitmap;
HBITMAP hBitMask;
} ICONALLOC;
......@@ -7,6 +7,19 @@
#define SEGMEM_H
/*
* Array to track selector allocation.
*/
#define MAX_SELECTORS 512
#define SELECTOR_ISFREE 0x8000
#define SELECTOR_INDEXMASK 0x0fff
extern unsigned short SelectorMap[MAX_SELECTORS];
#define SAFEMAKEPTR(s, o) \
(((int) SelectorMap[SelectorMap[(s) >> 3] & SELECTOR_INDEXMASK] << 19) \
| 0x70000 | ((o) & 0xffff))
/*
* Structure to hold info about each selector we create.
*/
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
OBJS=dump.o files.o ldt.o ldtlib.o resource.o selector.o signal.o int1a.o \
int21.o wine.o
int21.o wine.o library.o
default: loader.o
......
......@@ -66,6 +66,7 @@ FindFileInPath(char *buffer, int buflen, char *rootname,
strncpy(buffer, dirname, buflen);
strncat(buffer, "/", buflen - strlen(buffer));
strncat(buffer, f->d_name, buflen - strlen(buffer));
closedir(d);
return buffer;
}
}
......
......@@ -665,6 +665,7 @@ void GetFileDateTime(struct sigcontext_struct *context)
struct stat filestat;
struct tm *now;
dirname = (char *) pointer(DS,DX);
ParseDOSFileName(unixname, dirname, &drive);
{
......@@ -872,7 +873,7 @@ int do_int21(struct sigcontext_struct * context){
case 0x12: /* FIND NEXT MATCHING FILE USING FCB */
case 0x13: /* DELETE FILE USING FCB */
case 0x14: /* SEQUENTIAL READ FROM FCB FILE */
case 0x15: /* SEQUENTIAL WRITE TO FCB FILE
case 0x15: /* SEQUENTIAL WRITE TO FCB FILE */
case 0x16: /* CREATE OR TRUNCATE FILE USING FCB */
case 0x17: /* RENAME FILE USING FCB */
case 0x1a: /* SET DISK TRANSFER AREA ADDRESS */
......@@ -888,7 +889,7 @@ int do_int21(struct sigcontext_struct * context){
case 0x2e: /* SET VERIFY FLAG */
break;
case 0x18: /* NULL FUNCTIONS FOR CP/M COMPATIBILITY *
case 0x18: /* NULL FUNCTIONS FOR CP/M COMPATIBILITY */
case 0x1d:
case 0x1e:
case 0x20:
......
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "prototypes.h"
#include "windows.h"
#include "win.h"
#include "gdi.h"
#include "wine.h"
/**********************************************************************
* LoadLibrary [KERNEL.95]
*/
HANDLE LoadLibrary(LPSTR libname)
{
HANDLE hRet;
printf("LoadLibrary '%s'\n", libname);
hRet = LoadImage(libname, NULL);
printf("after LoadLibrary hRet=%04X\n", hRet);
return hRet;
}
/**********************************************************************
* FreeLibrary [KERNEL.96]
*/
void FreeLibrary(HANDLE hLib)
{
printf("FreeLibrary(%04X);\n", hLib);
if (hLib != (HANDLE)NULL) GlobalFree(hLib);
}
......@@ -10,7 +10,8 @@
#include <linux/sched.h>
#include <asm/system.h>
#endif
#include <wine.h>
#include "wine.h"
#include "segmem.h"
char * cstack[4096];
struct sigaction segv_act;
......@@ -64,7 +65,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp){
/* Now take a look at the actual instruction where the program
bombed */
instr = (char *) ((scp->sc_cs << 16) | (scp->sc_eip & 0xffff));
instr = (char *) SAFEMAKEPTR(scp->sc_cs, scp->sc_eip);
if(*instr != 0xcd) {
fprintf(stderr,
......
......@@ -38,11 +38,13 @@ int Argc;
struct mz_header_s *CurrentMZHeader;
struct ne_header_s *CurrentNEHeader;
int CurrentNEFile;
HINSTANCE hSysRes;
static char *dllExtensions[] = { "dll", "exe", NULL };
static char *exeExtensions[] = { "exe", NULL };
static char *WinePath = NULL;
/**********************************************************************
* DebugPrintString
*/
......@@ -99,7 +101,7 @@ GetFileInfo(unsigned short instance)
* LoadImage
* Load one NE format executable into memory
*/
LoadImage(char * filename, char * modulename)
HINSTANCE LoadImage(char * filename, char * modulename)
{
unsigned int read_size;
int i;
......@@ -236,6 +238,7 @@ LoadImage(char * filename, char * modulename)
fprintf(stderr,"Unable to load:%s\n", buff);
}
return(wpnt->hinstance);
}
......@@ -278,6 +281,7 @@ _WinMain(int argc, char **argv)
}
LoadImage(exe_path, NULL);
hSysRes = LoadImage("sysres.dll", NULL);
if(ran_out) exit(1);
#ifdef DEBUG
......
......@@ -555,7 +555,7 @@ GlobalReAlloc(unsigned int block, unsigned int new_size, unsigned int flags)
* reallocate the block. If this fails, call GlobalAlloc() to get
* a new block.
*/
if (g->sequence = 0)
if (g->sequence == 0)
{
MDESC **free_list;
void *p;
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=dos.o kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
keyboard.o profile.o lstr.o exec.o
keyboard.o profile.o lstr.o exec.o message.o
default: misc.o
......
......@@ -41,7 +41,7 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
}
switch(fork()) {
case -1:
printf("Can'k 'fork' process !\n");
printf("Can't 'fork' process !\n");
break;
case 0:
printf("New process started !\n");
......@@ -68,7 +68,7 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
printf("WinHelp(%s, %u, %lu)\n", lpHelpFile, wCommand, dwData);
switch(fork()) {
case -1:
printf("Can'k 'fork' process !\n");
printf("Can't 'fork' process !\n");
break;
case 0:
printf("New process started !\n");
......
/*
* 'Wine' MessageBox function handling
*
* Copyright 1993 Martin Ayotte
*/
static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "windows.h"
#include "heap.h"
#include "win.h"
typedef struct tagMSGBOX {
LPSTR Title;
LPSTR Str;
WORD wType;
WORD wRetVal;
BOOL ActiveFlg;
HWND hWndYes;
HWND hWndNo;
HWND hWndCancel;
HICON hIcon;
} MSGBOX;
typedef MSGBOX FAR* LPMSGBOX;
LONG SystemMessageBoxProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
/**************************************************************************
* MessageBox [USER.1]
*/
int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
{
HWND hDlg;
WND *wndPtr;
WNDCLASS wndClass;
MSG msg;
MSGBOX mb;
wndPtr = WIN_FindWndPtr(hWnd);
printf( "MessageBox: '%s'\n", str );
wndClass.style = CS_HREDRAW | CS_VREDRAW ;
wndClass.lpfnWndProc = (WNDPROC)SystemMessageBoxProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = wndPtr->hInstance;
wndClass.hIcon = (HICON)NULL;
wndClass.hCursor = LoadCursor((HANDLE)NULL, IDC_ARROW);
wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = "MESSAGEBOX";
if (!RegisterClass(&wndClass)) return 0;
memset(&mb, 0, sizeof(MSGBOX));
mb.Title = title;
mb.Str = str;
mb.wType = type;
mb.ActiveFlg = TRUE;
hDlg = CreateWindow("MESSAGEBOX", title,
WS_POPUP | WS_DLGFRAME | WS_VISIBLE, 100, 150, 320, 120,
(HWND)NULL, (HMENU)NULL, wndPtr->hInstance, (LPSTR)&mb);
if (hDlg == 0) return 0;
while(TRUE) {
if (!mb.ActiveFlg) break;
if (!GetMessage(&msg, (HWND)NULL, 0, 0)) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
printf( "after MessageBox !\n");
if (!UnregisterClass("MESSAGEBOX", wndPtr->hInstance)) return 0;
return(mb.wRetVal);
}
LPMSGBOX MsgBoxGetStorageHeader(HWND hwnd)
{
WND *wndPtr;
LPMSGBOX lpmb;
wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == 0) {
printf("Bad Window handle on MessageBox !\n");
return 0;
}
lpmb = *((LPMSGBOX *)&wndPtr->wExtra[1]);
return lpmb;
}
LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
{
WND *wndPtr;
CREATESTRUCT *createStruct;
PAINTSTRUCT ps;
HDC hDC;
RECT rect;
LPMSGBOX lpmb;
LPMSGBOX lpmbInit;
BITMAP bm;
HBITMAP hBitMap;
HDC hMemDC;
HICON hIcon;
HINSTANCE hInst2;
int x;
switch(message) {
case WM_CREATE:
wndPtr = WIN_FindWndPtr(hWnd);
createStruct = (CREATESTRUCT *)lParam;
lpmbInit = (LPMSGBOX)createStruct->lpCreateParams;
if (lpmbInit == 0) break;
*((LPMSGBOX *)&wndPtr->wExtra[1]) = lpmbInit;
lpmb = MsgBoxGetStorageHeader(hWnd);
GetClientRect(hWnd, &rect);
switch(lpmb->wType & MB_TYPEMASK) {
case MB_OK :
lpmb->hWndYes = CreateWindow("BUTTON", "&Ok",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 70, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
break;
case MB_OKCANCEL :
lpmb->hWndYes = CreateWindow("BUTTON", "&Ok",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 70, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
lpmb->hWndCancel = CreateWindow("BUTTON", "&Cancel",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 10, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
break;
case MB_ABORTRETRYIGNORE :
lpmb->hWndYes = CreateWindow("BUTTON", "&Retry",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 70, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
lpmb->hWndNo = CreateWindow("BUTTON", "&Ignore",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 10, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
lpmb->hWndCancel = CreateWindow("BUTTON", "&Abort",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 80, rect.bottom - 25,
60, 18, hWnd, 3, wndPtr->hInstance, 0L);
break;
case MB_YESNO :
lpmb->hWndYes = CreateWindow("BUTTON", "&Yes",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 70, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
lpmb->hWndNo = CreateWindow("BUTTON", "&No",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 10, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
break;
}
switch(lpmb->wType & MB_ICONMASK) {
case MB_ICONEXCLAMATION:
printf("MsgBox LoadIcon Exclamation !\n");
lpmb->hIcon = LoadIcon((HINSTANCE)NULL, IDI_EXCLAMATION);
break;
case MB_ICONQUESTION:
printf("MsgBox LoadIcon Question !\n");
lpmb->hIcon = LoadIcon((HINSTANCE)NULL, IDI_QUESTION);
break;
case MB_ICONASTERISK:
printf("MsgBox LoadIcon Asterisk !\n");
lpmb->hIcon = LoadIcon((HINSTANCE)NULL, IDI_ASTERISK);
break;
case MB_ICONHAND:
printf("MsgBox LoadIcon Hand !\n");
lpmb->hIcon = LoadIcon((HINSTANCE)NULL, IDI_HAND);
break;
}
break;
case WM_PAINT:
lpmb = MsgBoxGetStorageHeader(hWnd);
GetClientRect(hWnd, &rect);
hDC = BeginPaint(hWnd, &ps);
if (lpmb->hIcon) DrawIcon(hDC, 30, 20, lpmb->hIcon);
TextOut(hDC, rect.right / 2, 15,
lpmb->Title, strlen(lpmb->Title));
TextOut(hDC, rect.right / 2, 30,
lpmb->Str, strlen(lpmb->Str));
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
printf("MessageBox WM_DESTROY !\n");
ReleaseCapture();
lpmb = MsgBoxGetStorageHeader(hWnd);
lpmb->ActiveFlg = FALSE;
if (lpmb->hIcon) DestroyIcon(lpmb->hIcon);
if (lpmb->hWndYes) DestroyWindow(lpmb->hWndYes);
if (lpmb->hWndNo) DestroyWindow(lpmb->hWndNo);
if (lpmb->hWndCancel) DestroyWindow(lpmb->hWndCancel);
break;
case WM_COMMAND:
lpmb = MsgBoxGetStorageHeader(hWnd);
switch(wParam) {
case 1:
lpmb->wRetVal = IDOK;
break;
case 2:
wndPtr = WIN_FindWndPtr(hWnd);
hDC = GetDC(hWnd);
/*
for (x = 1; x < 50; x++) {
hBitMap = LoadBitmap(wndPtr->hInstance, MAKEINTRESOURCE(x));
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC, hBitMap);
printf(" bm.bmWidth=%d bm.bmHeight=%d\n",
bm.bmWidth, bm.bmHeight);
BitBlt(hDC, x * 20, 30, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
}
*/
hBitMap = LoadBitmap((HINSTANCE)NULL, "SMILE");
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
printf("bm.bmWidth=%d bm.bmHeight=%d\n",
bm.bmWidth, bm.bmHeight);
hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC, hBitMap);
BitBlt(hDC, 100, 30, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
ReleaseDC(hWnd, hDC);
lpmb->wRetVal = IDCANCEL;
/*
SetWindowPos(lpmb->hWndNo, (HWND)NULL, 20, 20, 0, 0,
SWP_NOSIZE | SWP_NOZORDER);
*/
return 0;
break;
case 3:
hDC = GetDC(hWnd);
hInst2 = LoadImage("ev3lite.exe", NULL);
hIcon = LoadIcon(hInst2, "EV3LITE");
DrawIcon(hDC, 20, 20, hIcon);
DestroyIcon(hIcon);
hInst2 = LoadImage("sysres.dll", NULL);
hIcon = LoadIcon(hInst2, "WINEICON");
DrawIcon(hDC, 60, 20, hIcon);
DestroyIcon(hIcon);
hIcon = LoadIcon((HINSTANCE)NULL, IDI_EXCLAMATION);
DrawIcon(hDC, 1000, 20, hIcon);
DestroyIcon(hIcon);
ReleaseDC(hWnd, hDC);
lpmb->wRetVal = IDIGNORE;
return(0);
break;
default:
return(0);
}
CloseWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam );
}
return(0);
}
......@@ -53,11 +53,6 @@ void main(int argc, char **argv)
*/
int MessageBox( HWND hwnd, LPSTR str, LPSTR title, WORD type )
{
printf( "MessageBox: '%s'\n", str );
}
void MessageBeep( WORD i )
{
XBell(XT_display, 100);
......@@ -102,12 +97,6 @@ void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
}
BOOL IsIconic( HWND hwnd )
{
printf( "IsIconic: returning FALSE\n" );
return FALSE;
}
HMENU CreateMenu() { return 0; }
BOOL AppendMenu( HMENU hmenu, WORD flags, WORD id, LPSTR text ) { return TRUE;}
......
......@@ -19,7 +19,7 @@ extern Screen * XT_screen;
* We try to use a private color map if possible, because Windows programs
* assume that palette(0) == Black and palette(max-1) == White.
*/
#define USE_PRIVATE_MAP
#undef USE_PRIVATE_MAP
Colormap COLOR_WinColormap = 0;
......
......@@ -6,9 +6,11 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h>
#include <stdlib.h>
#include "gdi.h"
#include "icon.h"
extern XImage * BITMAP_BmpToImage( BITMAP *, void * );
......@@ -201,3 +203,45 @@ HBITMAP CreateDIBitmap( HDC hdc, BITMAPINFOHEADER * header, DWORD init,
bits, data, coloruse );
return handle;
}
/***********************************************************************
* DrawIcon (USER.84)
*/
BOOL DrawIcon(HDC hDC, short x, short y, HICON hIcon)
{
ICONALLOC *lpico;
BITMAP bm;
HBITMAP hBitTemp;
HDC hMemDC;
HDC hMemDC2;
#ifdef DEBUG_ICON
printf("DrawIcon(%04X, %d, %d, %04X) \n", hDC, x, y, hIcon);
#endif
if (hIcon == (HICON)NULL) return FALSE;
lpico = (ICONALLOC *)GlobalLock(hIcon);
GetObject(lpico->hBitmap, sizeof(BITMAP), (LPSTR)&bm);
#ifdef DEBUG_ICON
printf("DrawIcon / x=%d y=%d\n", x, y);
printf("DrawIcon / icon Width=%d\n", (int)lpico->descriptor.Width);
printf("DrawIcon / icon Height=%d\n", (int)lpico->descriptor.Height);
printf("DrawIcon / icon ColorCount=%d\n", (int)lpico->descriptor.ColorCount);
printf("DrawIcon / icon icoDIBSize=%lX\n", (DWORD)lpico->descriptor.icoDIBSize);
printf("DrawIcon / icon icoDIBOffset=%lX\n", (DWORD)lpico->descriptor.icoDIBOffset);
printf("DrawIcon / bitmap bmWidth=%d bmHeight=%d\n", bm.bmWidth, bm.bmHeight);
#endif
hMemDC = CreateCompatibleDC(hDC);
#ifdef DEBUG_ICON
SelectObject(hMemDC, lpico->hBitmap);
BitBlt(hDC, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, lpico->hBitMask);
BitBlt(hDC, x, y + bm.bmHeight, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
#else
SelectObject(hMemDC, lpico->hBitMask);
BitBlt(hDC, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCAND);
SelectObject(hMemDC, lpico->hBitmap);
BitBlt(hDC, x, y, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCPAINT);
#endif
DeleteDC(hMemDC);
return TRUE;
}
File added
/*------------------------------------------
BTNLOOK.C -- Button Look Program
------------------------------------------*/
#include <windows.h>
#include <stdio.h>
struct
{
long style;
char *text;
}
button[] =
{
BS_PUSHBUTTON, "PUSHBUTTON",
BS_DEFPUSHBUTTON, "DEFPUSHBUTTON",
BS_CHECKBOX, "CHECKBOX",
BS_AUTOCHECKBOX, "AUTOCHECKBOX",
BS_RADIOBUTTON, "RADIOBUTTON",
BS_3STATE, "3STATE",
BS_AUTO3STATE, "AUTO3STATE",
BS_GROUPBOX, "GROUPBOX",
BS_USERBUTTON, "USERBUTTON",
BS_AUTORADIOBUTTON, "AUTORADIOBUTTON"
};
#define NUM (sizeof button / sizeof button[0])
long FAR PASCAL _export WndProc(HWND, WORD, WORD, LONG);
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
static char szAppName[] = "BtnLook";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
RegisterClass(&wndclass);
}
hwnd = CreateWindow(szAppName, "Button Look",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
long FAR PASCAL _export WndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam)
{
static char szPrm[] = "wParam LOWORD(lParam) HIWORD(lParam)",
szTop[] = "Control ID Window Handle Notification",
szUnd[] = "__________ _____________ ____________",
szFormat[] = " %5u %4X %5u",
szBuffer[50];
static HWND hwndButton[NUM];
static RECT rect;
static int cxChar, cyChar;
HDC hdc;
PAINTSTRUCT ps;
int i;
TEXTMETRIC tm;
switch (message)
{
case WM_CREATE:
hdc = GetDC(hwnd);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
GetTextMetrics(hdc, &tm);
cxChar = tm.tmAveCharWidth;
cyChar = tm.tmHeight + tm.tmExternalLeading;
ReleaseDC(hwnd, hdc);
for (i = 0; i < NUM; i++)
hwndButton[i] = CreateWindow("button", button[i].text,
WS_CHILD | WS_VISIBLE | button[i].style,
cxChar, cyChar * (1 + 2 * i),
20 * cxChar, 7 * cyChar / 4,
hwnd, i,
((LPCREATESTRUCT) lParam)->hInstance, NULL);
return 0;
case WM_SIZE:
rect.left = 24 * cxChar;
rect.top = 3 * cyChar;
rect.right = LOWORD(lParam);
rect.bottom = HIWORD(lParam);
return 0;
case WM_PAINT:
InvalidateRect(hwnd, &rect, TRUE);
hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
SetBkMode(hdc, TRANSPARENT);
TextOut(hdc, 24 * cxChar, 1 * cyChar, szPrm, sizeof szPrm - 1);
TextOut(hdc, 24 * cxChar, 2 * cyChar, szTop, sizeof szTop - 1);
TextOut(hdc, 24 * cxChar, 2 * cyChar, szUnd, sizeof szUnd - 1);
EndPaint(hwnd, &ps);
return 0;
case WM_COMMAND:
/* ScrollWindow(hwnd, 0, -cyChar, &rect, &rect); */
hdc = GetDC(hwnd);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
TextOut(hdc, 24 * cxChar, cyChar * 5, /* (rect.bottom / cyChar - 1), */
szBuffer, sprintf(szBuffer, szFormat, wParam,
LOWORD(lParam), HIWORD(lParam)));
ReleaseDC(hwnd, hdc);
ValidateRect(hwnd, NULL);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
No preview for this file type
;**********************************************************************
;* Copyright (c) 1991 by TRG ELECTRONIK *
;**********************************************************************
NAME WineTest
DESCRIPTION 'Drink Inventry Controler'
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
EXETYPE WINDOWS
SEGMENTS
DRINK_TEXT PRELOAD MOVEABLE DISCARDABLE
HEAPSIZE 20000
STACKSIZE 8192
EXPORTS WndProc @1
About_Proc @3

\ No newline at end of file
/**********************************************************************
* Copyright (c) 1991 by TRG ELECTRONIK *
**********************************************************************/
#define szAppName "widgetClass"
#define IDNULL -1
#define IDSCLOSE 20
#define IDSOKCLOSE 21
#define IDSSAVE 22
#define IDSOKSAVE 23
#define IDINFO 24
#define IDSAVE 25
#define IDDELETE 26
#define IDNEW 27
#define IDBUSER 30
#define IDBUSER1 31
#define IDBUSER2 32
#define IDBUSER3 33
#define IDBUSER4 34
#define IDBUSER5 35
#define IDBUSER6 36
#define IDBUSER7 37
#define IDBUSER8 38
#define IDBUSER9 39
#define IDDJOBNAME 50
#define IDDPRINTER 51
#define IDSETUP 60
#define IDI_MKSICON 99
/******************************************/
#define MID_NEW 100
#define MID_OPEN 101
#define MID_SAVE 102
#define MID_SAVEAS 103
#define MID_PRINT 104
#define MID_PRSETUP 105
#define MID_STATUS 106
#define MID_QUIT 107
#define MID_CUT 121
#define MID_COPY 122
#define MID_PASTE 123
#define MID_CLEAR 124
#define MID_COPYTO 125
#define MID_PASTEFROM 126
#define MID_NEWPROD 140
#define MID_NEWBEER 141
#define MID_USERCFG 142
#define MID_POREGIE 151
#define MID_POBIERE 152
#define MID_DAYSTOCK 153
#define MID_RESERVE 154
#define MID_COCKSALE 155
#define MID_DRYSALE 156
#define MID_COMPILE 157
#define MID_RECETTES 158
#define MID_HD 159
#define MID_TESTPRN 160
#define MID_INFODSK 161
#define MID_SHARP 162
#define MID_PASSWORD 163
/******************************************/
#define IDDTEXT 200
#define IDDTXT1 201
#define IDDTXT2 202
#define IDDTXT3 203
#define IDDTXT4 204
#define IDDTXT5 205
#define IDDTXT6 206
#define IDDTXT7 207
#define IDDTXT8 208
#define IDDTXT9 209
#define IDDTXT10 210
#define IDDTXT11 211
#define IDDTXT12 212
#define IDDTXT13 213
#define IDDTXT14 214
#define IDDTXT15 215
#define IDDTXT16 216
#define IDDTXT17 217
#define IDDTXT18 218
#define IDDTXT19 219
#define IDDBUTTON1 220
#define IDDBUTTON2 221
#define IDDBUTTON3 222
#define IDDBUTTON4 223
#define IDDBUTTON5 224
#define IDDBUTTON6 225
#define IDDBUTTON7 226
#define IDDBUTTON8 227
#define IDDBUTTON9 228
#define IDDBUTTON10 229
#define IDDCHKBOX1 240
#define IDDCHKBOX2 241
#define IDDCHKBOX3 242
#define IDDCHKBOX4 243
#define IDDCHKBOX5 244
#define IDDCHKBOX6 245
#define IDDCHKBOX7 246
#define IDDCHKBOX8 247
#define IDDCHKBOX9 248
#define IDDCHKBOX10 249
#define IDDSCROLL1 250
#define IDDSCROLL2 251
#define IDDSCROLL3 252
#define IDDSCROLL4 253
#define IDDSCROLL5 254
#define IDDSCROLL6 255
#define IDDSCROLL7 256
#define IDDSCROLL8 257
#define IDDSTR1 2000
#define IDDSTR2 2001
#define IDDSTR3 2002
#define IDDSTR4 2003
#define IDDSTR5 2004
#define IDDSTR6 2005
#define IDDSTR7 2006
#define IDDSTR8 2007
#define IDDSTR9 2008
#define IDDSTR10 2009
#define IDDSTR11 2010
#define IDDSTR12 2011
#define IDDSTR13 2012
#define IDDSTR14 2013
#define IDDSTR15 2014
#define IDDSTR16 2015
#define IDDSTR17 2016
#define IDDSTR18 2017
#define IDDSTR19 2018
#define IDDSTR20 2019
#define IDDSTR21 2020
#define IDDSTR22 2021
#define IDDSTR23 2022
#define IDDSTR24 2023
#define IDDSTR25 2024
#define IDDSTR26 2025
#define IDDSTR27 2026
#define IDDSTR28 2027
#define IDDSTR29 2028
#define IDDSTR30 2029
#define IDDSTR31 2030
#define IDDSTR32 2031
#define IDDSTR33 2032
#define IDDSTR34 2033
#define IDDSTR35 2034
#define IDDSTR36 2035
#define IDDSTR37 2036
#define IDDSTR38 2037
#define IDDSTR39 2038
#define IDDSTR40 2039
#define IDDSTR41 2040
#define IDDSTR42 2041
#define IDDSTR43 2042
#define IDDSTR44 2043
#define IDDSTR45 2044
#define IDDSTR46 2045
#define IDDSTR47 2046
#define IDDSTR48 2047
#define IDDSTR49 2048
#define IDDSTR50 2049
#define IDDSTR51 2050
#define IDDSTR52 2051
#define IDDSTR53 2052
#define IDDSTR54 2053
#define IDDSTR55 2054
#define IDDSTR56 2055
#define IDDSTR57 2056
#define IDDSTR58 2057
#define IDDSTR59 2058
#define IDDSTR60 2059
#define IDDSTR61 2060
#define IDDSTR62 2061
#define IDDSTR63 2062
#define IDDSTR64 2063
#define IDDSTR65 2064
#define IDDSTR66 2065
#define IDDSTR67 2066
#define IDDSTR68 2067
#define IDDSTR69 2068
#define IDDSTR70 2069
/******************************************/
#define IDDDEFAULTS 1001
#define IDDCHECKBOX 1002
#define IDDNULL 1003
#define IDDRBLEFT 1004
#define IDDRBRIGHT 1005
#define IDDRBCENTER 1006
#define IDDLISTBOX 1007
#define IDDSBH 1008
#define IDDSBV 1009
/******************************************/
#define ABOUT_Dlg 2001
#define NEW_Dlg 2002
#define OPEN_Dlg 2003
#define SAVE_Dlg 2004
#define SAVEAS_Dlg 2005
#define PRINT_Dlg 2006
#define ABORT_Dlg 2007
#define PRSETUP_Dlg 2008
#define QUIT_Dlg 2009
#define GETOBJ_Dlg 2020
#define NEWPROD_Dlg 2021
#define NEWBEER_Dlg 2022
#define USERCFG_Dlg 2023
#define POREGIE_Dlg 2024
#define POBIERE_Dlg 2025
#define PASSWORD_Dlg 2026
#define TVQ_Dlg 2027
#define LTEXTOK_Dlg 2070
/******************************************/
#define RED 0x000000FF
#define GREEN 0x0000FF00
#define BLUE 0x00FF0000
#define CYAN 0x00FFFF00
#define MAGENTA 0x00FF00FF
#define BLACK 0x00000000
#define WHITE 0x00FFFFFF
#define GRAY 0x00808080
#define LTGRAY 0x00C0C0C0
#define DKGRAY 0x00404040

\ No newline at end of file
/**********************************************************************
* Copyright (c) 1991 by TRG ELECTRONIK *
* *
* widget.RC *
* widget RESSOURCES *
* *
**********************************************************************/
#include <\BC\INCLUDE\WINDOWS.H>
#include "widget.H"
#define TABGRP WS_TABSTOP | WS_GROUP
#define LBSTYLES WS_VSCROLL | WS_BORDER | WS_VISIBLE | LBS_SORT | TABGRP
#define HSCROLL WS_VISIBLE | SBS_HORZ | SBS_TOPALIGN | TABGRP
#define VSCROLL WS_VISIBLE | SBS_VERT | SBS_LEFTALIGN | TABGRP
#define BLACKRECT SS_BLACKRECT | WS_VISIBLE | WS_GROUP
#define WHITEFRAME SS_WHITEFRAME | WS_VISIBLE | WS_GROUP
ICON_1 ICON widget.ICO
ICON_2 ICON widget.IC2
ICON_3 ICON widget.IC3
MENU_1 MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New", MID_NEW
MENUITEM "&Open", MID_OPEN
MENUITEM "&Save", MID_SAVE
MENUITEM "Save &As", MID_SAVEAS
MENUITEM SEPARATOR
MENUITEM "&Quit!", MID_QUIT
END
END
ABOUT_Dlg DIALOG 100, 100, 154, 75
STYLE WS_POPUP | WS_DLGFRAME
BEGIN
ICON "widget" -1, 9, 23, 0, 0
ICON "DKICON2" -1, 30, 23, 0, 0
ICON "DKICON3" -1, 50, 23, 0, 0
CTEXT "About widget Inventory Controler" -1, 0, 14,154, 8
CTEXT "Version 0.50" -1, 30, 34, 94, 8
CTEXT "Copyright 1991, TRG Electronik" -1, 0, 47,154, 9
DEFPUSHBUTTON "Ok" IDOK, 61, 59, 32, 14, WS_GROUP
END
LTEXTOK_Dlg DIALOG 100, 100, 300, 120
STYLE WS_POPUP | WS_DLGFRAME
BEGIN
LTEXT "", IDDTXT1, 20, 15,118, 12
LTEXT "", IDDTXT2, 20, 30,118, 25
LTEXT "", IDDTXT3, 20, 45,118, 35
LTEXT "", IDDTXT3, 20, 60,118, 35
DEFPUSHBUTTON "OK", IDOK, 150, 85, 40, 14, TABGRP
END
STRINGTABLE
BEGIN
IDDSTR1, "Wine Test Program"
IDDSTR2, ""
IDDSTR3, ""
IDDSTR4, ""
IDDSTR5, ""
IDDSTR6, ""
IDDSTR7, ""
IDDSTR8, ""
IDDSTR9, ""
IDDSTR10, ""
END

\ No newline at end of file
No preview for this file type
......@@ -2,7 +2,7 @@ CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=class.o dc.o dce.o event.o message.o win.o timer.o graphics.o \
clipping.o mapping.o painting.o keyboard.o utility.o syscolor.o \
defwnd.o defdlg.o dialog.o focus.o
defwnd.o defdlg.o dialog.o focus.o scroll.o
default: windows.o
......
......@@ -16,8 +16,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */
#define DBLCLICK_TIME 300 /* Max. time for a double click (milliseconds) */
static WORD dblclick_time = 300; /* Max. time for a double click (milliseconds) */
/* Event handlers */
static void EVENT_expose();
......@@ -191,7 +190,7 @@ static void EVENT_mouse_button( Widget w, int hwnd, XButtonEvent *event,
{ /* Check if double-click */
prevTime = lastClickTime[buttonNum];
lastClickTime[buttonNum] = event->time;
if (event->time - prevTime < DBLCLICK_TIME)
if (event->time - prevTime < dblclick_time)
{
WND * wndPtr;
CLASS * classPtr;
......@@ -329,3 +328,24 @@ void ReleaseCapture()
captureWnd = 0;
}
/**********************************************************************
* SetDoubleClickTime (USER.20)
*/
void SetDoubleClickTime (WORD interval)
{
if (interval == 0)
dblclick_time = 500;
else
dblclick_time = interval;
}
/**********************************************************************
* GetDoubleClickTime (USER.21)
*/
WORD GetDoubleClickTime ()
{
return ((WORD)dblclick_time);
}
/*
* Scroll windows and DCs
*
* Copyright David W. Metcalfe, 1993
*
*/
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
#include <stdlib.h>
#include "windows.h"
#include "gdi.h"
static int RgnType;
/*************************************************************************
* ScrollWindow (USER.61)
*/
void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect)
{
HDC hdc;
HRGN hrgnUpdate;
RECT rc, cliprc;
#ifdef DEBUG_SCROLL
printf("ScrollWindow: dx=%d, dy=%d, rect=%d,%d,%d,%d\n", dx, dy,
rect->left, rect->top, rect->right, rect->bottom);
#endif
hdc = GetDC(hwnd);
if (rect == NULL)
GetWindowRect(hwnd, &rc);
else
CopyRect(&rc, rect);
if (clipRect == NULL)
GetWindowRect(hwnd, &cliprc);
else
CopyRect(&cliprc, clipRect);
hrgnUpdate = CreateRectRgn(0, 0, 0, 0);
ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL);
InvalidateRgn(hwnd, hrgnUpdate, TRUE);
ReleaseDC(hwnd, hdc);
}
/*************************************************************************
* ScrollDC (USER.221)
*/
BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc,
HRGN hrgnUpdate, LPRECT rcUpdate)
{
HRGN hrgnClip, hrgn1, hrgn2;
POINT src, dest;
short width, height;
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
#ifdef DEBUG_SCROLL
printf("ScrollDC: dx=%d, dy=%d, rc=%d,%d,%d,%d\n", dx, dy,
rc->left, rc->top, rc->right, rc->bottom);
#endif
if (rc == NULL)
return;
if (cliprc)
{
hrgnClip = CreateRectRgnIndirect(cliprc);
SelectClipRgn(hdc, hrgnClip);
}
if (dx > 0)
{
src.x = XDPTOLP(dc, rc->left);
dest.x = XDPTOLP(dc, rc->left + abs(dx));
}
else
{
src.x = XDPTOLP(dc, rc->left + abs(dx));
dest.x = XDPTOLP(dc, rc->left);
}
if (dy > 0)
{
src.y = YDPTOLP(dc, rc->top);
dest.y = YDPTOLP(dc, rc->top + abs(dy));
}
else
{
src.y = YDPTOLP(dc, rc->top + abs(dy));
dest.y = YDPTOLP(dc, rc->top);
}
width = rc->right - rc->left - abs(dx);
height = rc->bottom - rc->top - abs(dy);
if (!BitBlt(hdc, dest.x, dest.y, width, height, hdc, src.x, src.y,
SRCCOPY))
return;
if (hrgnUpdate)
{
if (dx > 0)
hrgn1 = CreateRectRgn(rc->left, rc->top, rc->left+dx, rc->bottom);
else if (dx < 0)
hrgn1 = CreateRectRgn(rc->right+dx, rc->top, rc->right,
rc->bottom);
else
hrgn1 = CreateRectRgn(0, 0, 0, 0);
if (dy > 0)
hrgn2 = CreateRectRgn(rc->left, rc->top, rc->right, rc->top+dy);
else if (dy < 0)
hrgn2 = CreateRectRgn(rc->left, rc->bottom+dy, rc->right,
rc->bottom);
else
hrgn2 = CreateRectRgn(0, 0, 0, 0);
RgnType = CombineRgn(hrgnUpdate, hrgn1, hrgn2, RGN_OR);
}
if (rcUpdate)
{
SelectClipRgn(hdc, hrgnUpdate);
GetClipBox(hdc, rcUpdate);
}
}
/*************************************************************************
* ScrollWindowEx (USER.319)
*/
int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect,
HRGN hrgnUpdate, LPRECT rcUpdate, WORD flags)
{
HDC hdc;
RECT rc, cliprc;
#ifdef DEBUG_SCROLL
printf("ScrollWindowEx: dx=%d, dy=%d, rect=%d,%d,%d,%d\n", dx, dy,
rect->left, rect->top, rect->right, rect->bottom);
#endif
hdc = GetDC(hwnd);
if (rect == NULL)
GetWindowRect(hwnd, &rc);
else
CopyRect(&rc, rect);
if (clipRect == NULL)
GetWindowRect(hwnd, &cliprc);
else
CopyRect(&cliprc, clipRect);
ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate);
if (flags | SW_INVALIDATE)
{
InvalidateRgn(hwnd, hrgnUpdate, FALSE);
if (flags | SW_ERASE)
SendMessage(hwnd, WM_ERASEBKGND, (WORD)hdc, (LONG)NULL);
}
ReleaseDC(hwnd, hdc);
return RgnType;
}
......@@ -52,9 +52,11 @@ HWND WIN_FindWinToRepaint( HWND hwnd )
WND * wndPtr;
if (!hwnd) hwnd = firstWindow;
while (hwnd)
for ( ; hwnd != 0; hwnd = wndPtr->hwndNext )
{
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
if (!wndPtr || !wndPtr->winWidget) continue;
if (!XtIsRealized( wndPtr->winWidget )) continue;
if (wndPtr->hrgnUpdate) return hwnd;
if (wndPtr->hwndChild)
{
......@@ -62,7 +64,6 @@ HWND WIN_FindWinToRepaint( HWND hwnd )
if ((child = WIN_FindWinToRepaint( wndPtr->hwndChild )))
return child;
}
hwnd = wndPtr->hwndNext;
}
return 0;
}
......@@ -122,8 +123,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
if (y == CW_USEDEFAULT) y = 0;
if (width == CW_USEDEFAULT) width = 600;
if (height == CW_USEDEFAULT) height = 400;
if (!width) width = 1;
if (!height) height = 1;
if (width == 0) width = 1;
if (height == 0) height = 1;
/* Find the parent and class */
......@@ -135,9 +136,10 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
}
else if (style & WS_CHILD) return 0; /* WS_CHILD needs a parent */
if (!(class = CLASS_FindClassByName( className, &classPtr )))
if (!(class = CLASS_FindClassByName( className, &classPtr ))) {
printf("CreateWindow BAD CLASSNAME '%s' !\n", className);
return 0;
}
/* Create the window structure */
hwnd = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(WND)+classPtr->wc.cbWndExtra);
......@@ -250,6 +252,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
formWidgetClass,
wndPtr->shellWidget,
NULL );
/* wndPtr->winWidget = wndPtr->compositeWidget; */
wndPtr->winWidget = wndPtr->shellWidget;
if (wndPtr->wIDmenu == 0)
{
wndPtr->menuBarPtr =
......@@ -322,8 +326,13 @@ WinCreated:
if (wmcreate == -1)
{
/* Abort window creation */
if (parent) parentPtr->hwndChild = wndPtr->hwndNext;
else firstWindow = wndPtr->hwndNext;
if (wndPtr->shellWidget) XtDestroyWidget( wndPtr->shellWidget );
else XtDestroyWidget( wndPtr->winWidget );
if (wndPtr->hdc) DeleteDC( wndPtr->hdc );
classPtr->cWindows--;
USER_HEAP_FREE( hwnd );
return 0;
}
......@@ -446,28 +455,32 @@ BOOL ShowWindow( HWND hwnd, int cmd )
XtNwidth, &width,
XtNheight, &height,
NULL );
SendMessage( hwnd, WM_SIZE, SIZE_RESTORED,
(width & 0xffff) | (height << 16) );
SendMessage( hwnd, WM_SHOWWINDOW, TRUE, 0 );
/*
printf("ShowWindow(%X, %X); !\n", hwnd, cmd);
*/
switch(cmd)
{
case SW_HIDE:
XtSetMappedWhenManaged(wndPtr->winWidget, FALSE);
wndPtr->dwStyle &= (WS_VISIBLE ^ 0xFFFFFFFL);
SendMessage( hwnd, WM_SHOWWINDOW, FALSE, 0 );
break;
case SW_SHOWNA:
case SW_SHOWMINNOACTIVE:
case SW_SHOWNOACTIVATE:
case SW_SHOWMINIMIZED:
case SW_MINIMIZE:
wndPtr->dwStyle |= WS_ICONIC;
goto WINVisible;
case SW_SHOWNA:
case SW_SHOWNOACTIVATE:
case SW_MAXIMIZE:
case SW_SHOWMAXIMIZED:
case SW_SHOWMINIMIZED:
case SW_SHOW:
case SW_NORMAL:
case SW_SHOWNORMAL:
wndPtr->dwStyle &= (WS_ICONIC ^ 0xFFFFFFFL);
WINVisible:
XtSetMappedWhenManaged(wndPtr->winWidget, TRUE);
wndPtr->dwStyle |= WS_VISIBLE;
SendMessage( hwnd, WM_SIZE, SIZE_RESTORED,
(width & 0xffff) | (height << 16) );
SendMessage( hwnd, WM_SHOWWINDOW, TRUE, 0 );
break;
default:
break;
......@@ -478,6 +491,42 @@ BOOL ShowWindow( HWND hwnd, int cmd )
/***********************************************************************
* CloseWindow (USER.43)
*/
void CloseWindow(HWND hWnd)
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr->dwStyle & WS_CHILD) return;
ShowWindow(hWnd, SW_MINIMIZE);
PostMessage(hWnd, WM_CLOSE, 0, 0L);
}
/***********************************************************************
* OpenIcon (USER.44)
*/
BOOL OpenIcon(HWND hWnd)
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (!IsIconic(hWnd)) return FALSE;
ShowWindow(hWnd, SW_SHOWNORMAL);
return(TRUE);
}
/***********************************************************************
* FindWindow (USER.50)
*/
HWND FindWindow(LPSTR ClassMatch, LPSTR TitleMatch)
{
return((HWND)NULL);
}
/***********************************************************************
* MoveWindow (USER.56)
*/
void MoveWindow(HWND hWnd, short x, short y, short w, short h, BOOL bRepaint)
......@@ -508,7 +557,9 @@ void MoveWindow(HWND hWnd, short x, short y, short w, short h, BOOL bRepaint)
void UpdateWindow( HWND hwnd )
{
if (GetUpdateRect( hwnd, NULL, FALSE ))
SendMessage( hwnd, WM_PAINT, 0, 0 );
{
if (IsWindowVisible( hwnd )) SendMessage( hwnd, WM_PAINT, 0, 0 );
}
}
/**********************************************************************
......@@ -578,17 +629,17 @@ void SetWindowPos(HWND hWnd, HWND hWndInsertAfter, short x, short y, short w, sh
WND * wndPtr = WIN_FindWndPtr( hWnd );
if (wndPtr)
{
if ((wFlag & SWP_NOMOVE) == 0) {
if ((wFlag & SWP_NOMOVE) != SWP_NOMOVE) {
wndPtr->rectClient.left = x;
wndPtr->rectClient.top = y;
XtVaSetValues(wndPtr->winWidget, XtNx, x, XtNy, y, NULL );
}
if ((wFlag & SWP_NOSIZE) == 0) {
if ((wFlag & SWP_NOSIZE) != SWP_NOSIZE) {
wndPtr->rectClient.right = x + w;
wndPtr->rectClient.bottom = y + h;
XtVaSetValues(wndPtr->winWidget, XtNwidth, w, XtNheight, h, NULL );
}
if ((wFlag & SWP_NOREDRAW) == 0) {
if ((wFlag & SWP_NOREDRAW) != SWP_NOREDRAW) {
InvalidateRect(hWnd, NULL, TRUE);
UpdateWindow(hWnd);
}
......@@ -597,8 +648,10 @@ void SetWindowPos(HWND hWnd, HWND hWndInsertAfter, short x, short y, short w, sh
if ((wFlag & SWP_SHOWWINDOW) == SWP_SHOWWINDOW)
ShowWindow(hWnd, SW_SHOW);
/*
if ((wFlag & SWP_NOACTIVATE) == 0)
if ((wFlag & SWP_NOACTIVATE) != SWP_NOACTIVATE)
SetActiveWindow(hWnd);
if ((wFlag & SWP_NOZORDER) != SWP_NOZORDER)
{ }
*/
printf("SetWindowPos(%X, %X, %d, %d, %d, %d, %X); !\n",
hWnd, hWndInsertAfter, x, y, w, h, wFlag);
......@@ -695,16 +748,21 @@ LONG SetWindowLong( HWND hwnd, short offset, LONG newval )
}
/*****************************************************************
* GetParent (USER.46)
/***********************************************************************
* IsIconic (USER.31)
*/
HWND GetParent(HWND hwnd)
BOOL IsIconic(HWND hWnd)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
return wndPtr->hwndParent;
WND * wndPtr;
if (hWnd == 0) return(FALSE);
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) return(FALSE);
if (wndPtr->dwStyle & WS_ICONIC) return(TRUE);
return(FALSE);
}
/*******************************************************************
* GetWindowText (USER.36)
*/
......@@ -733,6 +791,26 @@ int GetWindowTextLength(HWND hwnd)
/*******************************************************************
* IsWindow (USER.47)
*/
BOOL IsWindow( HWND hwnd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
return (wndPtr->dwMagic == WND_MAGIC);
}
/*****************************************************************
* GetParent (USER.46)
*/
HWND GetParent(HWND hwnd)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
return wndPtr->hwndParent;
}
/*******************************************************************
* IsChild (USER.48)
*/
BOOL IsChild( HWND parent, HWND child )
......@@ -755,6 +833,23 @@ BOOL IsChild( HWND parent, HWND child )
}
/***********************************************************************
* IsWindowVisible (USER.49)
*/
BOOL IsWindowVisible(HWND hWnd)
{
WND * wndPtr;
if (hWnd == 0) return(FALSE);
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) return(FALSE);
if (wndPtr->dwStyle & WS_VISIBLE) {
if (XtIsRealized(wndPtr->winWidget)) return(TRUE);
}
return(FALSE);
}
/*******************************************************************
* GetTopWindow (USER.229)
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment