1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00
wine/misc/tweak.c
Alexandre Julliard 829fe323e4 Release 980726
Sat Jul 25 19:45:45 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [include/shlobj.h][misc/shell.c][misc/shellord.c][ole/folders.c]
	[shell32.spec]
	Added SHFILEOPSTRUCT32[A|W] and constants, prototypes.
	Implemented SHGetSpecialFolderLocation, SHGetPathFromIDList32[A].
	Many IShellFolder, pidl, shell -related changes.

	SHChangeNotifyRegister, SHChangeNotifyDeregister,
	SHShellFolderView_Message, SHMapPIDLToSystemImageListIndex,
	SHAddToRecentDocs32, SHFileOperation, SHChangeNotify, 
	SHCreateShellFolderViewEx stubs.

Sat Jul 25 17:16:25 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [files/profile.c]
	Fix return value of PROFILE_GetSection().

Fri Jul 24 22:45:19 1998  Ove Kaaven <ovek@isflak.arcticnet.no>

	* [controls/edit.c]
	Killed the modified flag on WM_SETTEXT. Eudora should no longer
	bother asking whether you want to save an unchanged message.

Fri Jul 24 21:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [controls/menu.c]
	Fixed bug in GetMenuState32.
	Doesn't fix Free Agent 32 :((

	* [documentation/debugging]
	Hints added.

	* [files/dos_fs.c] [include/msdos.h] [msdos/int21.c]
	Enhanced DOS device support.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/rasapi16.spec]
	  [relay32/Makefile.in] [relay32/builtin32.c] [relay32/rasapi32.spec]
	Added RASAPI16/32.DLL.

	* [misc/aspi.c] [relay32/wnaspi32.spec]
	Implemented GetASPI32SupportInfo.

	* [multimedia/mmsystem.c]
	Implemented mmTaskCreate.

Fri Jul 24 20:55:31 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/toolbar.c]
	Fixed some bugs and added new features.

	* [controls/tooltips.c][include/tooltips.h]
	Added more messages and started display code.

	* [misc/shell.c][misc/shellord.c][relay32/shell.spec]
	Fixed StrToOleStrN (SHELL32_79) and added OleStrToStrN (SHELL32_78).
	Added some new stubs.

	* [objects/cursoricon.c][misc/imagelist.c][include/windows.h]
	Fixed GetIconInfo and removed the GetIconInfo hack from the
	image list code.

	* [controls/pager.c][include/pager.h][controls/treeview.c]
	  [include/treeview.h]
	Added some messages.

	* [misc/tweak.c][winows/nonclient.c][documentation/win95look]
	Removed unused tweak variables.

	* [documentation/common_controls]
	Updated.

Fri Jul 24 18:36:32 1998  James Moody <013263m@dragon.acadiau.ca>

	* [objects/font.c]
	Fixed a bug in GetTextFace.

Fri Jul 24 17:09:33 1998  Marcus Meissner <marcus@jet.franken.de>

	* [misc/commdlg.c]
	Fixed stacksmashing bug due to invalid specified function
	pointers.

	* [files/dos_fs.c]
	Small change in case handling... be able to create files with
	uppercase in them (like Program Files/).

	* [graphics/ddraw.c]
	XF86DGA support made threadsafe, added more Xlib dependent stuff
	(create Window using CreateWindow(), draw into it). xlib support
	is not satisfying.

	* [scheduler/critsection.c]
	Don't recurse on HeapLock with semaphore id 0.

	* [win32/user32.c][windows/message.c][windows/event.c]
	Moved win32 *Message functions where they belong.
	Removed some potential races between XPending and XNextEvent by
	a bit more locking.

Fri Jul 24 13:58:19 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/pe_image.c] [loader/ne/segment.c]
	Use bogus pointer value instead of NULL for unresolved externals.

	* [memory/selector.c]
	Clear saved_fs on selector free.

	* [msdos/cdrom.c] [configure.in]
	Added check for linux/ucdrom.h.

	* [scheduler/client.c] [server/socket.c]
	Fix for missing struct cmsghdr.
	Attempt to support msg_accrights fd passing (completely untested).

	* [windows/event.c]
	Do not grab the pointer in SetCapture (Win32 behavior).

