Author: bfreisen
Date: Fri Jul 10 22:21:27 2009
New Revision: 41851
URL:
http://svn.reactos.org/svn/reactos?rev=41851&view=rev
Log:
- During resizing the future size is shown in the status bar
- Rubber works as color replacer when used with right mouse button
(mouse handling code reorganized)
- Bug occuring when painting to neg. coordinates finally fixed
- Polygon-tool added
- Bezier-tool added
Modified:
trunk/reactos/base/applications/paint/drawing.c
trunk/reactos/base/applications/paint/drawing.h
trunk/reactos/base/applications/paint/globalvar.h
trunk/reactos/base/applications/paint/mouse.c
trunk/reactos/base/applications/paint/mouse.h
trunk/reactos/base/applications/paint/sizebox.c
trunk/reactos/base/applications/paint/toolsettings.c
trunk/reactos/base/applications/paint/winproc.c
Modified: trunk/reactos/base/applications/paint/drawing.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/dr…
==============================================================================
--- trunk/reactos/base/applications/paint/drawing.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/drawing.c [iso-8859-1] Fri Jul 10 22:21:27 2009
@@ -20,13 +20,13 @@
DeleteObject(SelectObject(hdc, oldPen));
}
-void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
BOOL filled)
-{
- HBRUSH oldBrush;
- LOGBRUSH logbrush;
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
- if (filled) logbrush.lbStyle = BS_SOLID; else logbrush.lbStyle = BS_HOLLOW;
- logbrush.lbColor = bg;
+void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
int style)
+{
+ HBRUSH oldBrush;
+ LOGBRUSH logbrush;
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
+ if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID;
+ if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
Rectangle(hdc, x1, y1, x2, y2);
@@ -34,13 +34,13 @@
DeleteObject(SelectObject(hdc, oldPen));
}
-void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
BOOL filled)
-{
- HBRUSH oldBrush;
- LOGBRUSH logbrush;
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
- if (filled) logbrush.lbStyle = BS_SOLID; else logbrush.lbStyle = BS_HOLLOW;
- logbrush.lbColor = bg;
+void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
int style)
+{
+ HBRUSH oldBrush;
+ LOGBRUSH logbrush;
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
+ if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID;
+ if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
Ellipse(hdc, x1, y1, x2, y2);
@@ -48,17 +48,46 @@
DeleteObject(SelectObject(hdc, oldPen));
}
-void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
thickness, BOOL filled)
-{
- LOGBRUSH logbrush;
- HBRUSH oldBrush;
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
- if (filled) logbrush.lbStyle = BS_SOLID; else logbrush.lbStyle = BS_HOLLOW;
- logbrush.lbColor = bg;
+void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
thickness, int style)
+{
+ LOGBRUSH logbrush;
+ HBRUSH oldBrush;
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
+ if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID;
+ if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
RoundRect(hdc, x1, y1, x2, y2, 16, 16);
DeleteObject(SelectObject(hdc, oldBrush));
+ DeleteObject(SelectObject(hdc, oldPen));
+}
+
+void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style,
BOOL closed)
+{
+ LOGBRUSH logbrush;
+ HBRUSH oldBrush;
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
+ if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID;
+ if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg;
+ logbrush.lbHatch = 0;
+ oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
+ if (closed)
+ Polygon(hdc, lpPoints, nCount);
+ else
+ Polyline(hdc, lpPoints, nCount);
+ DeleteObject(SelectObject(hdc, oldBrush));
+ DeleteObject(SelectObject(hdc, oldPen));
+}
+
+void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness)
+{
+ POINT fourPoints[4];
+ fourPoints[0] = p1;
+ fourPoints[1] = p2;
+ fourPoints[2] = p3;
+ fourPoints[3] = p4;
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
+ PolyBezier(hdc, fourPoints, 4);
DeleteObject(SelectObject(hdc, oldPen));
}
@@ -79,6 +108,15 @@
Rectangle(hdc, (x1*(100-a)+x2*a)/100-radius+1, (y1*(100-a)+y2*a)/100-radius+1,
(x1*(100-a)+x2*a)/100+radius+1, (y1*(100-a)+y2*a)/100+radius+1);
DeleteObject(SelectObject(hdc, oldBrush));
DeleteObject(SelectObject(hdc, oldPen));
+}
+
+void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
radius)
+{
+ short a, x, y;
+ for (a=0; a<=100; a++)
+ for (y=(y1*(100-a)+y2*a)/100-radius+1; y<(y1*(100-a)+y2*a)/100+radius+1; y++)
+ for (x=(x1*(100-a)+x2*a)/100-radius+1; x<(x1*(100-a)+x2*a)/100+radius+1;
x++)
+ if (GetPixel(hdc, x, y)==fg) SetPixel(hdc, x, y, bg);
}
void Airbrush(HDC hdc, short x, short y, int color, int r)
Modified: trunk/reactos/base/applications/paint/drawing.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/dr…
==============================================================================
--- trunk/reactos/base/applications/paint/drawing.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/drawing.h [iso-8859-1] Fri Jul 10 22:21:27 2009
@@ -8,15 +8,21 @@
void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness);
-void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
BOOL filled);
+void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
int style);
-void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
BOOL filled);
+void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness,
int style);
-void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
thickness, BOOL filled);
+void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
thickness, int style);
+
+void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style,
BOOL closed);
+
+void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness);
void Fill(HDC hdc, int x, int y, int color);
void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius);
+
+void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
radius);
void Airbrush(HDC hdc, short x, short y, int color, int r);
Modified: trunk/reactos/base/applications/paint/globalvar.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/gl…
==============================================================================
--- trunk/reactos/base/applications/paint/globalvar.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/globalvar.h [iso-8859-1] Fri Jul 10 22:21:27
2009
@@ -85,3 +85,8 @@
extern HWND hSizeboxLeftBottom;
extern HWND hSizeboxCenterBottom;
extern HWND hSizeboxRightBottom;
+
+/* VARIABLES declared in mouse.c *************************************/
+
+extern POINT pointStack[256];
+extern short pointSP;
Modified: trunk/reactos/base/applications/paint/mouse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/mo…
==============================================================================
--- trunk/reactos/base/applications/paint/mouse.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/mouse.c [iso-8859-1] Fri Jul 10 22:21:27 2009
@@ -23,37 +23,70 @@
//SendMessage(hSelection, WM_PAINT, 0, 0);
}
-void startPainting(HDC hdc, short x, short y, int fg, int bg)
+POINT pointStack[256];
+short pointSP;
+
+void startPaintingL(HDC hdc, short x, short y, int fg, int bg)
{
startX = x;
startY = y;
lastX = x;
lastY = y;
- if ((activeTool!=5)&&(activeTool!=6)) newReversible();
- switch (activeTool)
- {
+ switch (activeTool)
+ {
+ case 1:
+ case 10:
+ case 11:
+ case 15:
+ case 16:
+ newReversible();
case 2:
+ newReversible();
ShowWindow(hSelection, SW_HIDE);
break;
case 3:
+ newReversible();
Erase(hdc, x, y, x, y, bg, rubberRadius);
break;
case 4:
+ newReversible();
Fill(hdc, x, y, fg);
break;
case 7:
+ newReversible();
SetPixel(hdc, x, y, fg);
break;
case 8:
+ newReversible();
Brush(hdc, x, y, x, y, fg, brushStyle);
break;
case 9:
+ newReversible();
Airbrush(hdc, x, y, fg, airBrushWidth);
break;
- }
-}
-
-void whilePainting(HDC hdc, short x, short y, int fg, int bg)
+ case 12:
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ if (pointSP==0)
+ {
+ newReversible();
+ pointSP++;
+ }
+ break;
+ case 14:
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, fg, bg, lineWidth,
shapeStyle, FALSE);
+ if (pointSP==0)
+ {
+ newReversible();
+ pointSP++;
+ }
+ break;
+ }
+}
+
+void whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
@@ -87,50 +120,34 @@
resetToU1();
Line(hdc, startX, startY, x, y, fg, lineWidth);
break;
+ case 12:
+ resetToU1();
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ switch (pointSP)
+ {
+ case 1: Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x,
pointStack[1].y, fg, lineWidth); break;
+ case 2: Bezier(hdc, pointStack[0], pointStack[2], pointStack[2],
pointStack[1], fg, lineWidth); break;
+ case 3: Bezier(hdc, pointStack[0], pointStack[2], pointStack[3],
pointStack[1], fg, lineWidth); break;
+ }
+ break;
case 13:
resetToU1();
- switch (shapeStyle)
- {
- case 0:
- Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE);
- break;
- case 1:
- Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE);
- break;
- case 2:
- Rect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE);
- break;
- }
- break;
- case 15:
- resetToU1();
- switch (shapeStyle)
- {
- case 0:
- Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE);
- break;
- case 1:
- Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE);
- break;
- case 2:
- Ellp(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE);
- break;
- }
- break;
- case 16:
- resetToU1();
- switch (shapeStyle)
- {
- case 0:
- RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE);
- break;
- case 1:
- RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE);
- break;
- case 2:
- RRect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE);
- break;
- }
+ Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
+ break;
+ case 14:
+ resetToU1();
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, fg, bg, lineWidth,
shapeStyle, FALSE);
+ break;
+ case 15:
+ resetToU1();
+ Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
+ break;
+ case 16:
+ resetToU1();
+ RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
break;
}
@@ -138,7 +155,7 @@
lastY = y;
}
-void endPainting(HDC hdc, short x, short y, int fg, int bg)
+void endPaintingL(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
@@ -163,50 +180,204 @@
resetToU1();
Line(hdc, startX, startY, x, y, fg, lineWidth);
break;
+ case 12:
+ pointSP++;
+ if (pointSP==4) pointSP = 0;
+ break;
case 13:
resetToU1();
- switch (shapeStyle)
- {
- case 0:
- Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE);
- break;
- case 1:
- Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE);
- break;
- case 2:
- Rect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE);
- break;
- }
- break;
- case 15:
- resetToU1();
- switch (shapeStyle)
- {
- case 0:
- Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE);
- break;
- case 1:
- Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE);
- break;
- case 2:
- Ellp(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE);
- break;
- }
- break;
- case 16:
- resetToU1();
- switch (shapeStyle)
- {
- case 0:
- RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE);
- break;
- case 1:
- RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE);
- break;
- case 2:
- RRect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE);
- break;
- }
- break;
- }
-}
+ Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
+ break;
+ case 14:
+ resetToU1();
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ pointSP++;
+ if (pointSP>=2)
+ {
+ 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);
+ pointSP = 0;
+ }
+ else
+ {
+ Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle,
FALSE);
+ }
+ }
+ if (pointSP==255) pointSP--;
+ break;
+ case 15:
+ resetToU1();
+ Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
+ break;
+ case 16:
+ resetToU1();
+ RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
+ break;
+ }
+}
+
+void startPaintingR(HDC hdc, short x, short y, int fg, int bg)
+{
+ startX = x;
+ startY = y;
+ lastX = x;
+ lastY = y;
+ switch (activeTool)
+ {
+ case 1:
+ case 10:
+ case 11:
+ case 15:
+ case 16:
+ newReversible();
+ case 3:
+ newReversible();
+ Replace(hdc, x, y, x, y, fg, bg, rubberRadius);
+ break;
+ case 4:
+ newReversible();
+ Fill(hdc, x, y, bg);
+ break;
+ case 7:
+ newReversible();
+ SetPixel(hdc, x, y, bg);
+ break;
+ case 8:
+ newReversible();
+ Brush(hdc, x, y, x, y, bg, brushStyle);
+ break;
+ case 9:
+ newReversible();
+ Airbrush(hdc, x, y, bg, airBrushWidth);
+ break;
+ case 12:
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ if (pointSP==0)
+ {
+ newReversible();
+ pointSP++;
+ }
+ break;
+ case 14:
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, bg, fg, lineWidth,
shapeStyle, FALSE);
+ if (pointSP==0)
+ {
+ newReversible();
+ pointSP++;
+ }
+ break;
+ }
+}
+
+void whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
+{
+ switch (activeTool)
+ {
+ case 3:
+ Replace(hdc, lastX, lastY, x, y, fg, bg, rubberRadius);
+ break;
+ case 7:
+ Line(hdc, lastX, lastY, x, y, bg, 1);
+ break;
+ case 8:
+ Brush(hdc, lastX, lastY, x, y, bg, brushStyle);
+ break;
+ case 9:
+ Airbrush(hdc, x, y, bg, airBrushWidth);
+ break;
+ case 11:
+ resetToU1();
+ Line(hdc, startX, startY, x, y, bg, lineWidth);
+ break;
+ case 12:
+ resetToU1();
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ switch (pointSP)
+ {
+ case 1: Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x,
pointStack[1].y, bg, lineWidth); break;
+ case 2: Bezier(hdc, pointStack[0], pointStack[2], pointStack[2],
pointStack[1], bg, lineWidth); break;
+ case 3: Bezier(hdc, pointStack[0], pointStack[2], pointStack[3],
pointStack[1], bg, lineWidth); break;
+ }
+ break;
+ case 13:
+ resetToU1();
+ Rect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
+ break;
+ case 14:
+ resetToU1();
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, bg, fg, lineWidth,
shapeStyle, FALSE);
+ break;
+ case 15:
+ resetToU1();
+ Ellp(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
+ break;
+ case 16:
+ resetToU1();
+ RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
+ break;
+ }
+
+ lastX = x;
+ lastY = y;
+}
+
+void endPaintingR(HDC hdc, short x, short y, int fg, int bg)
+{
+ switch (activeTool)
+ {
+ case 3:
+ Replace(hdc, lastX, lastY, x, y, fg, bg, rubberRadius);
+ break;
+ case 7:
+ Line(hdc, lastX, lastY, x, y, bg, 1);
+ SetPixel(hdc, x, y, bg);
+ break;
+ case 11:
+ resetToU1();
+ Line(hdc, startX, startY, x, y, bg, lineWidth);
+ break;
+ case 12:
+ pointSP++;
+ if (pointSP==4) pointSP = 0;
+ break;
+ case 13:
+ resetToU1();
+ Rect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
+ break;
+ case 14:
+ resetToU1();
+ pointStack[pointSP].x = x;
+ pointStack[pointSP].y = y;
+ pointSP++;
+ if (pointSP>=2)
+ {
+ 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);
+ pointSP = 0;
+ }
+ else
+ {
+ Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle,
FALSE);
+ }
+ }
+ if (pointSP==255) pointSP--;
+ break;
+ case 15:
+ resetToU1();
+ Ellp(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
+ break;
+ case 16:
+ resetToU1();
+ RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
+ break;
+ }
+}
Modified: trunk/reactos/base/applications/paint/mouse.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/mo…
==============================================================================
--- trunk/reactos/base/applications/paint/mouse.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/mouse.h [iso-8859-1] Fri Jul 10 22:21:27 2009
@@ -8,8 +8,14 @@
void placeSelWin();
-void startPainting(HDC hdc, short x, short y, int fg, int bg);
+void startPaintingL(HDC hdc, short x, short y, int fg, int bg);
-void whilePainting(HDC hdc, short x, short y, int fg, int bg);
+void whilePaintingL(HDC hdc, short x, short y, int fg, int bg);
-void endPainting(HDC hdc, short x, short y, int fg, int bg);
+void endPaintingL(HDC hdc, short x, short y, int fg, int bg);
+
+void startPaintingR(HDC hdc, short x, short y, int fg, int bg);
+
+void whilePaintingR(HDC hdc, short x, short y, int fg, int bg);
+
+void endPaintingR(HDC hdc, short x, short y, int fg, int bg);
Modified: trunk/reactos/base/applications/paint/sizebox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/si…
==============================================================================
--- trunk/reactos/base/applications/paint/sizebox.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/sizebox.c [iso-8859-1] Fri Jul 10 22:21:27 2009
@@ -9,10 +9,10 @@
/* INCLUDES *********************************************************/
#include <windows.h>
+#include <commctrl.h>
+#include <tchar.h>
#include "globalvar.h"
-#include "drawing.h"
#include "history.h"
-#include "mouse.h"
/* FUNCTIONS ********************************************************/
@@ -43,7 +43,31 @@
SetCapture(hwnd);
break;
case WM_MOUSEMOVE:
- // TODO: print things in the status bar
+ if (resizing)
+ {
+ TCHAR sizeStr[100];
+ short xRel;
+ short yRel;
+ xRel = ((short)LOWORD(lParam)-xOrig)*1000/zoom;
+ yRel = ((short)HIWORD(lParam)-yOrig)*1000/zoom;
+ if (hwnd==hSizeboxLeftTop)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes-xRel,
imgYRes-yRel);
+ if (hwnd==hSizeboxCenterTop)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes-yRel);
+ if (hwnd==hSizeboxRightTop)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes+xRel,
imgYRes-yRel);
+ if (hwnd==hSizeboxLeftCenter)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes-xRel, imgYRes);
+ if (hwnd==hSizeboxRightCenter)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes+xRel, imgYRes);
+ if (hwnd==hSizeboxLeftBottom)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes-xRel,
imgYRes+yRel);
+ if (hwnd==hSizeboxCenterBottom)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes+yRel);
+ if (hwnd==hSizeboxRightBottom)
+ _stprintf(sizeStr, _T("%d x %d"), imgXRes+xRel,
imgYRes+yRel);
+ SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
+ }
break;
case WM_LBUTTONUP:
if (resizing)
@@ -70,6 +94,7 @@
cropReversible(imgXRes, imgYRes+yRel, 0, 0);
if (hwnd==hSizeboxRightBottom)
cropReversible(imgXRes+xRel, imgYRes+yRel, 0, 0);
+ SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
}
break;
Modified: trunk/reactos/base/applications/paint/toolsettings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/to…
==============================================================================
--- trunk/reactos/base/applications/paint/toolsettings.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/toolsettings.c [iso-8859-1] Fri Jul 10 22:21:27
2009
@@ -148,14 +148,14 @@
}
}
if (shapeStyle==0)
- Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_HIGHLIGHTTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, FALSE);
- else
- Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_WINDOWTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, FALSE);
+ Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_HIGHLIGHTTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, 0);
+ else
+ Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_WINDOWTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, 0);
if (shapeStyle==1)
- Rect(hdc, 5, 26, 37, 36,
GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, TRUE);
- else
- Rect(hdc, 5, 26, 37, 36, GetSysColor(COLOR_WINDOWTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, TRUE);
- Rect(hdc, 5, 46, 37, 56, GetSysColor(COLOR_APPWORKSPACE),
GetSysColor(COLOR_APPWORKSPACE), 1, TRUE);
+ Rect(hdc, 5, 26, 37, 36,
GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, 1);
+ else
+ Rect(hdc, 5, 26, 37, 36, GetSysColor(COLOR_WINDOWTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, 1);
+ Rect(hdc, 5, 46, 37, 56, GetSysColor(COLOR_APPWORKSPACE),
GetSysColor(COLOR_APPWORKSPACE), 1, 1);
for (i=0; i<5; i++)
{
if (lineWidth==i+1)
Modified: trunk/reactos/base/applications/paint/winproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/paint/wi…
==============================================================================
--- trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/paint/winproc.c [iso-8859-1] Fri Jul 10 22:21:27 2009
@@ -29,6 +29,7 @@
{
ShowWindow(hSelection, SW_HIDE);
activeTool = tool;
+ pointSP = 0; // resets the point-buffer of the polygon and bezier functions
SendMessage(hToolSettings, WM_PAINT, 0, 0);
}
@@ -354,7 +355,7 @@
{
SetCapture(hImageArea);
drawing = TRUE;
- startPainting(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
+ startPaintingL(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
}else
{
SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
@@ -371,7 +372,7 @@
{
SetCapture(hImageArea);
drawing = TRUE;
- startPainting(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, bgColor, fgColor);
+ startPaintingR(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
}else
{
SendMessage(hwnd, WM_RBUTTONUP, wParam, lParam);
@@ -386,7 +387,7 @@
{
ReleaseCapture();
drawing = FALSE;
- endPainting(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
+ endPaintingL(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
SendMessage(hImageArea, WM_PAINT, 0, 0);
if (activeTool==5)
{
@@ -402,7 +403,7 @@
{
ReleaseCapture();
drawing = FALSE;
- endPainting(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, bgColor, fgColor);
+ endPaintingR(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
SendMessage(hImageArea, WM_PAINT, 0, 0);
if (activeTool==5)
{
@@ -426,7 +427,7 @@
{
if ((wParam&MK_LBUTTON)!=0)
{
- whilePainting(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, fgColor, bgColor);
+ whilePaintingL(hDrawingDC, (short)LOWORD(lParam)*1000/zoom,
(short)HIWORD(lParam)*1000/zoom, fgColor, bgColor);
SendMessage(hImageArea, WM_PAINT, 0, 0);
if ((activeTool>=10)||(activeTool==2))
{
@@ -437,7 +438,7 @@
}
if ((wParam&MK_RBUTTON)!=0)
{
- whilePainting(hDrawingDC, LOWORD(lParam)*1000/zoom,
HIWORD(lParam)*1000/zoom, bgColor, fgColor);
+ whilePaintingR(hDrawingDC, (short)LOWORD(lParam)*1000/zoom,
(short)HIWORD(lParam)*1000/zoom, fgColor, bgColor);
SendMessage(hImageArea, WM_PAINT, 0, 0);
if (activeTool>=10)
{
@@ -564,9 +565,9 @@
case IDM_EDITSELECTALL:
if (activeTool==2)
{
- startPainting(hDrawingDC, 0, 0, fgColor, bgColor);
- whilePainting(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
- endPainting(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
+ startPaintingL(hDrawingDC, 0, 0, fgColor, bgColor);
+ whilePaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
+ endPaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
}
break;
case IDM_EDITCOPYTO: