mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 21:43:09 +00:00

- TSVN choked repeatedly when attempting to merge ~9000 revs into the branch (tried 3 times on 2 different computers) - If someone wants to delete aicom-network-fixes, they are welcome to - Lesson learned: Letting a branch get thousands of revs out of date is a horrible idea svn path=/branches/aicom-network-branch/; revision=44353
84 lines
2.7 KiB
C
84 lines
2.7 KiB
C
/*
|
|
* PROJECT: PAINT for ReactOS
|
|
* LICENSE: LGPL
|
|
* FILE: base/applications/paint/selection.c
|
|
* PURPOSE: Window procedure of the selection window
|
|
* PROGRAMMERS: Benedikt Freisen
|
|
*/
|
|
|
|
/* INCLUDES *********************************************************/
|
|
|
|
#include <windows.h>
|
|
#include "globalvar.h"
|
|
#include "drawing.h"
|
|
#include "history.h"
|
|
#include "mouse.h"
|
|
|
|
/* FUNCTIONS ********************************************************/
|
|
|
|
BOOL moving = FALSE;
|
|
short xPos;
|
|
short yPos;
|
|
|
|
LRESULT CALLBACK
|
|
SelectionWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
switch (message)
|
|
{
|
|
case WM_PAINT:
|
|
{
|
|
if (!moving)
|
|
{
|
|
HDC hDC = GetDC(hwnd);
|
|
DefWindowProc(hwnd, message, wParam, lParam);
|
|
SelectionFrame(hDC, 1, 1, rectSel_dest[2] * zoom / 1000 + 5,
|
|
rectSel_dest[3] * zoom / 1000 + 5);
|
|
ReleaseDC(hwnd, hDC);
|
|
}
|
|
break;
|
|
}
|
|
case WM_LBUTTONDOWN:
|
|
xPos = LOWORD(lParam);
|
|
yPos = HIWORD(lParam);
|
|
SetCapture(hwnd);
|
|
moving = TRUE;
|
|
break;
|
|
case WM_MOUSEMOVE:
|
|
if (moving)
|
|
{
|
|
resetToU1();
|
|
rectSel_dest[0] += (short)LOWORD(lParam) - xPos;
|
|
rectSel_dest[1] += (short)HIWORD(lParam) - yPos;
|
|
|
|
Rect(hDrawingDC, rectSel_src[0], rectSel_src[1], rectSel_src[0] + rectSel_src[2],
|
|
rectSel_src[1] + rectSel_src[3], bgColor, bgColor, 0, TRUE);
|
|
if (transpBg == 0)
|
|
BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3],
|
|
hSelDC, 0, 0, SRCCOPY);
|
|
else
|
|
BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3],
|
|
hSelDC, 0, 0, SRCAND);
|
|
//TransparentBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3],
|
|
// hSelDC, 0, 0, rectSel_dest[2], rectSel_dest[3], bgColor);
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
xPos = LOWORD(lParam);
|
|
yPos = HIWORD(lParam);
|
|
//SendMessage(hwnd, WM_PAINT, 0, 0);
|
|
}
|
|
break;
|
|
case WM_LBUTTONUP:
|
|
if (moving)
|
|
{
|
|
moving = FALSE;
|
|
ReleaseCapture();
|
|
placeSelWin();
|
|
ShowWindow(hSelection, SW_HIDE);
|
|
ShowWindow(hSelection, SW_SHOW);
|
|
}
|
|
break;
|
|
default:
|
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
|
}
|
|
|
|
return 0;
|
|
}
|