Index: base/applications/mspaint/drawing.c =================================================================== --- base/applications/mspaint/drawing.c (revision 65654) +++ base/applications/mspaint/drawing.c (working copy) @@ -67,11 +67,16 @@ } void -Poly(HDC hdc, POINT * lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed) +Poly(HDC hdc, POINT * lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted) { LOGBRUSH logbrush; HBRUSH oldBrush; HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg)); + UINT oldRop = GetROP2(hdc); + + if (inverted) + SetROP2(hdc, R2_NOTXORPEN); + logbrush.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID; logbrush.lbColor = (style == 2) ? fg : bg; logbrush.lbHatch = 0; @@ -82,6 +87,8 @@ Polyline(hdc, lpPoints, nCount); DeleteObject(SelectObject(hdc, oldBrush)); DeleteObject(SelectObject(hdc, oldPen)); + + SetROP2(hdc, oldRop); } void @@ -223,6 +230,10 @@ HBRUSH oldBrush; LOGBRUSH logbrush; HPEN oldPen = SelectObject(hdc, CreatePen(PS_DOT, 1, 0x00000000)); + UINT oldRop = GetROP2(hdc); + + SetROP2(hdc, R2_NOTXORPEN); + logbrush.lbStyle = BS_HOLLOW; logbrush.lbColor = 0; logbrush.lbHatch = 0; @@ -230,31 +241,34 @@ Rectangle(hdc, x1, y1, x2, y2); DeleteObject(SelectObject(hdc, oldBrush)); DeleteObject(SelectObject(hdc, oldPen)); + + SetROP2(hdc, oldRop); } void -SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2) +SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, DWORD system_selection_color) { HBRUSH oldBrush; LOGBRUSH logbrush; - HPEN oldPen = SelectObject(hdc, CreatePen(PS_DOT, 1, 0x00000000)); + HPEN oldPen = SelectObject(hdc, CreatePen(PS_DOT, 1, system_selection_color)); + logbrush.lbStyle = BS_HOLLOW; logbrush.lbColor = 0; logbrush.lbHatch = 0; oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush)); - Rectangle(hdc, x1, y1, x2, y2); + Rectangle(hdc, x1, y1, x2, y2); /* SEL BOX FRAME */ DeleteObject(SelectObject(hdc, oldBrush)); DeleteObject(SelectObject(hdc, oldPen)); - oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, 0x00000000)); - oldBrush = SelectObject(hdc, CreateSolidBrush(0x00000000)); - Rectangle(hdc, x1 - 1, y1 - 1, x1 + 2, y1 + 2); - Rectangle(hdc, x2 - 2, y1 - 1, x2 + 2, y1 + 2); - Rectangle(hdc, x1 - 1, y2 - 2, x1 + 2, y2 + 1); - Rectangle(hdc, x2 - 2, y2 - 2, x2 + 2, y2 + 1); - Rectangle(hdc, (x1 + x2) / 2 - 1, y1 - 1, (x1 + x2) / 2 + 2, y1 + 2); - Rectangle(hdc, (x1 + x2) / 2 - 1, y2 - 2, (x1 + x2) / 2 + 2, y2 + 1); - Rectangle(hdc, x1 - 1, (y1 + y2) / 2 - 1, x1 + 2, (y1 + y2) / 2 + 2); - Rectangle(hdc, x2 - 2, (y1 + y2) / 2 - 1, x2 + 1, (y1 + y2) / 2 + 2); + oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, system_selection_color)); + oldBrush = SelectObject(hdc, CreateSolidBrush(system_selection_color)); + Rectangle(hdc, x1 - 1, y1 - 1, x1 + 3, y1 + 3); /* TOP-LEFT SEL GRIPPER */ + Rectangle(hdc, x2 - 3, y1 - 1, x2 + 3, y1 + 3); /* BOT-LEFT SEL GRIPPER */ + Rectangle(hdc, x1 - 1, y2 - 3, x1 + 3, y2 + 1); /* TOP-RIGH SEL GRIPPER */ + Rectangle(hdc, x2 - 3, y2 - 3, x2 + 3, y2 + 1); /* BOT-RIGH SEL GRIPPER */ + Rectangle(hdc, (x1 + x2) / 2 - 2, y1 - 2, (x1 + x2) / 2 + 2, y1 + 2); /* TOP SEL GRIPPER */ + Rectangle(hdc, (x1 + x2) / 2 - 2, y2 - 2, (x1 + x2) / 2 + 2, y2 + 2); /* BOT SEL GRIPPER */ + Rectangle(hdc, x1 - 2, (y1 + y2) / 2 - 2, x1 + 2, (y1 + y2) / 2 + 2); /* LEF SEL GRIPPER */ + Rectangle(hdc, x2 - 2, (y1 + y2) / 2 - 2, x2 + 2, (y1 + y2) / 2 + 2); /* RIG SEL GRIPPER */ DeleteObject(SelectObject(hdc, oldBrush)); DeleteObject(SelectObject(hdc, oldPen)); } Index: base/applications/mspaint/drawing.h =================================================================== --- base/applications/mspaint/drawing.h (revision 65654) +++ base/applications/mspaint/drawing.h (working copy) @@ -14,7 +14,7 @@ void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style); -void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed); +void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted); void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness); @@ -30,6 +30,6 @@ void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2); -void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2); +void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, DWORD system_selection_color); void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style); Index: base/applications/mspaint/mouse.c =================================================================== --- base/applications/mspaint/mouse.c (revision 65654) +++ base/applications/mspaint/mouse.c (working copy) @@ -118,7 +118,7 @@ pointStack[pointSP].x = x; pointStack[pointSP].y = y; if (pointSP + 1 >= 2) - Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE); + Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE, FALSE); if (pointSP == 0) { newReversible(); @@ -142,7 +142,7 @@ ptStack[ptSP].x = max(0, min(x, imgXRes)); ptStack[ptSP].y = max(0, min(y, imgYRes)); resetToU1(); - Poly(hdc, ptStack, ptSP + 1, 0, 0, 2, 0, FALSE); + Poly(hdc, ptStack, ptSP + 1, 0, 0, 2, 0, FALSE, TRUE); /* draw the freehand selection inverted/xored */ break; case TOOL_RECTSEL: case TOOL_TEXT: @@ -208,7 +208,7 @@ roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, &pointStack[pointSP].x, &pointStack[pointSP].y); if (pointSP + 1 >= 2) - Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE); + Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE, FALSE); break; case TOOL_ELLIPSE: resetToU1(); @@ -267,13 +267,13 @@ ptStackCopy[i].x = ptStack[i].x - rectSel_src.left; ptStackCopy[i].y = ptStack[i].y - rectSel_src.top; } - Poly(hSelDC, ptStackCopy, ptSP + 1, 0x00ffffff, 0x00ffffff, 1, 2, TRUE); + Poly(hSelDC, ptStackCopy, ptSP + 1, 0x00ffffff, 0x00ffffff, 1, 2, TRUE, FALSE); HeapFree(GetProcessHeap(), 0, ptStackCopy); SelectObject(hSelDC, hSelBm = CreateDIBWithProperties(RECT_WIDTH(rectSel_src), RECT_HEIGHT(rectSel_src))); resetToU1(); MaskBlt(hSelDC, 0, 0, RECT_WIDTH(rectSel_src), RECT_HEIGHT(rectSel_src), hDrawingDC, rectSel_src.left, rectSel_src.top, hSelMask, 0, 0, MAKEROP4(SRCCOPY, WHITENESS)); - Poly(hdc, ptStack, ptSP + 1, bg, bg, 1, 2, TRUE); + Poly(hdc, ptStack, ptSP + 1, bg, bg, 1, 2, TRUE, FALSE); newReversible(); MaskBlt(hDrawingDC, rectSel_src.left, rectSel_src.top, RECT_WIDTH(rectSel_src), RECT_HEIGHT(rectSel_src), hSelDC, 0, @@ -362,12 +362,12 @@ if ((pointStack[0].x - x) * (pointStack[0].x - x) + (pointStack[0].y - y) * (pointStack[0].y - y) <= lineWidth * lineWidth + 1) { - Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, TRUE); + Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, TRUE, FALSE); pointSP = 0; } else { - Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, FALSE); + Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, FALSE, FALSE); } } if (pointSP == 255) @@ -438,7 +438,7 @@ pointStack[pointSP].x = x; pointStack[pointSP].y = y; if (pointSP + 1 >= 2) - Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE); + Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE, FALSE); if (pointSP == 0) { newReversible(); @@ -503,7 +503,7 @@ roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, &pointStack[pointSP].x, &pointStack[pointSP].y); if (pointSP + 1 >= 2) - Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE); + Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE, FALSE); break; case TOOL_ELLIPSE: resetToU1(); @@ -565,12 +565,12 @@ if ((pointStack[0].x - x) * (pointStack[0].x - x) + (pointStack[0].y - y) * (pointStack[0].y - y) <= lineWidth * lineWidth + 1) { - Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, TRUE); + Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, TRUE, FALSE); pointSP = 0; } else { - Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, FALSE); + Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, FALSE, FALSE); } } if (pointSP == 255) Index: base/applications/mspaint/selection.c =================================================================== --- base/applications/mspaint/selection.c (revision 65654) +++ base/applications/mspaint/selection.c (working copy) @@ -37,6 +37,7 @@ POINTS pos; POINTS frac; POINT delta; +DWORD system_selection_color; void RegisterWclSelection() @@ -95,8 +96,8 @@ if (IsWindowVisible(hSelection)) { SendMessage(hSelection, WM_LBUTTONDOWN, 0, MAKELPARAM(0, 0)); - SendMessage(hSelection, WM_MOUSEMOVE, 0, MAKELPARAM(0, 0)); - SendMessage(hSelection, WM_LBUTTONUP, 0, MAKELPARAM(0, 0)); + SendMessage(hSelection, WM_MOUSEMOVE, 0, MAKELPARAM(0, 0)); + SendMessage(hSelection, WM_LBUTTONUP, 0, MAKELPARAM(0, 0)); } } @@ -103,29 +104,29 @@ int identifyCorner(short x, short y, short w, short h) { - if (y < 3) + if (y <= 4) { - if (x < 3) + if (x <= 4) return ACTION_RESIZE_TOP_LEFT; - if ((x < w / 2 + 2) && (x >= w / 2 - 1)) + if ((x > 4) && (x < w - 4)) return ACTION_RESIZE_TOP; - if (x >= w - 3) + if (x >= w - 4) return ACTION_RESIZE_TOP_RIGHT; } - if ((y < h / 2 + 2) && (y >= h / 2 - 1)) + if ((y > 4) && (y < h - 4)) { - if (x < 3) + if (x < 4) return ACTION_RESIZE_LEFT; - if (x >= w - 3) + if (x > w - 4) return ACTION_RESIZE_RIGHT; } - if (y >= h - 3) + if (y >= h - 4) { - if (x < 3) + if (x <= 4) return ACTION_RESIZE_BOTTOM_LEFT; - if ((x < w / 2 + 2) && (x >= w / 2 - 1)) + if ((x > 4) && (x < w - 4)) return ACTION_RESIZE_BOTTOM; - if (x >= w - 3) + if (x >= w - 4) return ACTION_RESIZE_BOTTOM_RIGHT; } return 0; @@ -143,12 +144,22 @@ HDC hDC = GetDC(hwnd); DefWindowProc(hwnd, message, wParam, lParam); SelectionFrame(hDC, 1, 1, RECT_WIDTH(rectSel_dest) * zoom / 1000 + 5, - RECT_HEIGHT(rectSel_dest) * zoom / 1000 + 5); + RECT_HEIGHT(rectSel_dest) * zoom / 1000 + 5, + system_selection_color); ReleaseDC(hwnd, hDC); } break; } + case WM_CREATE: + case WM_SYSCOLORCHANGE: + { + /* update the system selection color */ + system_selection_color = GetSysColor(COLOR_HIGHLIGHT); + SendMessage(hwnd, WM_PAINT, 0, MAKELPARAM(0, 0)); + break; + } case WM_LBUTTONDOWN: + { pos.x = GET_X_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam); delta.x = 0; @@ -159,6 +170,7 @@ moving = TRUE; InvalidateRect(hScrlClient, NULL, TRUE); break; + } case WM_MOUSEMOVE: if (moving) { Index: base/applications/mspaint/winproc.c =================================================================== --- base/applications/mspaint/winproc.c (revision 65654) +++ base/applications/mspaint/winproc.c (working copy) @@ -669,6 +669,18 @@ } break; + case WM_MOUSEWHEEL: + { + LONG fwKeys = GET_KEYSTATE_WPARAM(wParam); + LONG zDelta = GET_WHEEL_DELTA_WPARAM(wParam) /* / WHEEL_DELTA */ + zoom; + + /* zoom with the Ctrl key pressed */ + if(fwKeys & MK_CONTROL && zDelta >= 125 && zDelta <= 8000) + { + zoomTo(zDelta, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + } + } + case WM_MOUSELEAVE: SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) _T("")); if (activeTool == TOOL_ZOOM) @@ -806,7 +818,7 @@ if (activeTool == TOOL_FREESEL) { newReversible(); - Poly(hDrawingDC, ptStack, ptSP + 1, 0, 0, 2, 0, FALSE); + Poly(hDrawingDC, ptStack, ptSP + 1, 0, 0, 2, 0, FALSE, TRUE); } break; }