Tue Jul 21 22:28:13 1998  James Juran  <jrj120@psu.edu>

	* [Make.rules.in]
	Changed $(MKDIR) macro to use -p option (make parent directories
	if they don't already exist.  This fixes an error in 'make install'
	if /usr/local/include doesn't already exist.

Tue Jul 21 13:37:04 Rein Klazes <rklazes@casema.net>

	* [include/heap.h]
	Replaced macro SEGPTR_GET by inline function to avoid *lots*
	of wrong use of this macro.

	* [relay32/comdlg32.spec]
	Corrected GetSaveFileNameW entry.

	* [relay32/advapi32.spec] [win32/advapi.c]
	  [relay32/ole32.spec] [ ole/moniker.c]
	Added stubs for SetFileSecurity[AW] and CreateFileMoniker32

	* [graphics/x11drv/graphics.c]
	Finished implementation of bezier drawing code.

Tue Jul 21 11:00:51 1998  Claus Fischer <cfischer@td2cad.intel.com>

	* [files/drive.c]
	Remove label trailing blanks in GetVolumeInformation32A.

	* [documentation/cdrom-labels]
	Added documentation on how to find out a CD-ROM label.

Sun Jul 19 23:16:41 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [include/windows.h]
	Added some DM_* and DISP_CHANGE_* flags.

	* [relay32/user32.spec] [windows/user.c]
	Added stub for ChangeDisplaySettingA.

	* [ole/ole2nls.c]
	is_punctuation: reuse information from another table.

Sun Jul 19 22:04:46 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [Make.rules.in]
	Updated automatic documentation rules.

	* [graphics/path.c] [misc/aspi.c] [misc/ntdll.c] [misc/winsock_dns.c]
	[ole/ole2dsp.c] [relay32/user32.spec]
	Comment format futzing to keep c2man happy.

	* [documentation/README.documentation]
	Updated description of automatic documentation.

Wed Jul 15 19:10:09 1998   Andrew M. Bishop <amb@gedanken.demon.co.uk>

	* [files/profile.c]
	Cache the 10 most recently used .ini files.

Tue May 20 19:20:23 1997  Pablo Saratxaga <srtxg@chanae.alphanet.ch>

	* [misc/commdlg.c]
	Makes PrintDlg32A() return TRUE even if it is an empty
	stub, so most programs are happy and run anyway instead of
	aborting at startup.

	* [graphics/x11drv/xfont.c]
	Increased the maximum font families as (X11) font aliases
	eated up a lot of families causing wine to stop reading fonts.
1998-07-26 14:27:39 +00:00

485 lines
15 KiB
C

/******************************************************************************
*
* tweak.c
*
* Windows 95 style interface tweaks.
* Copyright (c) 1997 Dave Cuthbert.
*
* FIXME: This file is, unfortunately, aptly named: the method of
* displaying Win95 style windows is a tweak. Lots of stuff does not yet
* work -- and probably never will unless some of this code is
* incorporated into the mainstream Wine code.
*
* DEVELOPERS, PLEASE NOTE: Before delving into the mainstream code and
* altering it, consider how your changes will affect the Win3.1 interface
* (which has taken a major effort to create!). After you make any sort of
* non-trivial change, *test* the Wine code running in Win3.1 mode! The
* object here is to make it so that the person who tests the latest version
* of Wine without adding the tweaks into wine.conf notices nothing out of
* the ordinary.
*
* Revision history
* 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
#include <malloc.h>
#include "ts_xlib.h"
#include <string.h>
#include "dc.h"
#include "debug.h"
#include "graphics.h"
#include "options.h"
#include "stackframe.h"
#include "tweak.h"
#include "windows.h"
/* Parameters for windows/nonclient.c */
extern int NC_MaxControlNudge;
extern int NC_MinControlNudge;
extern UINT32 NC_CaptionTextFlags;
/* Parameters for controls/menu.c */
extern UINT32 MENU_BarItemTopNudge;
extern UINT32 MENU_BarItemLeftNudge;
extern UINT32 MENU_ItemTopNudge;
extern UINT32 MENU_ItemLeftNudge;
extern UINT32 MENU_HighlightTopNudge;
extern UINT32 MENU_HighlightLeftNudge;
extern UINT32 MENU_HighlightBottomNudge;
extern UINT32 MENU_HighlightRightNudge;
/* General options */
HPEN32 TWEAK_PenFF95;
HPEN32 TWEAK_PenE095;
HPEN32 TWEAK_PenC095;
HPEN32 TWEAK_Pen8095;
HPEN32 TWEAK_Pen0095;
#if defined(WIN_95_LOOK)
int TWEAK_Win95Look = 1;
#else
int TWEAK_Win95Look = 0;
#endif
int TWEAK_WineInitialized = 0;
/******************************************************************************
*
* int TWEAK_MenuInit()
*
* Initializes the Win95 tweaks to the menu code. See controls/menu.c.
* Return value indicates success (non-zero) or failure.
*
* Revision history
* 06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
static int TWEAK_MenuInit()
{
MENU_BarItemTopNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuBarItemTopNudge", 0);
MENU_BarItemLeftNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuBarItemLeftNudge", 0);
MENU_ItemTopNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuItemTopNudge", 0);
MENU_ItemLeftNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuItemLeftNudge", 0);
MENU_HighlightTopNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightTopNudge", 0);
MENU_HighlightLeftNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightLeftNudge", 0);
MENU_HighlightBottomNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightBottomNudge", 0);
MENU_HighlightRightNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightRightNudge", 0);
return 1;
}
/******************************************************************************
*
* int TWEAK_NonClientInit()
*
* Initializes the Win95 tweaks to the non-client drawing functions. See
* windows/nonclient.c. Return value indicates success (non-zero) or
* failure.
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
static int TWEAK_NonClientInit()
{
char key_value[2];
NC_MaxControlNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MaxControlNudge", 0);
NC_MinControlNudge =
PROFILE_GetWineIniInt("Tweak.Layout", "MinControlNudge", 0);
NC_CaptionTextFlags = DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX;
PROFILE_GetWineIniString("Tweak.Layout", "CaptionAlignment",
TWEAK_Win95Look ? "l" : "c", key_value, 2);
switch(key_value[0]) {
case 'l':
case 'L':
NC_CaptionTextFlags |= DT_LEFT;
break;
case 'r':
case 'R':
NC_CaptionTextFlags |= DT_RIGHT;
break;
default:
NC_CaptionTextFlags |= DT_CENTER;
}
return 1;
}
/******************************************************************************
*
* int TWEAK_VarInit()
*
* Initializes the miscellaneous variables which are used in the tweak
* routines. Return value is non-zero on success.
*
* Revision history
* 07-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
static int TWEAK_VarInit()
{
TWEAK_Win95Look = PROFILE_GetWineIniBool("Tweak.Layout", "Win95Look", 0);
/* FIXME: Each color should really occupy a single entry in the wine.conf
file, but I couldn't settle on a good (intuitive!) format. */
TWEAK_PenFF95 = CreatePen32(
PS_SOLID, 1,
RGB(PROFILE_GetWineIniInt("Tweak.Colors", "PenFF95.Red", 0xff),
PROFILE_GetWineIniInt("Tweak.Colors", "PenFF95.Grn", 0xff),
PROFILE_GetWineIniInt("Tweak.Colors", "PenFF95.Blu", 0xff)));
TWEAK_PenE095 = CreatePen32(
PS_SOLID, 1,
RGB(PROFILE_GetWineIniInt("Tweak.Colors", "PenE095.Red", 0xe0),
PROFILE_GetWineIniInt("Tweak.Colors", "PenE095.Grn", 0xe0),
PROFILE_GetWineIniInt("Tweak.Colors", "PenE095.Blu", 0xe0)));
TWEAK_PenC095 = CreatePen32(
PS_SOLID, 1,
RGB(PROFILE_GetWineIniInt("Tweak.Colors", "PenC095.Red", 0xc0),
PROFILE_GetWineIniInt("Tweak.Colors", "PenC095.Grn", 0xc0),
PROFILE_GetWineIniInt("Tweak.Colors", "PenC095.Blu", 0xc0)));
TWEAK_Pen8095 = CreatePen32(
PS_SOLID, 1,
RGB(PROFILE_GetWineIniInt("Tweak.Colors", "Pen8095.Red", 0x80),
PROFILE_GetWineIniInt("Tweak.Colors", "Pen8095.Grn", 0x80),
PROFILE_GetWineIniInt("Tweak.Colors", "Pen8095.Blu", 0x80)));
TWEAK_Pen0095 = CreatePen32(
PS_SOLID, 1,
RGB(PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Red", 0x00),
PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Grn", 0x00),
PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Blu", 0x00)));
TRACE(tweak, "Using %s look and feel.\n",
TWEAK_Win95Look ? "Win95" : "Win3.1");
return 1;
}
/******************************************************************************
*
* int TWEAK_Init()
*
* Does the full initialization of the Win95 tweak subsystem. Return value
* indicates success. Called by loader/main.c's MAIN_Init().
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
int TWEAK_Init()
{
TWEAK_VarInit();
TWEAK_NonClientInit();
TWEAK_MenuInit();
return 1;
}
/******************************************************************************
*
* int TWEAK_CheckConfiguration()
*
* Examines wine.conf for old/bad entries and recommends changes to the user.
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
int TWEAK_CheckConfiguration()
{
return 1;
}
/******************************************************************************
*
* Tweak graphic subsystem.
*
*****************************************************************************/
/******************************************************************************
*
* void TWEAK_DrawReliefRect95(
* HDC32 hdc, // Device context on which to draw
* RECT32 const *rect ) // Rectangle to use
*
* Draws the double-bordered Win95-style relief rectangle.
*
* Bugs
* There are some checks missing from this function. Perhaps the
* SelectObject32 calls should be examined? Hasn't failed on me (yet).
*
* Should I really be calling X functions directly from here? It is
* an optimization, but should I be optimizing alpha code? Probably
* not.
*
* Revision history
* 08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
void TWEAK_DrawReliefRect95(
HDC32 hdc,
RECT32 const *rect )
{
DC *dc;
HPEN32 prevpen;
if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
/* Draw the top/left lines first */
prevpen = SelectObject32(hdc, TWEAK_PenE095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
rect->right - 1, rect->top);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
rect->left, rect->bottom - 1);
SelectObject32(hdc, TWEAK_PenFF95);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
rect->top + 1, rect->right - 2, rect->top + 1);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
rect->top + 1, rect->left + 1, rect->bottom - 2);
/* Now the bottom/right lines */
SelectObject32(hdc, TWEAK_Pen0095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left,
rect->bottom - 1, rect->right - 1, rect->bottom - 1);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 1,
rect->top, rect->right - 1, rect->bottom - 1);
SelectObject32(hdc, TWEAK_Pen8095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
rect->bottom - 2, rect->right - 2, rect->bottom - 2);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 2,
rect->top + 1, rect->right - 2, rect->bottom - 2);
SelectObject32(hdc, prevpen);
}
return;
}
/******************************************************************************
*
* void TWEAK_DrawRevReliefRect95(
* HDC32 hdc, // Device context on which to draw
* RECT32 const *rect ) // Rectangle to use
*
* Draws the double-bordered Win95-style relief rectangle.
*
* Bugs
* There are some checks missing from this function. Perhaps the
* SelectObject32 calls should be examined? Hasn't failed on me (yet).
*
* Should I really be calling X functions directly from here? It is
* an optimization, but should I be optimizing alpha code? Probably
* not.
*
* Revision history
* 08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
void TWEAK_DrawRevReliefRect95(
HDC32 hdc,
RECT32 const *rect )
{
DC *dc;
HPEN32 prevpen;
if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
/* Draw the top/left lines first */
prevpen = SelectObject32(hdc, TWEAK_Pen8095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
rect->right - 1, rect->top);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
rect->left, rect->bottom - 1);
SelectObject32(hdc, TWEAK_Pen0095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
rect->top + 1, rect->right - 2, rect->top + 1);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
rect->top + 1, rect->left + 1, rect->bottom - 2);
/* Now the bottom/right lines */
SelectObject32(hdc, TWEAK_PenFF95);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left,
rect->bottom - 1, rect->right - 1, rect->bottom - 1);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 1,
rect->top, rect->right - 1, rect->bottom - 1);
SelectObject32(hdc, TWEAK_PenE095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
rect->bottom - 2, rect->right - 2, rect->bottom - 2);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 2,
rect->top + 1, rect->right - 2, rect->bottom - 2);
SelectObject32(hdc, prevpen);
}
return;
}
/******************************************************************************
*
* void TWEAK_DrawMenuSeparatorHoriz95(
* HDC32 hdc, // Device context on which to draw
* UINT32 xc1, // Left x-coordinate
* UINT32 yc, // Y-coordinate of the LOWER line
* UINT32 xc2 ) // Right x-coordinate
*
* Draws a horizontal menu separator bar Win 95 style.
*
* Bugs
* Same as those for DrawReliefRect95.
*
* Revision history
* 08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
* 11-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Changed name from DrawMenuSeparator95
*
*****************************************************************************/
void TWEAK_DrawMenuSeparatorHoriz95(
HDC32 hdc,
UINT32 xc1,
UINT32 yc,
UINT32 xc2 )
{
DC *dc;
HPEN32 prevpen;
if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
/* Draw the top line */
prevpen = SelectObject32(hdc, TWEAK_Pen8095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc1, yc - 1, xc2,
yc - 1);
/* And the bottom line */
SelectObject32(hdc, TWEAK_PenFF95);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc1, yc, xc2, yc);
SelectObject32(hdc, prevpen);
}
return;
}
/******************************************************************************
*
* void TWEAK_DrawMenuSeparatorVert95(
* HDC32 hdc, // Device context on which to draw
* UINT32 xc, // X-coordinate of the RIGHT line
* UINT32 yc1, // top Y-coordinate
* UINT32 yc2 ) // bottom Y-coordinate
*
* Draws a vertical menu separator bar Win 95 style.
*
* Bugs
* Same as those for DrawReliefRect95.
*
* Revision history
* 11-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*
*****************************************************************************/
void TWEAK_DrawMenuSeparatorVert95(
HDC32 hdc,
UINT32 xc,
UINT32 yc1,
UINT32 yc2 )
{
DC *dc;
HPEN32 prevpen;
if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
/* Draw the top line */
prevpen = SelectObject32(hdc, TWEAK_Pen8095);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc, yc1, xc,
yc2);
/* And the bottom line */
SelectObject32(hdc, TWEAK_PenFF95);
DC_SetupGCForPen(dc);
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc + 1, yc1, xc + 1,
yc2);
SelectObject32(hdc, prevpen);
}
return;
}