Skip to content
Snippets Groups Projects
Commit f0b2354c authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

Release 0.4.3

Tue Sep 28 19:59:21 1993  David Metcalfe

	* [windows/win.c]
	Implemented support for windows with no borders.  Added
 	GetParent(), GetDlgCtrlID(), GetWindowText() and
	GetWindowTextLength() functions.

	* [misc/xt.c]
	Added processing of WM_GETTEXT and WM_GETTEXTLENGTH messages
	to DefWindowProc and Implemented MessageBeep().

	* [windows/syscolor.c]
	Added preliminary system color support.

	* [controls/button1.c]
	Mods to new button control and integration with Wine.

Tue Sep 28 19:59:21 1993  Johannes Ruscheinski

	* [controls/button1.c]
	New button control using GDI functions.
	
Tue Sep 28 19:59:21 1993  Eric Youngdale

	* [debugger/*]
	Added debugging capabilities to Wine

Sat Sep 25 13:22:50 1993  Alexandre Julliard  (julliard@di.epfl.ch)

	* [objects/region.c]
	Bug fix

Fri Sep 24 07:35:11 1993  Bob Amstadt  (bob at pooh)

	* [tools/build.c]
	Changed the entry point code to reduce the standard entry
	point size from 22 bytes to 10 bytes.  This leaves about
	4000 free entry points instead of the 800 in version 0.4.2.

	* [loader/resource.c]
	Rewrote functions to allow loading of resources from any
	DLL.

	* [loader/wine.c] [include/wine.h]
	Added functions GetFilenameFromInstance() and GetFileInfo()
	to search for a loaded file based on its instance handle.
	Added a field in struct w_files to make searching by an instance
	handle faster.

Tue Sep 21 09:57:01 1993  miguel@roxanne.nuclecu.unam.mx (Miguel de Icaza)

	* [misc/profile.c]
	Implementation of .INI file handling

Mon Sep 20 10:54:32 1993  David Metcalfe

	* [misc/profile.c.old]
	Implementation of .INI file handling

Mon Sep 20 10:54:32 1993  John Brezak

	* [controls/WinButton.c]
	Bug fix with call to XtVaSetValues.

Mon Sep 20 10:54:32 1993  Alexandre Julliard

	* [windows/win.c]
	Quick patch to get colormaps to work with button widget.

Mon Sep 20 02:42:54 1993    (yngvi@hafro.is)

	* misc/keyboard.c: 
	Ifdefed out some bogus Ansi<->Oem conversion functions

	* misc/lstr.c: 
	New file with string functions like lstr* IsChar* *Ansi* 

Wed Sep 15 20:35:10 1993  John Brezak

	* [loader/signal.c]
	Additional changes to support NetBSD.

Wed Sep 15 22:19:22 1993  Martin Ayotte

	* [windows/graphics.c]
	Added FrameRect function

Tue Sep 14 13:54:45 1993  Alexandre Julliard

	* [objects/color.c] [objects/palette.c]
	Preliminary support for private color map.

	* [windows/class.c]
	Implemented CS_CLASSDC style.

	* [windows/dce.c]
	Moved DCEs to USER heap.
	Implemented class and window DCs.

	* [windows/event.c]
	Implemented CS_DBLCLKS style.

	* [windows/graphics.c]
	Bug fix in SetPixel().

	* [windows/win.c]	
	Implemented CS_OWNDC style.
	Implemented Get/SetWindowLong().

	* [controls/menu.c] [windows/class.c] [windows/clipping.c] 
	  [windows/dce.c] [windows/message.c] [windows/win.c]	
	Moved windows from global heap to USER heap.
parent f41aeca9
Branches
Tags wine-960616
No related merge requests found
This diff is collapsed.
Tue Sep 28 19:59:21 1993 David Metcalfe
* [windows/win.c]
Implemented support for windows with no borders. Added
GetParent(), GetDlgCtrlID(), GetWindowText() and
GetWindowTextLength() functions.
* [misc/xt.c]
Added processing of WM_GETTEXT and WM_GETTEXTLENGTH messages
to DefWindowProc and Implemented MessageBeep().
* [windows/syscolor.c]
Added preliminary system color support.
* [controls/button1.c]
Mods to new button control and integration with Wine.
Tue Sep 28 19:59:21 1993 Johannes Ruscheinski
* [controls/button1.c]
New button control using GDI functions.
Tue Sep 28 19:59:21 1993 Eric Youngdale
* [debugger/*]
Added debugging capabilities to Wine
Sat Sep 25 13:22:50 1993 Alexandre Julliard (julliard@di.epfl.ch)
* [objects/region.c]
Bug fix
Fri Sep 24 07:35:11 1993 Bob Amstadt (bob at pooh)
* [tools/build.c]
Changed the entry point code to reduce the standard entry
point size from 22 bytes to 10 bytes. This leaves about
4000 free entry points instead of the 800 in version 0.4.2.
* [loader/resource.c]
Rewrote functions to allow loading of resources from any
DLL.
* [loader/wine.c] [include/wine.h]
Added functions GetFilenameFromInstance() and GetFileInfo()
to search for a loaded file based on its instance handle.
Added a field in struct w_files to make searching by an instance
handle faster.
Tue Sep 21 09:57:01 1993 miguel@roxanne.nuclecu.unam.mx (Miguel de Icaza)
* [misc/profile.c]
Implementation of .INI file handling
Mon Sep 20 10:54:32 1993 David Metcalfe
* [misc/profile.c.old]
Implementation of .INI file handling
Mon Sep 20 10:54:32 1993 John Brezak
* [controls/WinButton.c]
Bug fix with call to XtVaSetValues.
Mon Sep 20 10:54:32 1993 Alexandre Julliard
* [windows/win.c]
Quick patch to get colormaps to work with button widget.
Mon Sep 20 02:42:54 1993 (yngvi@hafro.is)
* misc/keyboard.c:
Ifdefed out some bogus Ansi<->Oem conversion functions
* misc/lstr.c:
New file with string functions like lstr* IsChar* *Ansi*
Wed Sep 15 20:35:10 1993 John Brezak
* [loader/signal.c]
Additional changes to support NetBSD.
Wed Sep 15 22:19:22 1993 Martin Ayotte
* [windows/graphics.c]
Added FrameRect function
Tue Sep 14 13:54:45 1993 Alexandre Julliard
* [objects/color.c] [objects/palette.c]
Preliminary support for private color map.
* [windows/class.c]
Implemented CS_CLASSDC style.
* [windows/dce.c]
Moved DCEs to USER heap.
Implemented class and window DCs.
* [windows/event.c]
Implemented CS_DBLCLKS style.
* [windows/graphics.c]
Bug fix in SetPixel().
* [windows/win.c]
Implemented CS_OWNDC style.
Implemented Get/SetWindowLong().
* [controls/menu.c] [windows/class.c] [windows/clipping.c]
[windows/dce.c] [windows/message.c] [windows/win.c]
Moved windows from global heap to USER heap.
Mon Sep 13 05:00:11 1993 Eric Youngdale
* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
......
......@@ -3,14 +3,15 @@
DEBUGOPTS=
COPTS=-O2 -m486
INCLUDE_DIR=include
LDFLAGS=
######################################################################
# These definitions are for the top level
TARGET=wine
LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o
SUBDIRS=if1632 controls loader memory misc objects windows
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
SUBDIRS=if1632 controls loader memory misc objects windows debugger
all: $(TARGET)
......
......@@ -7,14 +7,13 @@ INSTALLATION:
Linux:
Uncompress and untar this archive into the directory of your
choice. This release requires a Linux version 0.99 pl12 kernel with
ALPHA-pl13-diffs.
choice. This release requires a Linux version 0.99 pl13 kernel
or above.
NetBSD:
If you use BSD make rather than GNU make, you must apply the patches
in the file "bsdmake.patch". This release requires NetBSD 0.9 with
additional patches.
in the file "bsdmake.patch". This release requires NetBSD-current.
All:
......@@ -28,6 +27,24 @@ Grab a copy of Windows sol.exe (Solitaire) and run it with the command:
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.3: (see ChangeLog for details)
- Bug fixes
- Resource loading now able to load DLL resources
- Button control now based on GDI calls
- Preliminary system color support
- Miscellaneous window functions
- Limited debugging facility (sometimes hangs)
WHAT'S NEW with version 0.4.2: (see ChangeLog for details)
- Bug fixes
- 32-bit callback functions allowed
- .INI file handling
- lstr* functions and ANSI<->OEM conversion functions.
WHAT'S NEW with version 0.4.1: (see ChangeLog for details)
- Bug fixes
- Memory usage changes.
WHAT'S NEW with version 0.4.0: (see ChangeLog for details)
- Wine now compiles and runs under NetBSD. Patches are
required for NetBSD.
......
Date: Sun, 26 Sep 93 03:18:19 EDT
From: eric@tantalus.nrl.navy.mil (Eric Youngdale)
Message-Id: <9309260718.AA13966@tantalus.nrl.navy.mil>
To: bob@amscons.amscons.com
Cc: linux-activists@Niksula.hut.fi
In-Reply-To: Bob Amstadt's message of Sat, 25 Sep 1993 23:36:32 +0300
<m0oggMt-000CrhC@amscons.amscons.com>
X-Mn-Key: WABI
>I may just be dreaming, but I'm beginning to like the idea of a built
>in debugger.
So do I. I like it so much that I wrote one. It turns out that the
disassembly code in gdb is pretty much localized to one source file, and this
was easy to splice into a simple program. In addition, there are 2 variables
that you set if you are disassembling 16 bit code, so it makes it all the
better.
Anyway, there is a parser that understands a limited set of gdb
commands (very limited, but the 'x' command is pretty functional as long as you
stick to numeric rather than symbolic addresses). The parser understands $pc
and $sp for your convenience, and you can do things like "x/10i $pc" and "info
regs" to see what is going on. In principle you can do "x/x", "x/s", "x/d",
"x/w", "x/b", "x/i" and "x/c". I implemented an "info stack" command that
simply dumps a number of bytes from the stack onto the screen, but it currently
makes no attempt to actually interpret the stack frames.
This will probably not work on non-linux systems, and I have no idea
how much work it will be to fix it. To start with we need some simple macros
to determine (based upon a segment selector) whether we are in a 16 bit or a 32
bit segment, but this should be pretty easy to fix. I shamelessly ripped off a
bunch of files from gdb, and I obviously picked the ones for linux. For other
systems you may need to make adjustments to these files somehow. It is too
late in the evening to worry about this now.
It will probably be easy to modify the parser to allow you to change
memory locations and/or register values and then continue execution. Also,
some of the hooks for using readline with the parser are in place, but it does
not work reliably for some reason, so I left it out for now. Adding gnu
readline really would bloat the package a lot. Instead I could use Rich Salz's
editlib (the canonical test case for the DLL tools), which has a command line
history feature that could be an acceptable substitute - this is much smaller
than gnu readline, but I am not sure what features are present.
-Eric
In this directory you might find my implemantation of the Windows
String. The patch lstr.patch includes whats needed for the following
functions:
lstrcat,lstrcmp,lstrcmpi,lstrcpy,lstrcpyn,lstrlen,AnsiUpper,AnsiLower,
IsCharAlpha,IsCharAlphanumeric,IsCharUpper,IsCharLower,AnsiUpperBuff,
AnsiLowerBuff,AnsiNext,AnsiPrev. Simply apply the patch to Wine.0.4.1
and remake.
Also there should be the files oem2ansi.trl and ansi2oem.trl that
define how to translate between ansi and oem codepage 861 I believe
they call it. These files where created by the Windows program
oemansi.exe which is also included. To get the oem<->ansi translations
right for your part of the world just run oemansi under Windows not
Wine and oemansi will create oem2ansi and ansi2oem for your locale
that is if your Windows/Dos is set up correctly. Move the .trl files
into the directory from where you run wine. If Wine does not find the
*.trl in the current directory AnsiToOem and OemToAnsi will be
passive.
Shortcomings/Bugs:
Some functions depend upon libc functions like toupper, tolower and
isalpha that, as far as I know, are totally without support for NLS
and ISO 8859-1. Default Ansi<->OEM translations when *.trl files are
not found are missing.
NOTE: Please don't run oemansi.exe under wine.
File added
*** ./windows/Makefile.orig Fri Sep 3 16:37:58 1993
--- ./windows/Makefile Thu Sep 9 22:56:21 1993
***************
*** 14,19 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 14,19 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./tools/Makefile.orig Tue Jul 20 18:40:18 1993
--- ./tools/Makefile Thu Sep 9 22:56:21 1993
***************
*** 12,17 ****
#
# Dependency lists
#
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 12,21 ----
#
# Dependency lists
#
! .if exists(.depend)
! .include ".depend"
! .endif
!
! #ifeq (.depend,$(wildcard .depend))
! #include .depend
! #endif
*** ./objects/Makefile.orig Fri Sep 3 16:39:20 1993
--- ./objects/Makefile Thu Sep 9 22:56:23 1993
***************
*** 14,19 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 14,19 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./misc/Makefile.orig Thu Sep 9 11:16:49 1993
--- ./misc/Makefile Thu Sep 9 22:56:23 1993
***************
*** 13,18 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 13,18 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./memory/Makefile.orig Tue Jul 20 18:43:02 1993
--- ./memory/Makefile Thu Sep 9 22:56:34 1993
***************
*** 13,18 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 13,18 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./loader/Makefile.orig Mon Aug 30 20:44:18 1993
--- ./loader/Makefile Thu Sep 9 22:56:36 1993
***************
*** 13,18 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 13,18 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./if1632/Makefile.orig Thu Sep 9 11:15:58 1993
--- ./if1632/Makefile Thu Sep 9 22:56:38 1993
***************
*** 42,50 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 42,50 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./controls/Makefile.orig Mon Aug 30 19:40:39 1993
--- ./controls/Makefile Thu Sep 9 22:56:43 1993
***************
*** 14,19 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 14,20 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
!
diff -ruN ../Backup//Makefile ./Makefile
--- ../Backup//Makefile Tue Sep 14 09:47:00 1993
+++ ./Makefile Thu Sep 16 09:59:52 1993
@@ -7,7 +7,7 @@
######################################################################
# These definitions are for the top level
TARGET=wine
-LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
+LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm -li386
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o
SUBDIRS=if1632 controls loader memory misc objects windows
diff -ruN ../Backup//controls/Makefile ./controls/Makefile
--- ../Backup//controls/Makefile Sat Sep 11 22:13:44 1993
+++ ./controls/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,7 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
+
diff -ruN ../Backup//if1632/Makefile ./if1632/Makefile
--- ../Backup//if1632/Makefile Tue Sep 14 08:56:17 1993
+++ ./if1632/Makefile Thu Sep 16 10:00:24 1993
@@ -45,9 +45,9 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//loader/Makefile ./loader/Makefile
--- ../Backup//loader/Makefile Sat Sep 11 21:42:05 1993
+++ ./loader/Makefile Thu Sep 16 10:00:24 1993
@@ -13,6 +13,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//memory/Makefile ./memory/Makefile
--- ../Backup//memory/Makefile Sat Sep 11 21:42:05 1993
+++ ./memory/Makefile Thu Sep 16 10:00:24 1993
@@ -13,6 +13,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//misc/Makefile ./misc/Makefile
--- ../Backup//misc/Makefile Tue Sep 14 09:17:00 1993
+++ ./misc/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//objects/Makefile ./objects/Makefile
--- ../Backup//objects/Makefile Tue Sep 14 13:59:04 1993
+++ ./objects/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//tools/Makefile ./tools/Makefile
--- ../Backup//tools/Makefile Tue Sep 14 09:46:40 1993
+++ ./tools/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,10 @@
#
# Dependency lists
#
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
+
+#ifeq (.depend,$(wildcard .depend))
+#include .depend
+#endif
diff -ruN ../Backup//windows/Makefile ./windows/Makefile
--- ../Backup//windows/Makefile Tue Sep 14 08:39:45 1993
+++ ./windows/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=menu.o widgets.o button.o SmeMenuButto.o WinLabel.o WinCommand.o \
WinMenuButto.o WinButton.o
WinMenuButto.o
default: controls.o
......
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/28/93 David Metcalfe (david@prism.demon.co.uk)
* Created from Command widget and added 3D effect
*/
/*
* WinButton.c - WinButton button widget
*/
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Misc.h>
#include <X11/Xaw/XawInit.h>
#include "WinButtonP.h"
#include <X11/Xmu/Converters.h>
#define DEFAULT_HIGHLIGHT_THICKNESS 0
#define DEFAULT_SHAPE_HIGHLIGHT 32767
/****************************************************************
*
* Full class record constant
*
****************************************************************/
/* Private Data */
static char defaultTranslations[] =
"<EnterWindow>: highlight() \n\
<LeaveWindow>: reset() \n\
<Btn1Down>: set() \n\
<Btn1Up>: notify() unset() ";
#define offset(field) XtOffsetOf(WinButtonRec, field)
static XtResource resources[] = {
{XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(winbutton.callbacks), XtRCallback, (XtPointer)NULL},
{XtNhighlightThickness, XtCThickness, XtRDimension, sizeof(Dimension),
offset(winbutton.highlight_thickness), XtRImmediate,
(XtPointer) DEFAULT_SHAPE_HIGHLIGHT},
{XtNshapeStyle, XtCShapeStyle, XtRShapeStyle, sizeof(int),
offset(winbutton.shape_style), XtRImmediate,
(XtPointer)XawShapeRectangle},
{XtNcornerRoundPercent, XtCCornerRoundPercent,
XtRDimension, sizeof(Dimension),
offset(winbutton.corner_round), XtRImmediate, (XtPointer) 25},
{XtNshadowThickness, XtCShadowThickness, XtRDimension, sizeof(Dimension),
offset(winbutton.shadow_thickness), XtRImmediate, (XtPointer) 2},
{XtNshadowHighlight, XtCShadowHighlight, XtRPixel, sizeof(Pixel),
offset(winbutton.shadow_highlight), XtRString, (XtPointer) "white"},
{XtNshadowShade, XtCShadowShade, XtRPixel, sizeof(Pixel),
offset(winbutton.shadow_shade), XtRString, (XtPointer) "grey25"},
};
#undef offset
static Boolean SetValues();
static void Initialize(), Redisplay(), Set(), Reset(), Notify(), Unset();
static void Highlight(), Unhighlight(), Destroy(), PaintWinButtonWidget();
static void ClassInitialize();
static Boolean ShapeButton();
static void Realize(), Resize();
static XtActionsRec actionsList[] = {
{"set", Set},
{"notify", Notify},
{"highlight", Highlight},
{"reset", Reset},
{"unset", Unset},
{"unhighlight", Unhighlight}
};
#define SuperClass ((WinLabelWidgetClass)&winLabelClassRec)
WinButtonClassRec winButtonClassRec = {
{
(WidgetClass) SuperClass, /* superclass */
"WinButton", /* class_name */
sizeof(WinButtonRec), /* size */
ClassInitialize, /* class_initialize */
NULL, /* class_part_initialize */
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
Realize, /* realize */
actionsList, /* actions */
XtNumber(actionsList), /* num_actions */
resources, /* resources */
XtNumber(resources), /* resource_count */
NULLQUARK, /* xrm_class */
FALSE, /* compress_motion */
TRUE, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
Resize, /* resize */
Redisplay, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */
NULL, /* accept_focus */
XtVersion, /* version */
NULL, /* callback_private */
defaultTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display_accelerator */
NULL /* extension */
}, /* CoreClass fields initialization */
{
XtInheritChangeSensitive /* change_sensitive */
}, /* SimpleClass fields initialization */
{
0, /* field not used */
}, /* WinLabelClass fields initialization */
{
0, /* field not used */
}, /* WinButtonClass fields initialization */
};
/* for public consumption */
WidgetClass winButtonWidgetClass = (WidgetClass) &winButtonClassRec;
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static GC
Get_GC(cbw, fg, bg)
WinButtonWidget cbw;
Pixel fg, bg;
{
XGCValues values;
values.foreground = fg;
values.background = bg;
values.font = cbw->winlabel.font->fid;
values.cap_style = CapProjecting;
if (cbw->winbutton.highlight_thickness > 1 )
values.line_width = cbw->winbutton.highlight_thickness;
else
values.line_width = 0;
return XtGetGC((Widget)cbw,
(GCForeground|GCBackground|GCFont|GCLineWidth|GCCapStyle),
&values);
}
static void
Get_Shadow_GCs(cbw)
WinButtonWidget cbw;
{
XGCValues values;
values.foreground = cbw->winbutton.shadow_highlight;
values.line_width = cbw->winbutton.shadow_thickness;
values.cap_style = CapProjecting;
cbw->winbutton.shadow_highlight_gc =
XtGetGC((Widget)cbw, (GCForeground|GCLineWidth|GCCapStyle), &values);
values.foreground = cbw->winbutton.shadow_shade;
values.line_width = cbw->winbutton.shadow_thickness;
values.cap_style = CapProjecting;
cbw->winbutton.shadow_shade_gc =
XtGetGC((Widget)cbw, (GCForeground|GCLineWidth|GCCapStyle), &values);
}
/* ARGSUSED */
static void
Initialize(request, new, args, num_args)
Widget request, new;
ArgList args; /* unused */
Cardinal *num_args; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget) new;
int shape_event_base, shape_error_base;
if (cbw->winbutton.shape_style != XawShapeRectangle
&& !XShapeQueryExtension(XtDisplay(new), &shape_event_base,
&shape_error_base))
cbw->winbutton.shape_style = XawShapeRectangle;
if (cbw->winbutton.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) {
if (cbw->winbutton.shape_style != XawShapeRectangle)
cbw->winbutton.highlight_thickness = 0;
else
cbw->winbutton.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
}
XtVaSetValues(new, XtNbackground, "grey75");
cbw->winbutton.normal_GC = Get_GC(cbw, cbw->winlabel.foreground,
cbw->core.background_pixel);
cbw->winbutton.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
cbw->winlabel.foreground);
XtReleaseGC(new, cbw->winlabel.normal_GC);
cbw->winlabel.normal_GC = cbw->winbutton.normal_GC;
Get_Shadow_GCs(cbw);
cbw->winbutton.set = FALSE;
cbw->winbutton.highlighted = HighlightNone;
}
static Region
HighlightRegion(cbw)
WinButtonWidget cbw;
{
static Region outerRegion = NULL, innerRegion, emptyRegion;
XRectangle rect;
if (cbw->winbutton.highlight_thickness == 0 ||
cbw->winbutton.highlight_thickness >
(Dimension) ((Dimension) Min(cbw->core.width, cbw->core.height)/2))
return(NULL);
if (outerRegion == NULL) {
/* save time by allocating scratch regions only once. */
outerRegion = XCreateRegion();
innerRegion = XCreateRegion();
emptyRegion = XCreateRegion();
}
rect.x = rect.y = 0;
rect.width = cbw->core.width;
rect.height = cbw->core.height;
XUnionRectWithRegion( &rect, emptyRegion, outerRegion );
rect.x = rect.y = cbw->winbutton.highlight_thickness;
rect.width -= cbw->winbutton.highlight_thickness * 2;
rect.height -= cbw->winbutton.highlight_thickness * 2;
XUnionRectWithRegion( &rect, emptyRegion, innerRegion );
XSubtractRegion( outerRegion, innerRegion, outerRegion );
return outerRegion;
}
/***************************
*
* Action Procedures
*
***************************/
/* ARGSUSED */
static void
Set(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
if (cbw->winbutton.set)
return;
cbw->winbutton.set= TRUE;
if (XtIsRealized(w))
PaintWinButtonWidget(w, (Region) NULL, TRUE);
}
/* ARGSUSED */
static void
Unset(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params;
{
WinButtonWidget cbw = (WinButtonWidget)w;
if (!cbw->winbutton.set)
return;
cbw->winbutton.set = FALSE;
if (XtIsRealized(w)) {
XClearWindow(XtDisplay(w), XtWindow(w));
PaintWinButtonWidget(w, (Region) NULL, TRUE);
}
}
/* ARGSUSED */
static void
Reset(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
if (cbw->winbutton.set) {
cbw->winbutton.highlighted = HighlightNone;
Unset(w, event, params, num_params);
}
else
Unhighlight(w, event, params, num_params);
}
/* ARGSUSED */
static void
Highlight(w,event,params,num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
{
WinButtonWidget cbw = (WinButtonWidget)w;
if ( *num_params == (Cardinal) 0)
cbw->winbutton.highlighted = HighlightWhenUnset;
else {
if ( *num_params != (Cardinal) 1)
XtWarning("Too many parameters passed to highlight action table.");
switch (params[0][0]) {
case 'A':
case 'a':
cbw->winbutton.highlighted = HighlightAlways;
break;
default:
cbw->winbutton.highlighted = HighlightWhenUnset;
break;
}
}
if (XtIsRealized(w))
PaintWinButtonWidget(w, HighlightRegion(cbw), TRUE);
}
/* ARGSUSED */
static void
Unhighlight(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
cbw->winbutton.highlighted = HighlightNone;
if (XtIsRealized(w))
PaintWinButtonWidget(w, HighlightRegion(cbw), TRUE);
}
/* ARGSUSED */
static void
Notify(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
/* check to be sure state is still Set so that user can cancel
the action (e.g. by moving outside the window, in the default
bindings.
*/
if (cbw->winbutton.set)
XtCallCallbackList(w, cbw->winbutton.callbacks, NULL);
}
/*
* Repaint the widget window
*/
/************************
*
* REDISPLAY (DRAW)
*
************************/
/* ARGSUSED */
static void
Redisplay(w, event, region)
Widget w;
XEvent *event;
Region region;
{
PaintWinButtonWidget(w, region, FALSE);
}
/* Function Name: PaintWinButtonWidget
* Description: Paints the winbutton widget.
* Arguments: w - the winbutton widget.
* region - region to paint (passed to the superclass).
* change - did it change either set or highlight state?
* Returns: none
*/
static void
PaintWinButtonWidget(w, region, change)
Widget w;
Region region;
Boolean change;
{
WinButtonWidget cbw = (WinButtonWidget) w;
Boolean very_thick;
GC norm_gc, rev_gc;
int offset;
very_thick = cbw->winbutton.highlight_thickness >
(Dimension)((Dimension) Min(cbw->core.width,
cbw->core.height)/2);
offset = cbw->winbutton.shadow_thickness / 2;
if (cbw->winbutton.set) {
XClearWindow(XtDisplay(w), XtWindow(w));
region = NULL; /* Force label to repaint text. */
}
else {
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_highlight_gc,
offset, offset, cbw->core.width - offset, offset);
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_highlight_gc,
offset, offset, offset, cbw->core.height - offset);
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_shade_gc,
offset, cbw->core.height - offset + 1,
cbw->core.width - offset, cbw->core.height - offset);
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_shade_gc,
cbw->core.width - offset, offset + 1,
cbw->core.width - offset, cbw->core.height - offset);
}
if (cbw->winbutton.highlight_thickness <= 0)
{
(*SuperClass->core_class.expose) (w, (XEvent *) NULL, region);
return;
}
/*
* If we are set then use the same colors as if we are not highlighted.
*/
if (cbw->winbutton.set == (cbw->winbutton.highlighted == HighlightNone)) {
norm_gc = cbw->winbutton.inverse_GC;
rev_gc = cbw->winbutton.normal_GC;
}
else {
norm_gc = cbw->winbutton.normal_GC;
rev_gc = cbw->winbutton.inverse_GC;
}
if ( !( (!change && (cbw->winbutton.highlighted == HighlightNone)) ||
((cbw->winbutton.highlighted == HighlightWhenUnset) &&
(cbw->winbutton.set))) ) {
if (very_thick) {
cbw->winlabel.normal_GC = norm_gc; /* Give the label the right GC. */
XFillRectangle(XtDisplay(w),XtWindow(w), rev_gc,
0, 0, cbw->core.width, cbw->core.height);
}
else {
/* wide lines are centered on the path, so indent it */
int offset = cbw->winbutton.highlight_thickness/2;
XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, offset, offset,
cbw->core.width - cbw->winbutton.highlight_thickness,
cbw->core.height - cbw->winbutton.highlight_thickness);
}
}
(*SuperClass->core_class.expose) (w, (XEvent *) NULL, region);
}
static void
Destroy(w)
Widget w;
{
WinButtonWidget cbw = (WinButtonWidget) w;
/* so WinLabel can release it */
if (cbw->winlabel.normal_GC == cbw->winbutton.normal_GC)
XtReleaseGC( w, cbw->winbutton.inverse_GC );
else
XtReleaseGC( w, cbw->winbutton.normal_GC );
}
/*
* Set specified arguments into widget
*/
/* ARGSUSED */
static Boolean
SetValues (current, request, new)
Widget current, request, new;
{
WinButtonWidget oldcbw = (WinButtonWidget) current;
WinButtonWidget cbw = (WinButtonWidget) new;
Boolean redisplay = False;
if ( oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) {
/* about to become insensitive */
cbw->winbutton.set = FALSE;
cbw->winbutton.highlighted = HighlightNone;
redisplay = TRUE;
}
if ( (oldcbw->winlabel.foreground != cbw->winlabel.foreground) ||
(oldcbw->core.background_pixel != cbw->core.background_pixel) ||
(oldcbw->winbutton.highlight_thickness !=
cbw->winbutton.highlight_thickness) ||
(oldcbw->winlabel.font != cbw->winlabel.font) )
{
if (oldcbw->winlabel.normal_GC == oldcbw->winbutton.normal_GC)
/* WinLabel has release one of these */
XtReleaseGC(new, cbw->winbutton.inverse_GC);
else
XtReleaseGC(new, cbw->winbutton.normal_GC);
cbw->winbutton.normal_GC = Get_GC(cbw, cbw->winlabel.foreground,
cbw->core.background_pixel);
cbw->winbutton.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
cbw->winlabel.foreground);
XtReleaseGC(new, cbw->winlabel.normal_GC);
cbw->winlabel.normal_GC = (cbw->winbutton.set
? cbw->winbutton.inverse_GC
: cbw->winbutton.normal_GC);
redisplay = True;
}
if ( XtIsRealized(new)
&& oldcbw->winbutton.shape_style != cbw->winbutton.shape_style
&& !ShapeButton(cbw, TRUE))
{
cbw->winbutton.shape_style = oldcbw->winbutton.shape_style;
}
return (redisplay);
}
static void ClassInitialize()
{
XawInitializeWidgetSet();
XtSetTypeConverter( XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle,
NULL, 0, XtCacheNone, NULL );
}
static Boolean
ShapeButton(cbw, checkRectangular)
WinButtonWidget cbw;
Boolean checkRectangular;
{
Dimension corner_size;
if ( (cbw->winbutton.shape_style == XawShapeRoundedRectangle) ) {
corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width
: cbw->core.height;
corner_size = (int) (corner_size * cbw->winbutton.corner_round) / 100;
}
if (checkRectangular || cbw->winbutton.shape_style != XawShapeRectangle) {
if (!XmuReshapeWidget((Widget) cbw, cbw->winbutton.shape_style,
corner_size, corner_size)) {
cbw->winbutton.shape_style = XawShapeRectangle;
return(False);
}
}
return(TRUE);
}
static void Realize(w, valueMask, attributes)
Widget w;
Mask *valueMask;
XSetWindowAttributes *attributes;
{
(*winButtonWidgetClass->core_class.superclass->core_class.realize)
(w, valueMask, attributes);
ShapeButton( (WinButtonWidget) w, FALSE);
}
static void Resize(w)
Widget w;
{
if (XtIsRealized(w))
ShapeButton( (WinButtonWidget) w, FALSE);
(*winButtonWidgetClass->core_class.superclass->core_class.resize)(w);
}
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/28/93 David Metcalfe (david@prism.demon.co.uk)
* Created from Command widget and added 3D effect
*/
#ifndef _WinButton_h
#define _WinButton_h
#include "WinLabel.h"
/* WinButton widget resources:
Name Class RepType Default Value
---- ----- ------- -------------
accelerators Accelerators AcceleratorTable NULL
ancestorSensitive AncestorSensitive Boolean True
background Background Pixel XtDefaultBackground
backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
bitmap Pixmap Pixmap None
borderColor BorderColor Pixel XtDefaultForeground
borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
borderWidth BorderWidth Dimension 1
callback Callback XtCallbackList NULL
colormap Colormap Colormap parent's colormap
cornerRoundPercent CornerRoundPercent Dimension 25
cursor Cursor Cursor None
cursorName Cursor String NULL
depth Depth int parent's depth
destroyCallback Callback XtCallbackList NULL
encoding Encoding UnsignedChar XawTextEncoding8bit
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
highlightThickness Thickness Dimension 0 if shaped, else 2
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
leftBitmap LeftBitmap Pixmap None
mappedWhenManaged MappedWhenManaged Boolean True
pointerColor Foreground Pixel XtDefaultForeground
pointerColorBackground Background Pixel XtDefaultBackground
resize Resize Boolean True
screen Screen Screen parent's Screen
sensitive Sensitive Boolean True
shadowHighlight ShadowHighlight Pixel White
shadowShade ShadowShade Pixel Grey25
shadowThickness ShadowThickness Dimension 2
shapeStyle ShapeStyle ShapeStyle Rectangle
translations Translations TranslationTable see doc or source
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XtNhighlightThickness "highlightThickness"
#define XtNshapeStyle "shapeStyle"
#define XtCShapeStyle "ShapeStyle"
#define XtRShapeStyle "ShapeStyle"
#define XtNcornerRoundPercent "cornerRoundPercent"
#define XtCCornerRoundPercent "CornerRoundPercent"
#define XtNshadowThickness "shadowThickness"
#define XtCShadowThickness "ShadowThickness"
#define XtNshadowHighlight "shadowHighlight"
#define XtCShadowHighlight "ShadowHighlight"
#define XtNshadowShade "shadowShade"
#define XtCShadowShade "ShadowShade"
#define XawShapeRectangle XmuShapeRectangle
#define XawShapeOval XmuShapeOval
#define XawShapeEllipse XmuShapeEllipse
#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
extern WidgetClass winButtonWidgetClass;
typedef struct _WinButtonClassRec *WinButtonWidgetClass;
typedef struct _WinButtonRec *WinButtonWidget;
#endif /* _WinButton_h */
/* DON'T ADD STUFF AFTER THIS */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/28/93 David Metcalfe (david@prism.demon.co.uk)
* Created from Command widget and added 3D effect
*/
/*
* WinButtonP.h - Private definitions for WinButton widget
*
*/
#ifndef _WinButtonP_h
#define _WinButtonP_h
#include "WinButton.h"
#include "WinLabelP.h"
/***********************************************************************
*
* WinButton Widget Private Data
*
***********************************************************************/
typedef enum {
HighlightNone, /* Do not highlight. */
HighlightWhenUnset, /* Highlight only when unset, this is
to preserve current command widget
functionality. */
HighlightAlways /* Always highlight, lets the toggle widget
and other subclasses do the right thing. */
} XtCommandHighlight;
/************************************
*
* Class structure
*
***********************************/
/* New fields for the WinButton widget class record */
typedef struct _WinButtonClass
{
int makes_compiler_happy; /* not used */
} WinButtonClassPart;
/* Full class record declaration */
typedef struct _WinButtonClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winlabel_class;
WinButtonClassPart winbutton_class;
} WinButtonClassRec;
extern WinButtonClassRec winButtonClassRec;
/***************************************
*
* Instance (widget) structure
*
**************************************/
/* New fields for the WinButton widget record */
typedef struct {
/* resources */
Dimension highlight_thickness;
Dimension shadow_thickness;
Pixel shadow_shade;
Pixel shadow_highlight;
XtCallbackList callbacks;
/* private state */
Pixmap gray_pixmap;
GC normal_GC;
GC inverse_GC;
GC shadow_highlight_gc;
GC shadow_shade_gc;
Boolean set;
XtCommandHighlight highlighted;
/* more resources */
int shape_style;
Dimension corner_round;
} WinButtonPart;
/* XtEventsPtr eventTable;*/
/* Full widget declaration */
typedef struct _WinButtonRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
WinButtonPart winbutton;
} WinButtonRec;
#endif /* _WinButtonP_h */
/*
* Interface code to button widgets
/* File: button.c -- MS-Windows(tm) compatible "Button" replacement widget
*
* Copyright David W. Metcalfe, 1993
* programmed by Johannes Ruscheinski for the Linux WABI
* project.
* (C) 1993 by Johannes Ruscheinski
*
* Modifications by David Metcalfe
*/
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "WinButton.h"
#include "windows.h"
#include "heap.h"
#include <windows.h>
#include "win.h"
static void BUTTON_WinButtonCallback(Widget w, XtPointer client_data,
XtPointer call_data);
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
static COLORREF color_windowframe, color_btnface, color_btnshadow,
color_btntext, color_btnhighlight;
static BOOL pressed;
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
SendMessage(GetParent(hWndCntrl), WM_COMMAND, \
GetDlgCtrlID(hWndCntrl), MAKELPARAM(hWndCntrl, wNotifyCode));
#define DIM(array) ((sizeof array)/(sizeof array[0]))
static LONG PB_Paint(HWND hWnd);
static LONG PB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
static LONG PB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
static LONG PB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam);
static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc);
static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc);
void BUTTON_CreateButton(LPSTR className, LPSTR buttonLabel, HWND hwnd)
typedef struct
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
DWORD style;
char widgetName[15];
#ifdef DEBUG_BUTTON
printf("button: label = %s, x = %d, y = %d\n", buttonLabel,
wndPtr->rectClient.left, wndPtr->rectClient.top);
printf(" width = %d, height = %d\n",
wndPtr->rectClient.right - wndPtr->rectClient.left,
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
#endif
LONG (*paintfn)();
LONG (*lButtonDownfn)();
LONG (*lButtonUpfn)();
LONG (*lButtonDblClkfn)();
} BTNFN;
#define MAX_BTN_TYPE 2
if (!wndPtr)
return;
style = wndPtr->dwStyle & 0x0000000F;
switch (style)
{
case BS_PUSHBUTTON:
case BS_DEFPUSHBUTTON:
sprintf(widgetName, "%s%d", className, wndPtr->wIDmenu);
wndPtr->winWidget = XtVaCreateManagedWidget(widgetName,
winButtonWidgetClass,
parentPtr->winWidget,
XtNlabel, buttonLabel,
XtNx, wndPtr->rectClient.left,
XtNy, wndPtr->rectClient.top,
XtNwidth, wndPtr->rectClient.right -
wndPtr->rectClient.left,
XtNheight, wndPtr->rectClient.bottom -
wndPtr->rectClient.top,
XtVaTypedArg, XtNbackground, XtRString,
"grey70", strlen("grey75")+1,
NULL);
XtAddCallback(wndPtr->winWidget, XtNcallback,
BUTTON_WinButtonCallback, (XtPointer) hwnd);
break;
default:
printf("CreateButton: Unsupported button style %lX\n",
wndPtr->dwStyle);
static BTNFN btnfn[MAX_BTN_TYPE] =
{
{
(LONG(*)())PB_Paint, /* BS_PUSHBUTTON */
(LONG(*)())PB_LButtonDown,
(LONG(*)())PB_LButtonUp,
(LONG(*)())PB_LButtonDblClk
},
{
(LONG(*)())PB_Paint, /* BS_DEFPUSHBUTTON */
(LONG(*)())PB_LButtonDown,
(LONG(*)())PB_LButtonUp,
(LONG(*)())PB_LButtonDblClk
}
};
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
{
LONG lResult = 0;
HDC hDC;
RECT rc;
WND *wndPtr = WIN_FindWndPtr(hWnd);
LONG style = wndPtr->dwStyle & 0x0000000F;
switch (uMsg) {
/* case WM_GETDLGCODE:
lResult = DLGC_BUTTON;
break;
*/
case WM_ENABLE:
InvalidateRect(hWnd, NULL, FALSE);
break;
case WM_CREATE:
if (style < 0L || style >= (LONG)DIM(btnfn))
lResult = -1L;
else
{
/* initialise colours used for button rendering: */
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_btnface = GetSysColor(COLOR_BTNFACE);
color_btnshadow = GetSysColor(COLOR_BTNSHADOW);
color_btntext = GetSysColor(COLOR_BTNTEXT);
color_btnhighlight = GetSysColor(COLOR_BTNHIGHLIGHT);
pressed = FALSE;
lResult = 0L;
}
break;
case WM_PAINT:
(btnfn[style].paintfn)(hWnd);
break;
case WM_LBUTTONDOWN:
(btnfn[style].lButtonDownfn)(hWnd, wParam, lParam);
break;
case WM_LBUTTONUP:
(btnfn[style].lButtonUpfn)(hWnd, wParam, lParam);
break;
case WM_LBUTTONDBLCLK:
(btnfn[style].lButtonDblClkfn)(hWnd, wParam, lParam);
break;
case WM_SETFOCUS:
break;
case WM_KILLFOCUS:
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
break;
case WM_SYSCOLORCHANGE:
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_btnface = GetSysColor(COLOR_BTNFACE);
color_btnshadow = GetSysColor(COLOR_BTNSHADOW);
color_btntext = GetSysColor(COLOR_BTNTEXT);
color_btnhighlight = GetSysColor(COLOR_BTNHIGHLIGHT);
InvalidateRect(hWnd, NULL, TRUE);
break;
default:
lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
break;
}
GlobalUnlock(hWnd);
return lResult;
}
/**********************************************************************
* Push Button Functions
*/
static LONG PB_Paint(HWND hWnd)
{
PAINTSTRUCT ps;
RECT rc;
HDC hDC;
hDC = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rc);
if (pressed)
DrawPressedPushButton(hDC, hWnd, rc);
else
DrawRaisedPushButton(hDC, hWnd, rc);
EndPaint(hWnd, &ps);
}
static LONG PB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
{
/* SetFocus(hWnd); */
SetCapture(hWnd);
pressed = TRUE;
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
}
static LONG PB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
{
RECT rc;
pressed = FALSE;
ReleaseCapture();
GetClientRect(hWnd, &rc);
if (PtInRect(&rc, MAKEPOINT(lParam)))
NOTIFY_PARENT(hWnd, BN_CLICKED);
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
}
static LONG PB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam)
{
RECT rc;
GetClientRect(hWnd, &rc);
if (PtInRect(&rc, MAKEPOINT(lParam)))
NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED);
}
static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc)
{
HPEN hOldPen, hFramePen;
HBRUSH hOldBrush, hShadowBrush, hHighlightBrush, hBackgrndBrush;
HRGN rgn1, rgn2, rgn;
int len;
static char text[50+1];
POINT points[6];
DWORD dwTextSize;
int delta;
TEXTMETRIC tm;
int i;
hFramePen = CreatePen(PS_SOLID, 1, color_windowframe);
hBackgrndBrush = CreateSolidBrush(color_btnface);
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hFramePen);
hOldBrush = (HBRUSH)SelectObject(hDC, (HANDLE)hBackgrndBrush);
SetBkMode(hDC, TRANSPARENT);
rgn = CreateRectRgn(0, 0, 0, 0);
rgn1 = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
SendMessage(GetParent(hButton), WM_CTLCOLOR, (WORD)hDC,
MAKELPARAM(hButton, CTLCOLOR_BTN));
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
/* draw button label, if any: */
len = GetWindowText(hButton, text, sizeof text);
if (len >= 1) {
rc.left--; rc.bottom--;
DrawText(hDC, text, len, &rc,
DT_SINGLELINE | DT_CENTER| DT_VCENTER);
}
/* draw button highlight */
points[0].x = rc.left+2;
points[0].y = rc.bottom;
points[1].x = rc.left+4;
points[1].y = rc.bottom-2;
points[2].x = rc.left+4;
points[2].y = rc.top+3;
points[3].x = rc.right-3;
points[3].y = rc.top+3;
points[4].x = rc.right-1;
points[4].y = rc.top+1;
points[5].x = rc.left+2;
points[5].y = rc.top+1;
hHighlightBrush = CreateSolidBrush(color_btnhighlight);
rgn2 = CreatePolygonRgn(points, DIM(points), ALTERNATE);
CombineRgn(rgn, rgn1, rgn2, RGN_AND);
FillRgn(hDC, rgn2, hHighlightBrush);
GlobalUnlock(hwnd);
GlobalUnlock(wndPtr->hwndParent);
/* draw button shadow: */
points[0].x = rc.left+2;
points[0].y = rc.bottom;
points[1].x = rc.left+4;
points[1].y = rc.bottom-2;
points[2].x = rc.right-3;
points[2].y = rc.bottom-2;
points[3].x = rc.right-3;
points[3].y = rc.top+3;
points[4].x = rc.right-1;
points[4].y = rc.top;
points[5].x = rc.right-1;
points[5].y = rc.bottom;
hShadowBrush = CreateSolidBrush(color_btnshadow);
rgn2 = CreatePolygonRgn(points, DIM(points), ALTERNATE);
CombineRgn(rgn, rgn1, rgn2, RGN_AND);
FillRgn(hDC, rgn2, hShadowBrush);
#if 0
/* do we have the focus? */
if (len >= 1 && GetFocus() == hButton) {
dwTextSize = GetTextExtent(hDC, text, len);
delta = ((rc.right - rc.left) - LOWORD(dwTextSize) + 1) >> 1;
rc.left += delta; rc.right -= delta;
GetTextMetrics(hDC, &tm);
delta = ((rc.bottom - rc.top) -
tm.tmHeight + tm.tmInternalLeading) >> 1;
rc.top += delta; rc.bottom -= delta;
DrawFocusRect(hDC, &rc);
}
#endif
SelectObject(hDC, (HANDLE)hOldPen);
SelectObject(hDC, (HANDLE)hOldBrush);
DeleteObject((HANDLE)hFramePen);
DeleteObject((HANDLE)hShadowBrush);
DeleteObject((HANDLE)hBackgrndBrush);
DeleteObject((HANDLE)rgn1);
#if 0
DeleteObject((HANDLE)rgn2);
DeleteObject((HANDLE)rgn);
#endif
}
static void BUTTON_WinButtonCallback(Widget w, XtPointer client_data,
XtPointer call_data)
static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc)
{
HWND hwnd = (HWND) client_data;
WND *wndPtr;
wndPtr = WIN_FindWndPtr(hwnd);
HPEN hOldPen, hShadowPen, hFramePen;
HBRUSH hOldBrush, hBackgrndBrush;
HRGN rgn1, rgn2, rgn;
int len;
static char text[50+1];
DWORD dwTextSize;
int delta;
TEXTMETRIC tm;
hFramePen = CreatePen(PS_SOLID, 1, color_windowframe);
hBackgrndBrush = CreateSolidBrush(color_btnface);
hOldBrush = (HBRUSH)SelectObject(hDC, (HANDLE)hBackgrndBrush);
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hFramePen);
SetBkMode(hDC, TRANSPARENT);
/* give parent a chance to alter parameters: */
SendMessage(GetParent(hButton), WM_CTLCOLOR, (WORD)hDC,
MAKELPARAM(hButton, CTLCOLOR_BTN));
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
/* draw button shadow: */
hShadowPen = CreatePen(PS_SOLID, 1, color_btnshadow);
SelectObject(hDC, (HANDLE)hShadowPen);
MoveTo(hDC, rc.left+1, rc.bottom-1);
LineTo(hDC, rc.left+1, rc.top+1);
LineTo(hDC, rc.right-1, rc.top+1);
CallWindowProc(wndPtr->lpfnWndProc, wndPtr->hwndParent, WM_COMMAND,
wndPtr->wIDmenu, MAKELPARAM(hwnd, BN_CLICKED));
/* draw button label, if any: */
len = GetWindowText(hButton, text, sizeof text);
if (len >= 1) {
rc.top++; rc.left++;
DrawText(hDC, text, len, &rc,
DT_SINGLELINE | DT_CENTER| DT_VCENTER);
}
GlobalUnlock(hwnd);
#if 0
/* do we have the focus? */
if (len >= 1 && GetFocus() == hButton) {
dwTextSize = GetTextExtent(hDC, text, len);
delta = ((rc.right - rc.left) - LOWORD(dwTextSize)) >> 1;
rc.left += delta; rc.right -= delta;
GetTextMetrics(hDC, &tm);
delta = ((rc.bottom - rc.top) -
tm.tmHeight + tm.tmInternalLeading) >> 1;
rc.top += delta; rc.bottom -= delta;
DrawFocusRect(hDC, &rc);
}
#endif
SelectObject(hDC, (HANDLE)hOldPen);
SelectObject(hDC, (HANDLE)hOldBrush);
DeleteObject((HANDLE)hBackgrndBrush);
DeleteObject(SelectObject(hDC, (HANDLE)hFramePen));
DeleteObject(SelectObject(hDC, (HANDLE)hShadowPen));
}
......@@ -141,7 +141,7 @@ MENU_SelectionCallback(Widget w, XtPointer client_data, XtPointer call_data)
menu = MENU_FindMenuBar(this_item);
if (menu != NULL)
{
wndPtr = (WND *) GlobalLock(menu->ownerWnd);
wndPtr = WIN_FindWndPtr(menu->ownerWnd);
if (wndPtr == NULL)
return;
......@@ -152,8 +152,6 @@ MENU_SelectionCallback(Widget w, XtPointer client_data, XtPointer call_data)
CallWindowProc(wndPtr->lpfnWndProc, menu->ownerWnd, WM_COMMAND,
this_item->item_id, 0);
GlobalUnlock(menu->ownerWnd);
}
}
......
......@@ -10,8 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "win.h"
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam );
LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam );
......@@ -19,8 +18,8 @@ static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
static WNDCLASS WIDGETS_BuiltinClasses[NB_BUILTIN_CLASSES] =
{
{ 0, WIDGETS_ButtonWndProc, 0, 0, 0, 0, 0, 0, NULL, "BUTTON" },
{ 0, WIDGETS_StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" }
{ 0, (LONG(*)())ButtonWndProc, 0, 0, 0, 0, 0, 0, NULL, "BUTTON" },
{ 0, (LONG(*)())WIDGETS_StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" }
};
static FARPROC WndProc32[NB_BUILTIN_CLASSES];
......@@ -38,8 +37,6 @@ BOOL WIDGETS_Init()
for (i = 0; i < NB_BUILTIN_CLASSES; i++, pClass++)
{
WndProc32[i] = pClass->lpfnWndProc;
pClass->lpfnWndProc = (FARPROC) i+1;
if (!RegisterClass(pClass)) return FALSE;
}
return TRUE;
......@@ -60,39 +57,6 @@ LONG WIDGETS_Call32WndProc( FARPROC func, HWND hwnd, WORD message,
}
/***********************************************************************
* WIDGETS_ButtonWndProc
*/
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam )
{
switch(message)
{
case WM_CREATE:
return 0;
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint( hwnd, &ps );
EndPaint( hwnd, &ps );
return 0;
}
case WM_COMMAND:
{
WND *wndParent;
wndParent = WIN_FindWndPtr(hwnd);
CallWindowProc(wndParent->lpfnWndProc, hwnd, message, wParam, lParam);
return 0;
}
default:
return DefWindowProc( hwnd, message, wParam, lParam );
}
}
/***********************************************************************
* WIDGETS_StaticWndProc
*/
......
CFLAGS=-g -I../include # -DUSE_READLINE
LIBS= readline/libedit.a
OBJS=dbg.tab.o hash.o lex.yy.o info.o i386-pinsn.o
debugger.o: ${OBJS} readline/libedit.a
(cd readline; make)
ld -r -o debugger.o ${OBJS} $(LIBS)
readline/libedit.a:
(cd readline; make)
dbg.tab.o: dbg.tab.c
gcc $(CFLAGS) -DYYDEBUG=1 -c dbg.tab.c
lex.yy.o: lex.yy.c
gcc $(CFLAGS) -I. -c lex.yy.c
lex.yy.c: debug.l
flex -I debug.l
dbg.tab.c dbg.tab.h: dbg.y
bison -v -d dbg.y
dtest: dtest.o debugger.o
gcc -o dtest dtest.o debugger.o
clean:
rm -f *.o main dbg.tab.* lex.yy.* *.output *~ *# dtest
(cd readline; make clean)
This is the core of the Wine debugger. Many pieces have been
shamelessly stolen - the reverse assember was stolen from gdb more or
less intact. It turns out that there are two variables that are set
differently if you are reverse assembling 16 bit code, and on the
whole it seems to work. There may be bugs for all I know.
As far as non-linux systems are concerned, I simply ripped off
the linux configuration files from gdb. Other systems may be close
enough for these to work properly, but some tweaking may be required.
I apologize for the non-portability of this, but I wrote the
whole thing in about 4 hours, most of the time spent debugging a
stupid mistake in the parser.
-Eric
This is a list of things that theoretically should be possible in some
way or another. No commitment to actually do these, but these sound
possible to me right now. In no particular order. If someone else
wants to dig in, feel free.
1) Some kind of crude display capability. Not too hard, I guess.
Just keep a list of addresses, counts and formats that we
want displayed each time we enter the debugger.
2) Some kind of single step capability.
I am not sure - I think you just set a flag
in AFLAGS, and you get an interrupt back again.
The signal type would proabably be different, however,
but Wine could easily be patched to accept this one as well.
The main problem with this is that gdb normally runs in a
separate process so it is easy to single step second process.
Here we are all part of the same process. Perhaps we could look
ahead to the end of the instruction and set another breakpoint?
3) Some kind of breakpoint capability.
Requires single step. When we restart, we
remove the breakpoint, single step one instruction
replace the breakpoint, and then continue.
4) Some kind of watchpoint capability. Pretty easy once we have a
single step capability, but we end up running the program
really slowly one instruction at a time.
5) Some kind of .wdbinit file.
/* ANSI and traditional C compatability macros
Copyright 1991 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
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.
You 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. */
/* ANSI and traditional C compatibility macros
ANSI C is assumed if __STDC__ is #defined.
Macro ANSI C definition Traditional C definition
----- ---- - ---------- ----------- - ----------
PTR `void *' `char *'
LONG_DOUBLE `long double' `double'
CONST `const' `'
VOLATILE `volatile' `'
SIGNED `signed' `'
PTRCONST `void *const' `char *'
DEFUN(name, arglist, args)
Defines function NAME.
ARGLIST lists the arguments, separated by commas and enclosed in
parentheses. ARGLIST becomes the argument list in traditional C.
ARGS list the arguments with their types. It becomes a prototype in
ANSI C, and the type declarations in traditional C. Arguments should
be separated with `AND'. For functions with a variable number of
arguments, the last thing listed should be `DOTS'.
DEFUN_VOID(name)
Defines a function NAME, which takes no arguments.
EXFUN(name, prototype)
Is used in an external function declaration.
In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
parentheses). In traditional C it is `NAME()'.
For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
For example:
extern int EXFUN(printf, (CONST char *format DOTS));
int DEFUN(fprintf, (stream, format),
FILE *stream AND CONST char *format DOTS) { ... }
void DEFUN_VOID(abort) { ... }
*/
#ifndef _ANSIDECL_H
#define _ANSIDECL_H 1
/* Every source file includes this file,
so they will all get the switch for lint. */
/* LINTLIBRARY */
#ifdef __STDC__
#define PTR void *
#define PTRCONST void *CONST
#define LONG_DOUBLE long double
#define AND ,
#define NOARGS void
#define CONST const
#define VOLATILE volatile
#define SIGNED signed
#define DOTS , ...
#define EXFUN(name, proto) name proto
#define DEFUN(name, arglist, args) name(args)
#define DEFUN_VOID(name) name(NOARGS)
#define PROTO(type, name, arglist) type name arglist
/* We could use the EXFUN macro to handle prototypes, but
the name is misleading and the result is ugly. So just define a
simple macro to handle the parameter lists, as in:
static int foo PARAMS ((int, char));
EXFUN would do it like this:
static int EXFUN (foo, (int, char));
but the function is not external... EXFUN should be considered
obsolete, and new code written to use PARAMS. */
#define PARAMS(paramlist) paramlist
#else /* Not ANSI C. */
#define PTR char *
#define PTRCONST PTR
#define LONG_DOUBLE double
#define AND ;
#define NOARGS
#define CONST
#define VOLATILE
#define SIGNED
#define DOTS
#define EXFUN(name, proto) name()
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
#define PROTO(type, name, arglist) type name ()
#define PARAMS(paramlist) ()
#endif /* ANSI C. */
#endif /* ansidecl.h */
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment