1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00
wine/windows/caret.c
Alexandre Julliard 3ed37e0869 Release 941107
Sun Nov  6 18:52:04 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [objects/oembitmap.c]  (New file)
	Added possibility to use .xpm files for OEM bitmaps.

	* [include/bitmaps/obm*]  (New files)
	Redrawn all OEM bitmaps in xpm format.

	* [objects/font.c]
	Add space for internal leading when using a negative font height.
	Stubs for AddFontResource() and RemoveFontResource().
	Fix in FONT_Init() for uninitialised default font.

	* [windows/dialog.c]
	Make font height negative as it is really a point size and not a
	pixel size; dialogs using 8-point fonts look better now.

	* [windows/graphics.c]
	Fixed the fix :-) for Pie() to make it work for Arc() and Chord() also.

	* [windows/nonclient.c]
	A few changes for new OEM bitmaps.

Sun Nov  6 18:22:18 1994  Michael Patra  <micky@marie.physik.tu-berlin.de>

	* [windows/class.c]
	The names of local classes have to be stored using GlobalAtom*.
	Otherwise they couldn't be accessed from other modules (e.g. BWCC) 

	* [if1632/call.S]
	CallTo16(cx): It's possible to set the contents of the cx-register.

	* [loader/ne_image.c]
	InitNEDLL(): The size of the local heap is now passed in the cx-
	register when initializing a DLL.

	* [memory/heap.c]
	LocalInit(): The case start==0 is now handled in the way it should.

	* [windows/win.c]
	GetWindowLong(): If the adress of the windows function is requested
	it's no longer returned if it's within the Wine code (and therefore
	unreachable by a windows program). This makes Borland's OWL happy.

	* [controls/edit.c]
	EDIT_GetStr(): Added handling for off<0.

Sun Nov  6 17:37:14 1994  Chris Jones  <chrisj@ichips.intel.com>

	* [loader/library.c]
	Fixed infinite loop bug when two DLLs refer to each other (fixes
	hangup of Quicken during loading).

Thu Nov 04 12:00:00 1994  Jan Willamowius  (jan@janhh.sh.sub.de)

	* [misc/dos_fs.c]
	Bug fix: The size of a disk an the available space
	is now returned in bytes instead of (incorrectly)
	KBytes.

Thu Nov 03 12:00:00 1994  Jan Willamowius  (jan@janhh.sh.sub.de)

	* [windows/graphics.c]
	Bug fix: Pie segments are now filled with correct brush.

Thu Nov  3 10:40:09 1994  Martin von Loewis  (martin@cs.csufresno.edu)

        * [Imakefile]
        generate rc.o before loader.o

        * [controls/menu.c]
        CopySysMenu: generate SYSMENU on the fly, eliminate hSysMenu

        * [include/resource.h]
        Add struct ResourceTable

        * [loader/bitmap.h]
        Load system bitmaps from sysresbmTable

        * [misc/clipboard.c]
          [windows/event.c]
        IsClipboardFormatAvailable,EVENT_SelectionRequest: bug fixes
        
        * [rc/Imakefile]
        generate rc.o from sysres.o and sysresbm.o. Added -lfl

        * [rc/rc.y]
        change style handling to allow ( S1 | S2 ) | S3

        * [rc/sysres.rc]
          [rc/sysresbm.rc]
        Put bitmaps and icons to sysresbm, everything else to sysres

        * [rc/winerc.c]
          [rc/winerc.h]
        Added -o, -c flags. New function set_out_file. Output to files.

        * [windows/dialog.c]
        DialogBoxIndirectPtr, DialogBoxIndirectParamPtr: New functions 

        * [windows/nonclient.c]
        Create AboutWine dialog from template pointer
1994-11-07 18:20:42 +00:00

251 lines
5.4 KiB
C

