
Thu May 16 13:35:31 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [*/*.c] Renamed RECT, POINT and SIZE structures to RECT16, POINT16 and SIZE16. Implemented Win32 version of most functions that take these types as parameters. * [configure] Patched autoconf to attempt to correctly detect -lnsl and -lsocket. Please check this out. * [controls/button.c] Added support for Win32 BM_* messages. * [controls/menu.c] Avoid sending extra WM_MENUSELECT messages. This avoids crashes with Excel. * [memory.heap.c] [include/heap.h] Added support for SEGPTRs in Win32 heaps. Added a few macros to make using SEGPTRs easier. They are a bit slower than MAKE_SEGPTR, but they work with Win32. * [memory/atom.c] Implemented Win32 atom functions. * [memory/local.c] Fixed LocalReAlloc() changes to avoid copying the whole block twice. * [win32/memory.c] Use /dev/zero instead of MAP_ANON for VirtualAlloc(). * [windows/class.c] Properly implemented the Win32 class functions. * [windows/winproc.c] (New file) New file handling the message translation between Win16 and Win32. Mon May 13 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/mdi.c] [windows/menu.c] Improved WM_MDICREATE and WM_MDICASCADE handling. * [windows/event.c] [objects/bitblt.c] Handle GraphicsExpose event for BitBlt from screen to screen. * [windows/event.c] [windows/win.c] [windows/nonclient.c] Bunch of fixes for problems with -managed. * [windows/win.c] [windows/winpos.c] Changed conditions for WM_SIZE, WM_MOVE, and WM_GETMINMAXINFO in CreateWindow. * [windows/win.c] [windows/queue.c] [misc/user.c] Do not send WM_PARENTNOTIFY when in AppExit and call WH_SHELL on window creation/destruction. * [objects/palette.c] Crude RealizePalette(). At least something is visible in LviewPro. Sun May 12 02:05:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk> * [if1632/gdi32.spec] Added Rectangle (use win16 version). * [if1632/kernel32.spec] Added GetWindowsDirectoryA (use win16 GetWindowsDirectory). * [if1632/user32.spec] Added GetSubMenu, MoveWindow, SetScrollPos, SetScrollRange (use win16 versions). Added SetWindowsHookExA (empty stub for now). * [include/handle32.h] Changed #include <malloc.h> to #include <stdlib.h> to prevent hate message from FreeBSD compiler. * [win32/newfns.c] Added new function SetWindowsHookEx32A (empty stub for now). * [win32/user32.c] Removed redundant debugging printf statement. Sun May 12 01:24:57 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk> * [memory/local.c] Avoid creating adjacent free blocks. Free the block in LocalReAlloc() before allocating a new one. Fixed LocalReAlloc() for discarded blocks. Fri May 10 23:05:12 1996 Jukka Iivonen <iivonen@cc.helsinki.fi> * [resources/sysres_Fi.rc] ChooseFont and ChooseColor dialogs updated. Fri May 10 17:19:33 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/drive.c,if1632/kernel.spec] GetCurrentDirectory(),SetCurrentDirectory() implemented. * [if1632/advapi32.spec] [if1632/kernel.spec] [if1632/shell.spec] [include/windows.h] [include/winreg.h] [loader/main.c] [misc/main.c] [misc/shell.c] [misc/registry.c] Registry fixes: - loads win95 registry databases, - save only updated keys on default, - now adhers to the new function naming standard, - minor cleanups. Tue May 7 22:36:13 1996 Albrecht Kleine <kleine@ak.sax.de> * [combo.c] Added WM_COMMAND-handling for interaction between EDIT and COMBOLBOX and synchronized mine with Greg Kreider's works. * [commdlg.c] Bugfix in ChooseFont: font size handling.
299 lines
6.7 KiB
C
299 lines
6.7 KiB
C
/*
|
|
* Caret functions
|
|
*
|
|
* Copyright 1993 David Metcalfe
|
|
* Copyright 1996 Frans van Dorsselaer
|
|
*/
|
|
|
|
#include "windows.h"
|
|
#include "module.h"
|
|
#include "stddebug.h"
|
|
/* #define DEBUG_CARET */
|
|
#include "debug.h"
|
|
|
|
|
|
typedef struct
|
|
{
|
|
HWND hwnd;
|
|
short hidden;
|
|
BOOL on;
|
|
short x;
|
|
short y;
|
|
short width;
|
|
short height;
|
|
HBRUSH hBrush;
|
|
WORD timeout;
|
|
WORD timerid;
|
|
} CARET;
|
|
|
|
typedef enum
|
|
{
|
|
CARET_OFF = 0,
|
|
CARET_ON,
|
|
CARET_TOGGLE,
|
|
} DISPLAY_CARET;
|
|
|
|
static CARET Caret = { 0, };
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_GetHwnd
|
|
*/
|
|
HWND CARET_GetHwnd()
|
|
{
|
|
return Caret.hwnd;
|
|
}
|
|
|
|
/*****************************************************************
|
|
* CARET_DisplayCaret
|
|
*/
|
|
void CARET_DisplayCaret(DISPLAY_CARET status)
|
|
{
|
|
HDC hdc;
|
|
HBRUSH hPrevBrush;
|
|
|
|
if (Caret.on && (status == CARET_ON)) return;
|
|
if (!Caret.on && (status == CARET_OFF)) return;
|
|
|
|
/* So now it's always a toggle */
|
|
|
|
Caret.on = !Caret.on;
|
|
if (!(hdc = GetDCEx( Caret.hwnd, 0, DCX_USESTYLE | DCX_CACHE ))) return;
|
|
hPrevBrush = SelectObject( hdc, Caret.hBrush );
|
|
PatBlt( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT );
|
|
SelectObject( hdc, hPrevBrush );
|
|
ReleaseDC( Caret.hwnd, hdc );
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_Callback
|
|
*/
|
|
WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
|
|
{
|
|
dprintf_caret(stddeb,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
|
|
hwnd, timerid, Caret.on);
|
|
|
|
CARET_DisplayCaret(CARET_TOGGLE);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_SetTimer
|
|
*/
|
|
void CARET_SetTimer(void)
|
|
{
|
|
if (Caret.timerid) KillSystemTimer((HWND)0, Caret.timerid);
|
|
Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout,
|
|
MODULE_GetWndProcEntry16("CARET_Callback"));
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_ResetTimer
|
|
*/
|
|
void CARET_ResetTimer(void)
|
|
{
|
|
if (Caret.timerid)
|
|
{
|
|
KillSystemTimer((HWND)0, Caret.timerid);
|
|
Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout,
|
|
MODULE_GetWndProcEntry16("CARET_Callback"));
|
|
}
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CARET_KillTimer
|
|
*/
|
|
void CARET_KillTimer(void)
|
|
{
|
|
if (Caret.timerid)
|
|
{
|
|
KillSystemTimer((HWND)0, Caret.timerid);
|
|
Caret.timerid = 0;
|
|
}
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* CreateCaret (USER.163)
|
|
*/
|
|
BOOL CreateCaret(HWND hwnd, HBITMAP bitmap, INT width, INT height)
|
|
{
|
|
dprintf_caret(stddeb,"CreateCaret: hwnd=%04x\n", hwnd);
|
|
|
|
if (!hwnd) return FALSE;
|
|
|
|
/* if cursor already exists, destroy it */
|
|
if (Caret.hwnd) DestroyCaret();
|
|
|
|
if (bitmap && (bitmap != 1))
|
|
{
|
|
BITMAP bmp;
|
|
if (!GetObject( bitmap, sizeof(bmp), (LPSTR)&bmp )) return FALSE;
|
|
Caret.width = bmp.bmWidth;
|
|
Caret.height = bmp.bmHeight;
|
|
/* FIXME: we should make a copy of the bitmap instead of a brush */
|
|
Caret.hBrush = CreatePatternBrush( bitmap );
|
|
}
|
|
else
|
|
{
|
|
Caret.width = width ? width : GetSystemMetrics(SM_CXBORDER);
|
|
Caret.height = height ? height : GetSystemMetrics(SM_CYBORDER);
|
|
Caret.hBrush = CreateSolidBrush( bitmap ? GetSysColor(COLOR_GRAYTEXT) :
|
|
GetSysColor(COLOR_WINDOW) );
|
|
}
|
|
|
|
Caret.hwnd = hwnd;
|
|
Caret.hidden = 1;
|
|
Caret.on = FALSE;
|
|
Caret.x = 0;
|
|
Caret.y = 0;
|
|
|
|
Caret.timeout = GetProfileInt( "windows", "CursorBlinkRate", 750 );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* DestroyCaret (USER.164)
|
|
*/
|
|
|
|
BOOL DestroyCaret()
|
|
{
|
|
if (!Caret.hwnd) return FALSE;
|
|
|
|
dprintf_caret(stddeb,"DestroyCaret: hwnd=%04x, timerid=%d\n",
|
|
Caret.hwnd, Caret.timerid);
|
|
|
|
DeleteObject( Caret.hBrush );
|
|
CARET_KillTimer();
|
|
CARET_DisplayCaret(CARET_OFF);
|
|
|
|
Caret.hwnd = 0;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* SetCaretPos (USER.165)
|
|
*/
|
|
|
|
void SetCaretPos(short x, short y)
|
|
{
|
|
if (!Caret.hwnd) return;
|
|
if ((x == Caret.x) && (y == Caret.y)) return;
|
|
|
|
dprintf_caret(stddeb,"SetCaretPos: x=%d, y=%d\n", x, y);
|
|
|
|
CARET_KillTimer();
|
|
CARET_DisplayCaret(CARET_OFF);
|
|
Caret.x = x;
|
|
Caret.y = y;
|
|
if (!Caret.hidden)
|
|
{
|
|
CARET_DisplayCaret(CARET_ON);
|
|
CARET_SetTimer();
|
|
}
|
|
}
|
|
|
|
/*****************************************************************
|
|
* HideCaret (USER.166)
|
|
*/
|
|
|
|
void HideCaret(HWND hwnd)
|
|
{
|
|
if (!Caret.hwnd) return;
|
|
if (hwnd && (Caret.hwnd != hwnd)) return;
|
|
|
|
dprintf_caret(stddeb,"HideCaret: hwnd=%04x, hidden=%d\n",
|
|
hwnd, Caret.hidden);
|
|
|
|
CARET_KillTimer();
|
|
CARET_DisplayCaret(CARET_OFF);
|
|
Caret.hidden++;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* ShowCaret (USER.167)
|
|
*/
|
|
|
|
void ShowCaret(HWND hwnd)
|
|
{
|
|
if (!Caret.hwnd) return;
|
|
if (hwnd && (Caret.hwnd != hwnd)) return;
|
|
|
|
dprintf_caret(stddeb,"ShowCaret: hwnd=%04x, hidden=%d\n",
|
|
hwnd, Caret.hidden);
|
|
|
|
if (Caret.hidden)
|
|
{
|
|
Caret.hidden--;
|
|
if (!Caret.hidden)
|
|
{
|
|
CARET_DisplayCaret(CARET_ON);
|
|
CARET_SetTimer();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* SetCaretBlinkTime (USER.168)
|
|
*/
|
|
|
|
void SetCaretBlinkTime(WORD msecs)
|
|
{
|
|
if (!Caret.hwnd) return;
|
|
|
|
dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
|
|
Caret.hwnd, msecs);
|
|
|
|
Caret.timeout = msecs;
|
|
CARET_ResetTimer();
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretBlinkTime (USER.169)
|
|
*/
|
|
|
|
WORD GetCaretBlinkTime()
|
|
{
|
|
if (!Caret.hwnd) return 0;
|
|
|
|
dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
|
|
Caret.hwnd, Caret.timeout);
|
|
|
|
return Caret.timeout;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretPos16 (USER.183)
|
|
*/
|
|
void GetCaretPos16( LPPOINT16 pt )
|
|
{
|
|
if (!Caret.hwnd || !pt) return;
|
|
|
|
dprintf_caret(stddeb,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
|
|
Caret.hwnd, pt, Caret.x, Caret.y);
|
|
|
|
pt->x = Caret.x;
|
|
pt->y = Caret.y;
|
|
}
|
|
|
|
|
|
/*****************************************************************
|
|
* GetCaretPos32 (USER32.209)
|
|
*/
|
|
void GetCaretPos32( LPPOINT32 pt )
|
|
{
|
|
if (!Caret.hwnd || !pt) return;
|
|
pt->x = Caret.x;
|
|
pt->y = Caret.y;
|
|
}
|