/*
* Caret functions
*
* Copyright 1993 David Metcalfe
*/
static char Copyright[] = "Copyright David Metcalfe, 1993";
#include "windows.h"
#include "stddebug.h"
/* #define DEBUG_CARET */
/* #undef DEBUG_CARET */
#include "debug.h"
typedef struct
{
HWND hwnd;
short hidden;
BOOL on;
short x;
short y;
short width;
short height;
COLORREF color;
HBITMAP bitmap;
WORD timeout;
WORD timerid;
} CARET;
static CARET Caret;
static BOOL LockCaret;
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime);
static void CARET_HideCaret();
/*****************************************************************
* CARET_Callback
*/
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
{
HDC hdc;
HBRUSH hBrush;
HRGN rgn;
dprintf_caret(stddeb,"CARET_Callback: id=%d: LockCaret=%d, hidden=%d, on=%d\n",
timerid, LockCaret, Caret.hidden, Caret.on);
if (!LockCaret && (!Caret.hidden || Caret.on))
{
Caret.on = (Caret.on ? FALSE : TRUE);
hdc = GetDC(Caret.hwnd);
if (Caret.bitmap == 0 || Caret.bitmap == 1)
hBrush = CreateSolidBrush(Caret.color);
else
hBrush = CreatePatternBrush(Caret.bitmap);
SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject((HANDLE)rgn);
DeleteObject((HANDLE)hBrush);
ReleaseDC(Caret.hwnd, hdc);
}
return 0;
}
/*****************************************************************
* CARET_HideCaret
*/
static void CARET_HideCaret()
{
HDC hdc;
HBRUSH hBrush;
HRGN rgn;
Caret.on = FALSE;
hdc = GetDC(Caret.hwnd);
if (Caret.bitmap == 0 || Caret.bitmap == 1)
hBrush = CreateSolidBrush(Caret.color);
else
hBrush = CreatePatternBrush(Caret.bitmap);
SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject((HANDLE)rgn);
DeleteObject((HANDLE)hBrush);
ReleaseDC(Caret.hwnd, hdc);
}
/*****************************************************************
* CreateCaret (USER.163)
*/
void CreateCaret(HWND hwnd, HBITMAP bitmap, short width, short height)
{
if (!hwnd) return;
/* if cursor already exists, destroy it */
/* if (Caret.hwnd)
DestroyCaret();
*/
if (bitmap && bitmap != 1)
Caret.bitmap = bitmap;
if (width)
Caret.width = width;
else
Caret.width = GetSystemMetrics(SM_CXBORDER);
if (height)
Caret.height = height;
else
Caret.height = GetSystemMetrics(SM_CYBORDER);
Caret.hwnd = hwnd;
Caret.hidden = 1;
Caret.on = FALSE;
Caret.x = 0;
Caret.y = 0;
if (bitmap == 1)
Caret.color = GetSysColor(COLOR_GRAYTEXT);
else
Caret.color = GetSysColor(COLOR_WINDOWTEXT);
Caret.timeout = 750;
LockCaret = FALSE;
Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout, (FARPROC)CARET_Callback);
dprintf_caret(stddeb,"CreateCaret: hwnd=%d, timerid=%d\n",
hwnd, Caret.timerid);
}
/*****************************************************************
* DestroyCaret (USER.164)
*/
void DestroyCaret()
{
/* if (!Caret.hwnd) return;
*/
dprintf_caret(stddeb,"DestroyCaret: timerid=%d\n", Caret.timerid);
KillSystemTimer( (HWND)0, Caret.timerid);
if (Caret.on)
CARET_HideCaret();
Caret.hwnd = 0; /* cursor marked as not existing */
}
/*****************************************************************
* SetCaretPos (USER.165)
*/
void SetCaretPos(short x, short y)
{
if (!Caret.hwnd) return;
dprintf_caret(stddeb,"SetCaretPos: x=%d, y=%d\n", x, y);
LockCaret = TRUE;
if (Caret.on)
CARET_HideCaret();
Caret.x = x;
Caret.y = y;
LockCaret = FALSE;
}
/*****************************************************************
* HideCaret (USER.166)
*/
void HideCaret(HWND hwnd)
{
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
LockCaret = TRUE;
if (Caret.on)
CARET_HideCaret();
++Caret.hidden;
LockCaret = FALSE;
}
/*****************************************************************
* ShowCaret (USER.167)
*/
void ShowCaret(HWND hwnd)
{
if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return;
dprintf_caret(stddeb,"ShowCaret: hidden=%d\n", Caret.hidden);
if (Caret.hidden)
--Caret.hidden;
}
/*****************************************************************
* SetCaretBlinkTime (USER.168)
*/
void SetCaretBlinkTime(WORD msecs)
{
if (!Caret.hwnd) return;
KillSystemTimer( (HWND)0, Caret.timerid);
Caret.timeout = msecs;
Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout, (FARPROC)CARET_Callback);
}
/*****************************************************************
* GetCaretBlinkTime (USER.169)
*/
WORD GetCaretBlinkTime()
{
if (!Caret.hwnd) return 0;
return Caret.timeout;
}
/*****************************************************************
* GetCaretPos (USER.183)
*/
void GetCaretPos(LPPOINT pt)
{
if (!Caret.hwnd || !pt) return;
pt->x = Caret.x;
pt->y = Caret.y;
}