[PAINT] cleanup:

- formatting for enhanced readability
- removal of superfluous variables/assignments
- corrected or added header comment in all files
- change if ... else ... to ?-operator where sensible and readable
- small bugfix in mouse.c concerning rectangle drawing
- fixed some possible string buffer overruns

svn path=/trunk/; revision=43671
This commit is contained in:
Benedikt Freisen 2009-10-21 15:44:31 +00:00
parent 9647ae1f0c
commit f2e66d0408
44 changed files with 1319 additions and 1085 deletions

View file

@ -1,8 +1,8 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: definitions.h
* PURPOSE: Defines the resource ids
* FILE: base/applications/paint/definitions.h
* PURPOSE: Defines the resource ids and other stuff
* PROGRAMMERS: Benedikt Freisen
*/
@ -12,6 +12,7 @@
/* HISTORYSIZE = number of possible undo-steps + 1 */
#define SIZEOF(a) (sizeof(a) / sizeof((a)[0]))
/* sizeof for string constants; equals max. number of characters */
#define IDI_APPICON 500

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: dialogs.c
* FILE: base/applications/paint/dialogs.c
* PURPOSE: Window procedures of the dialog windows plus launching functions
* PROGRAMMERS: Benedikt Freisen
*/
@ -15,7 +15,8 @@
/* FUNCTIONS ********************************************************/
LRESULT CALLBACK MRDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
MRDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
@ -63,12 +64,14 @@ LRESULT CALLBACK MRDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lP
return TRUE;
}
int mirrorRotateDlg()
int
mirrorRotateDlg()
{
return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_MIRRORROTATE), hMainWnd, (DLGPROC)MRDlgWinProc);
return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_MIRRORROTATE), hMainWnd, (DLGPROC) MRDlgWinProc);
}
LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
ATTDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
@ -87,16 +90,16 @@ LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
TCHAR date[100];
TCHAR size[100];
TCHAR temp[100];
GetDateFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, date, sizeof(date));
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, temp, sizeof(temp));
GetDateFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, date, SIZEOF(date));
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &fileTime, NULL, temp, SIZEOF(temp));
_tcscat(date, _T(" "));
_tcscat(date, temp);
LoadString(hProgInstance, IDS_FILESIZE, strrc, sizeof(strrc));
LoadString(hProgInstance, IDS_FILESIZE, strrc, SIZEOF(strrc));
_stprintf(size, strrc, fileSize);
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT6, date);
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT7, size);
}
LoadString(hProgInstance, IDS_PRINTRES, strrc, sizeof(strrc));
LoadString(hProgInstance, IDS_PRINTRES, strrc, SIZEOF(strrc));
_stprintf(res, strrc, fileHPPM, fileVPPM);
SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
return TRUE;
@ -108,7 +111,10 @@ LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hwnd, GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, NULL, FALSE) | (GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, NULL, FALSE)<<16));
EndDialog(hwnd,
GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, NULL,
FALSE) | (GetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, NULL,
FALSE) << 16));
break;
case IDCANCEL:
EndDialog(hwnd, 0);
@ -127,12 +133,14 @@ LRESULT CALLBACK ATTDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
return TRUE;
}
int attributesDlg()
int
attributesDlg()
{
return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_ATTRIBUTES), hMainWnd, (DLGPROC)ATTDlgWinProc);
return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_ATTRIBUTES), hMainWnd, (DLGPROC) ATTDlgWinProc);
}
LRESULT CALLBACK CHSIZEDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
CHSIZEDlgWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
@ -147,7 +155,10 @@ LRESULT CALLBACK CHSIZEDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hwnd, GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, NULL, FALSE) | (GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, NULL, FALSE)<<16));
EndDialog(hwnd,
GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT1, NULL,
FALSE) | (GetDlgItemInt(hwnd, IDD_CHANGESIZEEDIT2, NULL,
FALSE) << 16));
break;
case IDCANCEL:
EndDialog(hwnd, 0);
@ -160,7 +171,8 @@ LRESULT CALLBACK CHSIZEDlgWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
return TRUE;
}
int changeSizeDlg()
int
changeSizeDlg()
{
return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC)CHSIZEDlgWinProc);
return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC) CHSIZEDlgWinProc);
}

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: dialogs.h
* FILE: base/applications/paint/dialogs.h
* PURPOSE: Window procedures of the dialog windows plus launching functions
* PROGRAMMERS: Benedikt Freisen
*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: dib.c
* FILE: base/applications/paint/dib.c
* PURPOSE: Some DIB related functions
* PROGRAMMERS: Benedikt Freisen
*/
@ -12,7 +12,8 @@
/* FUNCTIONS ********************************************************/
HBITMAP CreateDIBWithProperties(int width, int height)
HBITMAP
CreateDIBWithProperties(int width, int height)
{
BITMAPINFO bmi;
ZeroMemory(&bmi, sizeof(BITMAPINFO));
@ -25,21 +26,24 @@ HBITMAP CreateDIBWithProperties(int width, int height)
return CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
}
int GetDIBWidth(HBITMAP hBitmap)
int
GetDIBWidth(HBITMAP hBitmap)
{
BITMAP bm;
GetObject(hBitmap, sizeof(BITMAP), &bm);
return bm.bmWidth;
}
int GetDIBHeight(HBITMAP hBitmap)
int
GetDIBHeight(HBITMAP hBitmap)
{
BITMAP bm;
GetObject(hBitmap, sizeof(BITMAP), &bm);
return bm.bmHeight;
}
void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time, int *size, int hRes, int vRes)
void
SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time, int *size, int hRes, int vRes)
{
BITMAP bm;
HANDLE hFile;
@ -47,7 +51,7 @@ void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time,
BITMAPINFOHEADER bi;
int imgDataSize;
DWORD dwBytesWritten;
char* buffer;
char *buffer;
GetObject(hBitmap, sizeof(BITMAP), &bm);
@ -68,7 +72,7 @@ void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time,
bi.biYPelsPerMeter = vRes;
buffer = HeapAlloc(GetProcessHeap(), 0, imgDataSize);
GetDIBits(hDC, hBitmap, 0, bm.bmHeight, buffer, (LPBITMAPINFO)&bi, DIB_RGB_COLORS);
GetDIBits(hDC, hBitmap, 0, bm.bmHeight, buffer, (LPBITMAPINFO) & bi, DIB_RGB_COLORS);
hFile = CreateFile(FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFile == INVALID_HANDLE_VALUE)
@ -91,7 +95,8 @@ void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time,
HeapFree(GetProcessHeap(), 0, buffer);
}
void LoadDIBFromFile(HBITMAP *hBitmap, LPTSTR name, LPSYSTEMTIME time, int *size, int *hRes, int *vRes)
void
LoadDIBFromFile(HBITMAP * hBitmap, LPTSTR name, LPSYSTEMTIME time, int *size, int *hRes, int *vRes)
{
BITMAPFILEHEADER bfh;
BITMAPINFO *bi;
@ -102,7 +107,8 @@ void LoadDIBFromFile(HBITMAP *hBitmap, LPTSTR name, LPSYSTEMTIME time, int *size
if (!hBitmap)
return;
hFile = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
hFile =
CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return;

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: dib.h
* FILE: base/applications/paint/dib.h
* PURPOSE: Some DIB related functions
* PROGRAMMERS: Benedikt Freisen
*/
@ -12,6 +12,7 @@ int GetDIBWidth(HBITMAP hbm);
int GetDIBHeight(HBITMAP hbm);
void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time, int *size, int hRes, int vRes);
void SaveDIBToFile(HBITMAP hBitmap, LPTSTR FileName, HDC hDC, LPSYSTEMTIME time, int *size, int hRes,
int vRes);
void LoadDIBFromFile(HBITMAP *hBitmap, LPTSTR name, LPSYSTEMTIME time, int *size, int *hRes, int *vRes);

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: drawing.c
* FILE: base/applications/paint/drawing.c
* PURPOSE: The drawing functions used by the tools
* PROGRAMMERS: Benedikt Freisen
*/
@ -12,7 +12,8 @@
/* FUNCTIONS ********************************************************/
void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
void
Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
MoveToEx(hdc, x1, y1, NULL);
@ -20,13 +21,14 @@ void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickn
DeleteObject(SelectObject(hdc, oldPen));
}
void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
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.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
logbrush.lbColor = (style == 2) ? fg : bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
Rectangle(hdc, x1, y1, x2, y2);
@ -34,13 +36,14 @@ void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int t
DeleteObject(SelectObject(hdc, oldPen));
}
void Ellp(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, 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.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
logbrush.lbColor = (style == 2) ? fg : bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
Ellipse(hdc, x1, y1, x2, y2);
@ -48,13 +51,14 @@ void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int t
DeleteObject(SelectObject(hdc, oldPen));
}
void RRect(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, 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.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
logbrush.lbColor = (style == 2) ? fg : bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
RoundRect(hdc, x1, y1, x2, y2, 16, 16);
@ -62,13 +66,14 @@ void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int
DeleteObject(SelectObject(hdc, oldPen));
}
void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed)
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.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
logbrush.lbColor = (style == 2) ? fg : bg;
logbrush.lbHatch = 0;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
if (closed)
@ -79,7 +84,8 @@ void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, i
DeleteObject(SelectObject(hdc, oldPen));
}
void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness)
void
Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness)
{
HPEN oldPen;
POINT fourPoints[4];
@ -92,42 +98,55 @@ void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thic
DeleteObject(SelectObject(hdc, oldPen));
}
void Fill(HDC hdc, int x, int y, int color)
void
Fill(HDC hdc, int x, int y, int color)
{
HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
ExtFloodFill(hdc, x, y, GetPixel(hdc, x, y), FLOODFILLSURFACE);
DeleteObject(SelectObject(hdc, oldBrush));
}
void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius)
void
Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius)
{
short a;
HPEN oldPen;
HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
for (a=0; a<=100; a++)
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);
for(a = 0; a <= 100; a++)
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)
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);
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)
void
Airbrush(HDC hdc, short x, short y, int color, int r)
{
short a;
short b;
for (b=-r; b<=r; b++) for (a=-r; a<=r; a++) if ((a*a+b*b<=r*r)&&(rand()%4==0)) SetPixel(hdc, x+a, y+b, color);
for(b = -r; b <= r; b++)
for(a = -r; a <= r; a++)
if ((a * a + b * b <= r * r) && (rand() % 4 == 0))
SetPixel(hdc, x + a, y + b, color);
}
void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style)
void
Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style)
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
@ -135,12 +154,14 @@ void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style
switch (style)
{
case 0:
for (a=0; a<=100; a++)
Ellipse(hdc, (x1*(100-a)+x2*a)/100-3, (y1*(100-a)+y2*a)/100-3, (x1*(100-a)+x2*a)/100+4, (y1*(100-a)+y2*a)/100+4);
for(a = 0; a <= 100; a++)
Ellipse(hdc, (x1 * (100 - a) + x2 * a) / 100 - 3, (y1 * (100 - a) + y2 * a) / 100 - 3,
(x1 * (100 - a) + x2 * a) / 100 + 4, (y1 * (100 - a) + y2 * a) / 100 + 4);
break;
case 1:
for (a=0; a<=100; a++)
Ellipse(hdc, (x1*(100-a)+x2*a)/100-1, (y1*(100-a)+y2*a)/100-1, (x1*(100-a)+x2*a)/100+3, (y1*(100-a)+y2*a)/100+3);
for(a = 0; a <= 100; a++)
Ellipse(hdc, (x1 * (100 - a) + x2 * a) / 100 - 1, (y1 * (100 - a) + y2 * a) / 100 - 1,
(x1 * (100 - a) + x2 * a) / 100 + 3, (y1 * (100 - a) + y2 * a) / 100 + 3);
break;
case 2:
MoveToEx(hdc, x1, y1, NULL);
@ -148,57 +169,60 @@ void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style
SetPixel(hdc, x2, y2, color);
break;
case 3:
for (a=0; a<=100; a++)
Rectangle(hdc, (x1*(100-a)+x2*a)/100-3, (y1*(100-a)+y2*a)/100-3, (x1*(100-a)+x2*a)/100+5, (y1*(100-a)+y2*a)/100+5);
for(a = 0; a <= 100; a++)
Rectangle(hdc, (x1 * (100 - a) + x2 * a) / 100 - 3, (y1 * (100 - a) + y2 * a) / 100 - 3,
(x1 * (100 - a) + x2 * a) / 100 + 5, (y1 * (100 - a) + y2 * a) / 100 + 5);
break;
case 4:
for (a=0; a<=100; a++)
Rectangle(hdc, (x1*(100-a)+x2*a)/100-2, (y1*(100-a)+y2*a)/100-2, (x1*(100-a)+x2*a)/100+3, (y1*(100-a)+y2*a)/100+3);
for(a = 0; a <= 100; a++)
Rectangle(hdc, (x1 * (100 - a) + x2 * a) / 100 - 2, (y1 * (100 - a) + y2 * a) / 100 - 2,
(x1 * (100 - a) + x2 * a) / 100 + 3, (y1 * (100 - a) + y2 * a) / 100 + 3);
break;
case 5:
for (a=0; a<=100; a++)
Rectangle(hdc, (x1*(100-a)+x2*a)/100-1, (y1*(100-a)+y2*a)/100-1, (x1*(100-a)+x2*a)/100+1, (y1*(100-a)+y2*a)/100+1);
for(a = 0; a <= 100; a++)
Rectangle(hdc, (x1 * (100 - a) + x2 * a) / 100 - 1, (y1 * (100 - a) + y2 * a) / 100 - 1,
(x1 * (100 - a) + x2 * a) / 100 + 1, (y1 * (100 - a) + y2 * a) / 100 + 1);
break;
case 6:
for (a=0; a<=100; a++)
for(a = 0; a <= 100; a++)
{
MoveToEx(hdc, (x1*(100-a)+x2*a)/100-3, (y1*(100-a)+y2*a)/100+5, NULL);
LineTo(hdc, (x1*(100-a)+x2*a)/100+5, (y1*(100-a)+y2*a)/100-3);
MoveToEx(hdc, (x1 * (100 - a) + x2 * a) / 100 - 3, (y1 * (100 - a) + y2 * a) / 100 + 5, NULL);
LineTo(hdc, (x1 * (100 - a) + x2 * a) / 100 + 5, (y1 * (100 - a) + y2 * a) / 100 - 3);
}
break;
case 7:
for (a=0; a<=100; a++)
for(a = 0; a <= 100; a++)
{
MoveToEx(hdc, (x1*(100-a)+x2*a)/100-2, (y1*(100-a)+y2*a)/100+3, NULL);
LineTo(hdc, (x1*(100-a)+x2*a)/100+3, (y1*(100-a)+y2*a)/100-2);
MoveToEx(hdc, (x1 * (100 - a) + x2 * a) / 100 - 2, (y1 * (100 - a) + y2 * a) / 100 + 3, NULL);
LineTo(hdc, (x1 * (100 - a) + x2 * a) / 100 + 3, (y1 * (100 - a) + y2 * a) / 100 - 2);
}
break;
case 8:
for (a=0; a<=100; a++)
for(a = 0; a <= 100; a++)
{
MoveToEx(hdc, (x1*(100-a)+x2*a)/100-1, (y1*(100-a)+y2*a)/100+1, NULL);
LineTo(hdc, (x1*(100-a)+x2*a)/100+1, (y1*(100-a)+y2*a)/100-1);
MoveToEx(hdc, (x1 * (100 - a) + x2 * a) / 100 - 1, (y1 * (100 - a) + y2 * a) / 100 + 1, NULL);
LineTo(hdc, (x1 * (100 - a) + x2 * a) / 100 + 1, (y1 * (100 - a) + y2 * a) / 100 - 1);
}
break;
case 9:
for (a=0; a<=100; a++)
for(a = 0; a <= 100; a++)
{
MoveToEx(hdc, (x1*(100-a)+x2*a)/100-3, (y1*(100-a)+y2*a)/100-3, NULL);
LineTo(hdc, (x1*(100-a)+x2*a)/100+5, (y1*(100-a)+y2*a)/100+5);
MoveToEx(hdc, (x1 * (100 - a) + x2 * a) / 100 - 3, (y1 * (100 - a) + y2 * a) / 100 - 3, NULL);
LineTo(hdc, (x1 * (100 - a) + x2 * a) / 100 + 5, (y1 * (100 - a) + y2 * a) / 100 + 5);
}
break;
case 10:
for (a=0; a<=100; a++)
for(a = 0; a <= 100; a++)
{
MoveToEx(hdc, (x1*(100-a)+x2*a)/100-2, (y1*(100-a)+y2*a)/100-2, NULL);
LineTo(hdc, (x1*(100-a)+x2*a)/100+3, (y1*(100-a)+y2*a)/100+3);
MoveToEx(hdc, (x1 * (100 - a) + x2 * a) / 100 - 2, (y1 * (100 - a) + y2 * a) / 100 - 2, NULL);
LineTo(hdc, (x1 * (100 - a) + x2 * a) / 100 + 3, (y1 * (100 - a) + y2 * a) / 100 + 3);
}
break;
case 11:
for (a=0; a<=100; a++)
for(a = 0; a <= 100; a++)
{
MoveToEx(hdc, (x1*(100-a)+x2*a)/100-1, (y1*(100-a)+y2*a)/100-1, NULL);
LineTo(hdc, (x1*(100-a)+x2*a)/100+1, (y1*(100-a)+y2*a)/100+1);
MoveToEx(hdc, (x1 * (100 - a) + x2 * a) / 100 - 1, (y1 * (100 - a) + y2 * a) / 100 - 1, NULL);
LineTo(hdc, (x1 * (100 - a) + x2 * a) / 100 + 1, (y1 * (100 - a) + y2 * a) / 100 + 1);
}
break;
}
@ -206,7 +230,8 @@ void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style
DeleteObject(SelectObject(hdc, oldPen));
}
void RectSel(HDC hdc, short x1, short y1, short x2, short y2)
void
RectSel(HDC hdc, short x1, short y1, short x2, short y2)
{
HBRUSH oldBrush;
LOGBRUSH logbrush;
@ -220,7 +245,8 @@ void RectSel(HDC hdc, short x1, short y1, short x2, short y2)
DeleteObject(SelectObject(hdc, oldPen));
}
void SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2)
void
SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2)
{
HBRUSH oldBrush;
LOGBRUSH logbrush;
@ -234,14 +260,14 @@ void SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2)
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);
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);
DeleteObject(SelectObject(hdc, oldBrush));
DeleteObject(SelectObject(hdc, oldPen));
}

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: drawing.h
* FILE: base/applications/paint/drawing.h
* PURPOSE: The drawing functions used by the tools
* PROGRAMMERS: Benedikt Freisen
*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: globalvar.h
* FILE: base/applications/paint/globalvar.h
* PURPOSE: Declaring global variables for later initialization
* PROGRAMMERS: Benedikt Freisen
*/
@ -45,13 +45,16 @@ extern HWND hImageArea;
extern HBITMAP hSelBm;
extern int palColors[28];
extern int fgColor;
extern int bgColor;
extern HWND hStatusBar;
extern HWND hScrollbox;
extern HWND hMainWnd;
extern HWND hPalWin;
extern HWND hToolSettings;
extern HWND hTrackbarZoom;
extern CHOOSECOLOR choosecolor;
extern OPENFILENAME ofn;
extern OPENFILENAME sfn;
@ -92,9 +95,7 @@ extern HWND hSizeboxLeftBottom;
extern HWND hSizeboxCenterBottom;
extern HWND hSizeboxRightBottom;
extern HWND hTrackbarZoom;
/* VARIABLES declared in mouse.c *************************************/
/* VARIABLES declared in mouse.c ************************************/
extern POINT pointStack[256];
extern short pointSP;

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: history.c
* FILE: base/applications/paint/history.c
* PURPOSE: Undo and redo functionality
* PROGRAMMERS: Benedikt Freisen
*/
@ -17,9 +17,10 @@
extern void updateCanvasAndScrollbars(void);
void setImgXYRes(int x, int y)
void
setImgXYRes(int x, int y)
{
if ((imgXRes!=x)||(imgYRes!=y))
if ((imgXRes != x) || (imgYRes != y))
{
imgXRes = x;
imgYRes = y;
@ -27,12 +28,14 @@ void setImgXYRes(int x, int y)
}
}
void newReversible()
void
newReversible()
{
DeleteObject(hBms[(currInd+1)%HISTORYSIZE]);
hBms[(currInd+1)%HISTORYSIZE] = CopyImage( hBms[currInd], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
currInd = (currInd+1)%HISTORYSIZE;
if (undoSteps<HISTORYSIZE-1) undoSteps++;
DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
hBms[(currInd + 1) % HISTORYSIZE] = CopyImage(hBms[currInd], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
currInd = (currInd + 1) % HISTORYSIZE;
if (undoSteps < HISTORYSIZE - 1)
undoSteps++;
redoSteps = 0;
SelectObject(hDrawingDC, hBms[currInd]);
imgXRes = GetDIBWidth(hBms[currInd]);
@ -40,69 +43,80 @@ void newReversible()
imageSaved = FALSE;
}
void undo()
void
undo()
{
if (undoSteps>0)
if (undoSteps > 0)
{
ShowWindow(hSelection, SW_HIDE);
currInd = (currInd+HISTORYSIZE-1)%HISTORYSIZE;
currInd = (currInd + HISTORYSIZE - 1) % HISTORYSIZE;
SelectObject(hDrawingDC, hBms[currInd]);
undoSteps--;
if (redoSteps<HISTORYSIZE-1) redoSteps++;
if (redoSteps < HISTORYSIZE - 1)
redoSteps++;
setImgXYRes(GetDIBWidth(hBms[currInd]), GetDIBHeight(hBms[currInd]));
}
}
void redo()
void
redo()
{
if (redoSteps>0)
if (redoSteps > 0)
{
ShowWindow(hSelection, SW_HIDE);
currInd = (currInd+1)%HISTORYSIZE;
currInd = (currInd + 1) % HISTORYSIZE;
SelectObject(hDrawingDC, hBms[currInd]);
redoSteps--;
if (undoSteps<HISTORYSIZE-1) undoSteps++;
if (undoSteps < HISTORYSIZE - 1)
undoSteps++;
setImgXYRes(GetDIBWidth(hBms[currInd]), GetDIBHeight(hBms[currInd]));
}
}
void resetToU1()
void
resetToU1()
{
DeleteObject(hBms[currInd]);
hBms[currInd] = CopyImage( hBms[(currInd+HISTORYSIZE-1)%HISTORYSIZE], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
hBms[currInd] =
CopyImage(hBms[(currInd + HISTORYSIZE - 1) % HISTORYSIZE], IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG);
SelectObject(hDrawingDC, hBms[currInd]);
imgXRes = GetDIBWidth(hBms[currInd]);
imgYRes = GetDIBHeight(hBms[currInd]);
}
void clearHistory()
void
clearHistory()
{
undoSteps = 0;
redoSteps = 0;
}
void insertReversible(HBITMAP hbm)
void
insertReversible(HBITMAP hbm)
{
DeleteObject(hBms[(currInd+1)%HISTORYSIZE]);
hBms[(currInd+1)%HISTORYSIZE] = hbm;
currInd = (currInd+1)%HISTORYSIZE;
if (undoSteps<HISTORYSIZE-1) undoSteps++;
DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
hBms[(currInd + 1) % HISTORYSIZE] = hbm;
currInd = (currInd + 1) % HISTORYSIZE;
if (undoSteps < HISTORYSIZE - 1)
undoSteps++;
redoSteps = 0;
SelectObject(hDrawingDC, hBms[currInd]);
setImgXYRes(GetDIBWidth(hBms[currInd]), GetDIBHeight(hBms[currInd]));
}
void cropReversible(int width, int height, int xOffset, int yOffset)
void
cropReversible(int width, int height, int xOffset, int yOffset)
{
HDC hdc;
HPEN oldPen;
HBRUSH oldBrush;
SelectObject(hDrawingDC, hBms[currInd]);
DeleteObject(hBms[(currInd+1)%HISTORYSIZE]);
hBms[(currInd+1)%HISTORYSIZE] = CreateDIBWithProperties(width, height);
currInd = (currInd+1)%HISTORYSIZE;
if (undoSteps<HISTORYSIZE-1) undoSteps++;
DeleteObject(hBms[(currInd + 1) % HISTORYSIZE]);
hBms[(currInd + 1) % HISTORYSIZE] = CreateDIBWithProperties(width, height);
currInd = (currInd + 1) % HISTORYSIZE;
if (undoSteps < HISTORYSIZE - 1)
undoSteps++;
redoSteps = 0;
hdc = CreateCompatibleDC(hDrawingDC);

View file

@ -1,6 +1,9 @@
/*
* Bulgarian Language resource file
* Translated by:
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/bg-BG.rc
* PURPOSE: Bulgarian Language resource file
* TRANSLATORS: unknown
*/
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
@ -138,9 +141,9 @@ BEGIN
LTEXT "Äàòà íà ôàéëà:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Ôàéëîâ ðàçìåð:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Ðàçäåëèòåëíà:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Íåíàëè÷íî", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Íåíàëè÷íî", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Íåíàëè÷íî", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Íåíàëè÷íî", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Íåíàëè÷íî", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Íåíàëè÷íî", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Åäèíèöè", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Öîëîâå", IDD_ATTRIBUTESRB1, 12, 69, 40, 10, WS_GROUP
AUTORADIOBUTTON "ñì", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/* FILE: ??rospaint??/lang/cs-CZ.rc
* TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com)
* UPDATED: 2009-04-28
/*
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/cs-CZ.rc
* PURPOSE: Czech Language resource file
* TRANSLATORS: Radek Liska aka Black_Fox (radekliska at gmail dot com)
*/
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
@ -137,9 +140,9 @@ BEGIN
LTEXT "Datum zmìny:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Velikost souboru:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Rozlišení:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Jednotka", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Palce", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "Centimetry", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* German Language resource file / Deutsche Sprachresourcendatei
* Program's initial language / anfängliche Programmsprache, Benedikt Freisen
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: base/applications/paint/lang/de-DE.rc
* PURPOSE: German Language resource file (reference language file)
* TRANSLATORS: Benedikt Freisen
*/
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN

View file

@ -1,6 +1,9 @@
/*
* British English language resource file
* Translated by: Benedikt Freisen
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: base/applications/paint/lang/en-GB.rc
* PURPOSE: British English Language resource file
* TRANSLATORS: Benedikt Freisen
*/
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
@ -138,9 +141,9 @@ BEGIN
LTEXT "File date:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "File size:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Resolution:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Unit", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Inch", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* US-English Language resource file
* Translated by: first times touched from en-GB.rc file by Mario Kacmar
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/en-US.rc
* PURPOSE: US-English Language resource file
* TRANSLATORS: first times touched from en-GB.rc file by Mario Kacmar
*/
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@ -138,9 +141,9 @@ BEGIN
LTEXT "File date:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "File size:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Resolution:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Units", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Inches", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Spanish Language resource file
* Traducido por: Gabriel Ilardi febrero 2009
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/es-ES.rc
* PURPOSE: Spanish Language resource file
* TRANSLATORS: Gabriel Ilardi
*/
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
@ -138,9 +141,9 @@ BEGIN
LTEXT "Fecha modificación:", IDD_ATTRIBUTESTEXT3, 10, 5, 80, 10
LTEXT "Espacio en disco:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Resolución:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "No disponible", IDD_ATTRIBUTESTEXT6, 73, 5, 60, 10
LTEXT "No disponible", IDD_ATTRIBUTESTEXT7, 73, 15, 60, 10
LTEXT "No disponible", IDD_ATTRIBUTESTEXT8, 73, 25, 60, 10
LTEXT "No disponible", IDD_ATTRIBUTESTEXT6, 73, 5, 80, 10
LTEXT "No disponible", IDD_ATTRIBUTESTEXT7, 73, 15, 80, 10
LTEXT "No disponible", IDD_ATTRIBUTESTEXT8, 73, 25, 80, 10
GROUPBOX "Unidades ", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Pulgadas", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 60, 69, 35, 10

View file

@ -1,4 +1,10 @@
/* Basque language resource file */
/*
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/eu-ES.rc
* PURPOSE: Basque Language resource file
* TRANSLATORS: unknown
*/
LANGUAGE LANG_BASQUE, SUBLANG_DEFAULT
@ -135,9 +141,9 @@ BEGIN
LTEXT "Azken gordetze-data:", IDD_ATTRIBUTESTEXT3, 10, 5, 80, 10
LTEXT "Diskoko tamaina:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Bereizmena:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Ez dago erabilgarri", IDD_ATTRIBUTESTEXT6, 80, 5, 60, 10
LTEXT "Ez dago erabilgarri", IDD_ATTRIBUTESTEXT7, 80, 15, 60, 10
LTEXT "Ez dago erabilgarri", IDD_ATTRIBUTESTEXT8, 80, 25, 60, 10
LTEXT "Ez dago erabilgarri", IDD_ATTRIBUTESTEXT6, 80, 5, 70, 10
LTEXT "Ez dago erabilgarri", IDD_ATTRIBUTESTEXT7, 80, 15, 70, 10
LTEXT "Ez dago erabilgarri", IDD_ATTRIBUTESTEXT8, 80, 25, 70, 10
GROUPBOX "Unitateak ", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Hazbetea", IDD_ATTRIBUTESRB1, 12, 69, 42, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 60, 69, 30, 10

View file

@ -1,6 +1,9 @@
/*
* FR-French Language resource file
* Translated by:
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/fr-FR.rc
* PURPOSE: FR-French Language resource file
* TRANSLATORS: unknown
*/
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
@ -137,9 +140,9 @@ BEGIN
LTEXT "Dernier enregistrement du fichier :", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Taille sur le disque :", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Résolution :", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Non disponible", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Non disponible", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Non disponible", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Non disponible", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Non disponible", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Non disponible", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Unités", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Pouces", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "Cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Italian Language resource file
* Tradotto da: gabriel ilardi, febbraio 2009
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/it-IT.rc
* PURPOSE: Italian Language resource file
* TRANSLATORS: gabriel ilardi
*/
LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
@ -137,9 +140,9 @@ BEGIN
LTEXT "Ultimo salvataggio:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Dimensioni su disco:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Risoluzione:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Non disponibile", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Non disponibile", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Non disponibile", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Non disponibile", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Non disponibile", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Non disponibile", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Unità di misura", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Pollici", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "Cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Japanese Language resource file
* Translated by: pcds90net, Tomoya Kitagawa
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/ja-JP.rc
* PURPOSE: Japanese Language resource file
* TRANSLATORS: pcds90net, Tomoya Kitagawa
*/
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
@ -138,9 +141,9 @@ BEGIN
LTEXT "ファイルの日付:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "ファイルのサイズ:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "解像度:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "—˜—p•s‰Â”\\", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "—˜—p•s‰Â”\\", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "—˜—p•s‰Â”\\", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "—˜—p•s‰Â”\\", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "—˜—p•s‰Â”\\", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "—˜—p•s‰Â”\\", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "単位", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "インチ", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Dutch Language resource file
* Translated by: Wouter De Vlieger
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/nl-NL.rc
* PURPOSE: Dutch Language resource file
* TRANSLATORS: Wouter De Vlieger
*/
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
@ -137,9 +140,9 @@ BEGIN
LTEXT "Datum laatst gewijzigd:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Bestandsgrootte:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Resolutie:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Niet beschikbaar", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Niet beschikbaar", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Niet beschikbaar", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Niet beschikbaar", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Niet beschikbaar", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Niet beschikbaar", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Eenheden", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Inch", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* NO-Norwegian Language resource file
* Translated by: first times touched from no-NO.rc file by Lars Martin Hambro
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/no-NO.rc
* PURPOSE: NO-Norwegian Language resource file
* TRANSLATORS: first times touched from no-NO.rc file by Lars Martin Hambro
*/
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
@ -137,9 +140,9 @@ BEGIN
LTEXT "Fildato:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Filstørrelse:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Oppløsning:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Ikke tilgjengelig", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Ikke tilgjengelig", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Ikke tilgjengelig", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Ikke tilgjengelig", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Ikke tilgjengelig", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Ikke tilgjengelig", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Enheter", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Tommer", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "Centimeter", IDD_ATTRIBUTESRB2, 52, 69, 55, 10

View file

@ -1,11 +1,11 @@
/*
* translated by Caemyr - Olaf Siejka (May,2009)
* Use ReactOS forum PM or IRC to contact me
* http://www.reactos.org
* IRC: irc.freenode.net #reactos-pl;
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/pl-PL.rc
* PURPOSE: Polish Language resource file
* TRANSLATORS: Caemyr - Olaf Siejka (May,2009), Use ReactOS forum PM or IRC to contact me
*/
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
ID_MENU MENU
@ -140,9 +140,9 @@ BEGIN
LTEXT "Data:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Rozmiar:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "RozdzielczoϾ:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Niedostêpny", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Niedostêpny", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Niedostêpny", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Niedostêpny", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Niedostêpny", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Niedostêpny", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Jednostki", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "Cale", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Portuguese Brazilian Language resource file
* Translated by: Wagner Leandro Bueno Angelo
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/pt-BR.rc
* PURPOSE: Portuguese Brazilian Language resource file
* TRANSLATORS: Wagner Leandro Bueno Angelo
*/
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
@ -137,9 +140,9 @@ BEGIN
LTEXT "Data do arquivo:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Tamanho do arquivo:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Resolução:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Unidades", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "P&olegadas", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "c&m", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Portuguese Language resource file
* Translated by: Manuel D V Silva
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/pt-PT.rc
* PURPOSE: Portuguese Language resource file
* TRANSLATORS: Manuel D V Silva
*/
LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE
@ -137,9 +140,9 @@ BEGIN
LTEXT "Data do arquivo:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Tamanho do arquivo:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Resolução:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "não disponível", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Unidades", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "P&olegadas", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "c&m", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,6 +1,9 @@
/*
* Romanian Language resource file
* Translated by: Petru Dimitriu
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/ro-RO.rc
* PURPOSE: Romanian Language resource file
* TRANSLATORS: Petru Dimitriu
*/
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
@ -140,9 +143,9 @@ BEGIN
LTEXT "Dată:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Mărime:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Rezoluție:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Indisponibil", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Indisponibil", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Indisponibil", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Indisponibil", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Indisponibil", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Indisponibil", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Unitate", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "țoli", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,3 +1,11 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/ru-RU.rc
* PURPOSE: Russian Language resource file
* TRANSLATORS: unknown
*/
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
ID_MENU MENU
@ -132,9 +140,9 @@ BEGIN
LTEXT "Äàòà ñîõðàíåíèÿ:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Ðàçìåð íà äèñêå:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Ðàçðåøåíèå:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "не доступно", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "не доступно", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "не доступно", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "íå äîñòóïíî", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "íå äîñòóïíî", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "íå äîñòóïíî", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Åäèíèöû èçìåðåíèÿ", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "ä&þéìû", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "ñ&ì", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,7 +1,9 @@
/*
* Slovak Language resource file
* Translated by: Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk)
* Last changed: 02-07-2009
* PROJECT: PAINT for ReactOS
* LICENSE: unknown (LGPL assumed)
* FILE: base/applications/paint/lang/sk-SK.rc
* PURPOSE: Slovak Language resource file
* TRANSLATORS: Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk)
*/
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
@ -139,9 +141,9 @@ BEGIN
LTEXT "Dátum zmeny:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 //File date
LTEXT "Ve¾kos<6F> súboru:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 //File size
LTEXT "Rozlíšenie:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Nie je k dispozícii", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Nie je k dispozícii", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Nie je k dispozícii", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Nie je k dispozícii", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Nie je k dispozícii", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Nie je k dispozícii", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Jednotky", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "palce", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,9 +1,9 @@
/*
* PROJECT: Paint for ReactOS
* PROJECT: PAINT for ReactOS
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/devmgmt/lang/uk-UA.rc
* FILE: base/applications/paint/lang/uk-UA.rc
* PURPOSE: Ukraianian Language File for Paint
* TRANSLATOR: Artem Reznikov, Sakara Yevhen
* TRANSLATORS: Artem Reznikov, Sakara Yevhen
*/
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
@ -140,9 +140,9 @@ BEGIN
LTEXT "Äàòà ôàéëà:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Ðîçì³ð ôàéëà:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Ðîçä³ëüíà çäàòí³ñòü:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
LTEXT "Not available", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "Îäèíèö³ âèì³ðþâàííÿ", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "äþéìè", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "ñì", IDD_ATTRIBUTESRB2, 52, 69, 35, 10

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: main.c
* FILE: base/applications/paint/main.c
* PURPOSE: Initializing everything
* PROGRAMMERS: Benedikt Freisen
*/
@ -43,8 +43,6 @@ int undoSteps = 0;
int redoSteps = 0;
BOOL imageSaved = TRUE;
// global status variables
short startX;
short startY;
short lastX;
@ -63,25 +61,23 @@ HWND hSelection;
HWND hImageArea;
HBITMAP hSelBm;
// global declarations and WinMain
// initial palette colors; may be changed by the user during execution
int palColors[28] =
{0x000000, 0x464646, 0x787878, 0x300099, 0x241ced, 0x0078ff, 0x0ec2ff,
/* initial palette colors; may be changed by the user during execution */
int palColors[28] = { 0x000000, 0x464646, 0x787878, 0x300099, 0x241ced, 0x0078ff, 0x0ec2ff,
0x00f2ff, 0x1de6a8, 0x4cb122, 0xefb700, 0xf36d4d, 0x99362f, 0x98316f,
0xffffff, 0xdcdcdc, 0xb4b4b4, 0x3c5a9c, 0xb1a3ff, 0x7aaae5, 0x9ce4f5,
0xbdf9ff, 0xbcf9d3, 0x61bb9d, 0xead999, 0xd19a70, 0x8e6d54, 0xd5a5b5};
// foreground and background colors with initial value
0xbdf9ff, 0xbcf9d3, 0x61bb9d, 0xead999, 0xd19a70, 0x8e6d54, 0xd5a5b5
};
/* foreground and background colors with initial value */
int fgColor = 0x00000000;
int bgColor = 0x00ffffff;
// the current zoom in percent*10
HWND hStatusBar;
HWND hScrollbox;
HWND hMainWnd;
HWND hPalWin;
HWND hToolSettings;
HWND hTrackbarZoom;
CHOOSECOLOR choosecolor;
OPENFILENAME ofn;
OPENFILENAME sfn;
@ -122,17 +118,20 @@ HWND hSizeboxLeftBottom;
HWND hSizeboxCenterBottom;
HWND hSizeboxRightBottom;
HWND hTrackbarZoom;
/* entry point */
int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil)
int WINAPI
_tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument, int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wclScroll;
WNDCLASSEX wincl;
WNDCLASSEX wclPal;
WNDCLASSEX wclSettings;
WNDCLASSEX wclSelection;
TCHAR progtitle[1000];
TCHAR resstr[100];
HMENU menu;
@ -142,6 +141,7 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
HBITMAP tempBm;
int i;
TCHAR tooltips[16][30];
TCHAR *c;
TCHAR sfnFilename[1000];
TCHAR sfnFiletitle[256];
@ -150,9 +150,9 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
TCHAR ofnFiletitle[256];
TCHAR ofnFilter[1000];
TCHAR miniaturetitle[100];
int custColors[16] =
{0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff};
int custColors[16] = { 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff
};
hProgInstance = hThisInstance;
@ -164,10 +164,10 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
wincl.lpszClassName = _T("WindowsApp");
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (hThisInstance, MAKEINTRESOURCE(500));
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.cbSize = sizeof(WNDCLASSEX);
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon(hThisInstance, MAKEINTRESOURCE(500));
wincl.hCursor = LoadCursor(NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
@ -179,10 +179,10 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
wclScroll.lpszClassName = _T("Scrollbox");
wclScroll.lpfnWndProc = WindowProcedure;
wclScroll.style = 0;
wclScroll.cbSize = sizeof (WNDCLASSEX);
wclScroll.cbSize = sizeof(WNDCLASSEX);
wclScroll.hIcon = NULL;
wclScroll.hIconSm = NULL;
wclScroll.hCursor = LoadCursor (NULL, IDC_ARROW);
wclScroll.hCursor = LoadCursor(NULL, IDC_ARROW);
wclScroll.lpszMenuName = NULL;
wclScroll.cbClsExtra = 0;
wclScroll.cbWndExtra = 0;
@ -194,10 +194,10 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
wclPal.lpszClassName = _T("Palette");
wclPal.lpfnWndProc = PalWinProc;
wclPal.style = CS_DBLCLKS;
wclPal.cbSize = sizeof (WNDCLASSEX);
wclPal.cbSize = sizeof(WNDCLASSEX);
wclPal.hIcon = NULL;
wclPal.hIconSm = NULL;
wclPal.hCursor = LoadCursor (NULL, IDC_ARROW);
wclPal.hCursor = LoadCursor(NULL, IDC_ARROW);
wclPal.lpszMenuName = NULL;
wclPal.cbClsExtra = 0;
wclPal.cbWndExtra = 0;
@ -209,10 +209,10 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
wclSettings.lpszClassName = _T("ToolSettings");
wclSettings.lpfnWndProc = SettingsWinProc;
wclSettings.style = CS_DBLCLKS;
wclSettings.cbSize = sizeof (WNDCLASSEX);
wclSettings.cbSize = sizeof(WNDCLASSEX);
wclSettings.hIcon = NULL;
wclSettings.hIconSm = NULL;
wclSettings.hCursor = LoadCursor (NULL, IDC_ARROW);
wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
wclSettings.lpszMenuName = NULL;
wclSettings.cbClsExtra = 0;
wclSettings.cbWndExtra = 0;
@ -224,14 +224,14 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
wclSelection.lpszClassName = _T("Selection");
wclSelection.lpfnWndProc = SelectionWinProc;
wclSelection.style = CS_DBLCLKS;
wclSelection.cbSize = sizeof (WNDCLASSEX);
wclSelection.cbSize = sizeof(WNDCLASSEX);
wclSelection.hIcon = NULL;
wclSelection.hIconSm = NULL;
wclSelection.hCursor = LoadCursor (NULL, IDC_SIZEALL);
wclSelection.hCursor = LoadCursor(NULL, IDC_SIZEALL);
wclSelection.lpszMenuName = NULL;
wclSelection.cbClsExtra = 0;
wclSelection.cbWndExtra = 0;
wclSelection.hbrBackground = NULL;//GetSysColorBrush(COLOR_BTNFACE);
wclSelection.hbrBackground = NULL;
RegisterClassEx (&wclSelection);
/* initializing and registering the window class for the size boxes */
@ -239,10 +239,10 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
wclSettings.lpszClassName = _T("Sizebox");
wclSettings.lpfnWndProc = SizeboxWinProc;
wclSettings.style = CS_DBLCLKS;
wclSettings.cbSize = sizeof (WNDCLASSEX);
wclSettings.cbSize = sizeof(WNDCLASSEX);
wclSettings.hIcon = NULL;
wclSettings.hIconSm = NULL;
wclSettings.hCursor = LoadCursor (NULL, IDC_ARROW);
wclSettings.hCursor = LoadCursor(NULL, IDC_ARROW);
wclSettings.lpszMenuName = NULL;
wclSettings.cbClsExtra = 0;
wclSettings.cbWndExtra = 0;
@ -255,10 +255,15 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
LoadString(hThisInstance, IDS_MINIATURETITLE, miniaturetitle, SIZEOF(miniaturetitle));
/* create main window */
hwnd = CreateWindowEx (0, _T("WindowsApp"), progtitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, hThisInstance, NULL);
hwnd =
CreateWindowEx(0, _T("WindowsApp"), progtitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544,
375, HWND_DESKTOP, NULL, hThisInstance, NULL);
hMainWnd = hwnd;
hwndMiniature = CreateWindowEx(WS_EX_PALETTEWINDOW, _T("WindowsApp"), miniaturetitle, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 180, 200, 120, 100, hwnd, NULL, hThisInstance, NULL);
hwndMiniature =
CreateWindowEx(WS_EX_PALETTEWINDOW, _T("WindowsApp"), miniaturetitle,
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, 180, 200, 120, 100, hwnd,
NULL, hThisInstance, NULL);
/* loading and setting the window menu from resource */
menu = LoadMenu(hThisInstance, MAKEINTRESOURCE(ID_MENU));
@ -266,8 +271,10 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
haccel = LoadAccelerators(hThisInstance, MAKEINTRESOURCE(800));
/* preloading the draw transparent/nontransparent icons for later use */
hNontranspIcon = LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_NONTRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR);
hTranspIcon = LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_TRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR);
hNontranspIcon =
LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_NONTRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR);
hTranspIcon =
LoadImage(hThisInstance, MAKEINTRESOURCE(IDI_TRANSPARENT), IMAGE_ICON, 40, 30, LR_DEFAULTCOLOR);
hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL));
hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR));
@ -275,64 +282,89 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
CreateWindowEx (0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
CreateWindowEx(0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL,
hThisInstance, NULL);
/* creating the 16 bitmap radio buttons and setting the bitmap */
/* FIXME: Unintentionally there is a line above the tool bar. To prevent cropping of the buttons height has been increased from 200 to 205 */
hToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT | CCS_NORESIZE | TBSTYLE_TOOLTIPS, 3, 3, 50, 205, hwnd, NULL, hThisInstance, NULL);
/*
* FIXME: Unintentionally there is a line above the tool bar.
* To prevent cropping of the buttons height has been increased from 200 to 205
*/
hToolbar =
CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT | CCS_NORESIZE | TBSTYLE_TOOLTIPS,
3, 3, 50, 205, hwnd, NULL, hThisInstance, NULL);
hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0);
SendMessage(hToolbar, TB_SETIMAGELIST, 0, (LPARAM)hImageList);
SendMessage(hToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList);
tempBm = LoadImage(hThisInstance, MAKEINTRESOURCE(IDB_TOOLBARICONS), IMAGE_BITMAP, 256, 16, 0);
ImageList_AddMasked(hImageList, tempBm, 0xff00ff);
DeleteObject(tempBm);
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
for (i=0; i<16; i++)
for(i = 0; i < 16; i++)
{
TBBUTTON tbbutton;
int wrapnow = 0;
if (i % 2 == 1) wrapnow = TBSTATE_WRAP;
if (i % 2 == 1)
wrapnow = TBSTATE_WRAP;
LoadString(hThisInstance, IDS_TOOLTIP1 + i, tooltips[i], 30);
ZeroMemory(&tbbutton, sizeof(TBBUTTON));
tbbutton.iString = (INT_PTR)tooltips[i];
tbbutton.iString = (INT_PTR) tooltips[i];
tbbutton.fsStyle = TBSTYLE_CHECKGROUP;
tbbutton.fsState = TBSTATE_ENABLED | wrapnow;
tbbutton.idCommand = ID_FREESEL + i;
tbbutton.iBitmap = i;
SendMessage(hToolbar, TB_ADDBUTTONS, 1, (LPARAM)&tbbutton);
SendMessage(hToolbar, TB_ADDBUTTONS, 1, (LPARAM) &tbbutton);
}
/* SendMessage(hToolbar, TB_SETROWS, MAKEWPARAM(8, FALSE), (LPARAM)NULL); */
SendMessage(hToolbar, TB_CHECKBUTTON, ID_PEN, MAKELONG(TRUE, 0));
SendMessage(hToolbar, TB_SETMAXTEXTROWS, 0, 0);
SendMessage(hToolbar, TB_SETBUTTONSIZE, 0, MAKELONG(25, 25));
/* SendMessage(hToolbar, TB_AUTOSIZE, 0, 0); */
/* creating the tool settings child window */
hToolSettings = CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD | WS_VISIBLE, 7, 210, 42, 140, hwnd, NULL, hThisInstance, NULL);
hTrackbarZoom = CreateWindowEx(0, TRACKBAR_CLASS, _T(""), WS_CHILD | TBS_VERT | TBS_AUTOTICKS, 1, 1, 40, 64, hToolSettings, NULL, hThisInstance, NULL);
SendMessage(hTrackbarZoom, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 6));
SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)3);
hToolSettings =
CreateWindowEx(0, _T("ToolSettings"), _T(""), WS_CHILD | WS_VISIBLE, 7, 210, 42, 140, hwnd, NULL,
hThisInstance, NULL);
hTrackbarZoom =
CreateWindowEx(0, TRACKBAR_CLASS, _T(""), WS_CHILD | TBS_VERT | TBS_AUTOTICKS, 1, 1, 40, 64,
hToolSettings, NULL, hThisInstance, NULL);
SendMessage(hTrackbarZoom, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG(0, 6));
SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 3);
/* creating the palette child window */
hPalWin = CreateWindowEx(0, _T("Palette"), _T(""), WS_CHILD | WS_VISIBLE, 56, 9, 255, 32, hwnd, NULL, hThisInstance, NULL);
hPalWin =
CreateWindowEx(0, _T("Palette"), _T(""), WS_CHILD | WS_VISIBLE, 56, 9, 255, 32, hwnd, NULL,
hThisInstance, NULL);
/* creating the scroll box */
hScrollbox = CreateWindowEx (WS_EX_CLIENTEDGE, _T("Scrollbox"), _T(""), WS_CHILD | WS_GROUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 56, 49, 472, 248, hwnd, NULL, hThisInstance, NULL);
hScrollbox =
CreateWindowEx(WS_EX_CLIENTEDGE, _T("Scrollbox"), _T(""),
WS_CHILD | WS_GROUP | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 56, 49, 472, 248, hwnd,
NULL, hThisInstance, NULL);
/* creating the status bar */
hStatusBar = CreateWindowEx (0, STATUSCLASSNAME, _T(""), SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, NULL, hThisInstance, NULL);
hStatusBar =
CreateWindowEx(0, STATUSCLASSNAME, _T(""), SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd,
NULL, hThisInstance, NULL);
SendMessage(hStatusBar, SB_SETMINHEIGHT, 21, 0);
hScrlClient = CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 500, 500, hScrollbox, NULL, hThisInstance, NULL);
hScrlClient =
CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 500, 500, hScrollbox, NULL,
hThisInstance, NULL);
/* create selection window (initially hidden) */
hSelection = CreateWindowEx(WS_EX_TRANSPARENT, _T("Selection"), _T(""), WS_CHILD | BS_OWNERDRAW, 350, 0, 100, 100, hScrlClient, NULL, hThisInstance, NULL);
hSelection =
CreateWindowEx(WS_EX_TRANSPARENT, _T("Selection"), _T(""), WS_CHILD | BS_OWNERDRAW, 350, 0, 100, 100,
hScrlClient, NULL, hThisInstance, NULL);
/* creating the window inside the scroll box, on which the image in hDrawingDC's bitmap is drawn */
hImageArea = CreateWindowEx (0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient, NULL, hThisInstance, NULL);
hImageArea =
CreateWindowEx(0, _T("Scrollbox"), _T(""), WS_CHILD | WS_VISIBLE, 3, 3, imgXRes, imgYRes, hScrlClient,
NULL, hThisInstance, NULL);
hDrawingDC = CreateCompatibleDC(GetDC(hImageArea));
hSelDC = CreateCompatibleDC(GetDC(hImageArea));
@ -341,19 +373,19 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
hBms[0] = CreateDIBWithProperties(imgXRes, imgYRes);
SelectObject(hDrawingDC, hBms[0]);
Rectangle(hDrawingDC, 0-1, 0-1, imgXRes+1, imgYRes+1);
Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, imgYRes + 1);
if (lpszArgument[0] != 0)
{
HBITMAP bmNew = NULL;
LoadDIBFromFile(&bmNew, lpszArgument, &fileTime, &fileSize, &fileHPPM, &fileVPPM);
if (bmNew!=NULL)
if (bmNew != NULL)
{
TCHAR tempstr[1000];
TCHAR resstr[100];
TCHAR *temp;
insertReversible(bmNew);
GetFullPathName(lpszArgument, sizeof(filepathname), filepathname, &temp);
GetFullPathName(lpszArgument, SIZEOF(filepathname), filepathname, &temp);
_tcscpy(filename, temp);
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
_stprintf(tempstr, resstr, filename);
@ -368,7 +400,7 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
choosecolor.hwndOwner = hwnd;
choosecolor.hInstance = NULL;
choosecolor.rgbResult = 0x00ffffff;
choosecolor.lpCustColors = (COLORREF*)&custColors;
choosecolor.lpCustColors = (COLORREF*) &custColors;
choosecolor.Flags = 0;
choosecolor.lCustData = 0;
choosecolor.lpfnHook = NULL;
@ -377,9 +409,11 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
/* initializing the OPENFILENAME structure for use with GetOpenFileName and GetSaveFileName */
CopyMemory(ofnFilename, filename, sizeof(filename));
LoadString(hThisInstance, IDS_OPENFILTER, ofnFilter, SIZEOF(ofnFilter));
for (c = ofnFilter; *c; c++) if (*c == '\1') *c = '\0';
for(c = ofnFilter; *c; c++)
if (*c == '\1')
*c = '\0';
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.hInstance = hThisInstance;
ofn.lpstrFilter = ofnFilter;
@ -391,9 +425,11 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
CopyMemory(sfnFilename, filename, sizeof(filename));
LoadString(hThisInstance, IDS_SAVEFILTER, sfnFilter, SIZEOF(sfnFilter));
for (c = sfnFilter; *c; c++) if (*c == '\1') *c = '\0';
for(c = sfnFilter; *c; c++)
if (*c == '\1')
*c = '\0';
ZeroMemory(&sfn, sizeof(OPENFILENAME));
sfn.lStructSize = sizeof (OPENFILENAME);
sfn.lStructSize = sizeof(OPENFILENAME);
sfn.hwndOwner = hwnd;
sfn.hInstance = hThisInstance;
sfn.lpstrFilter = sfnFilter;
@ -403,14 +439,32 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
sfn.nMaxFileTitle = SIZEOF(sfnFiletitle);
sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
hSizeboxLeftTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxCenterTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxRightTop = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxLeftCenter = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxRightCenter = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxLeftBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxCenterBottom= CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
hSizeboxRightBottom = CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL, hThisInstance, NULL);
/* creating the size boxes */
hSizeboxLeftTop =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxCenterTop =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxRightTop =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxLeftCenter =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxRightCenter =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxLeftBottom =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxCenterBottom =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
hSizeboxRightBottom =
CreateWindowEx(0, _T("Sizebox"), _T(""), WS_CHILD | WS_VISIBLE, 0, 0, 3, 3, hScrlClient, NULL,
hThisInstance, NULL);
/* placing the size boxes around the image */
SendMessage(hImageArea, WM_SIZE, 0, 0);
/* by moving the window, the things in WM_SIZE are done */
@ -420,7 +474,7 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
ShowWindow (hwnd, nFunsterStil);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
while (GetMessage(&messages, NULL, 0, 0))
{
TranslateAccelerator(hwnd, haccel, &messages);

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: mouse.c
* FILE: base/applications/paint/mouse.c
* PURPOSE: Things which should not be in the mouse event handler itself
* PROGRAMMERS: Benedikt Freisen
*/
@ -15,9 +15,11 @@
/* FUNCTIONS ********************************************************/
void placeSelWin()
void
placeSelWin()
{
MoveWindow(hSelection, rectSel_dest[0]*zoom/1000, rectSel_dest[1]*zoom/1000, rectSel_dest[2]*zoom/1000+6, rectSel_dest[3]*zoom/1000+6, TRUE);
MoveWindow(hSelection, rectSel_dest[0] * zoom / 1000, rectSel_dest[1] * zoom / 1000,
rectSel_dest[2] * zoom / 1000 + 6, rectSel_dest[3] * zoom / 1000 + 6, TRUE);
BringWindowToTop(hSelection);
SendMessage(hImageArea, WM_PAINT, 0, 0);
//SendMessage(hSelection, WM_PAINT, 0, 0);
@ -26,7 +28,8 @@ void placeSelWin()
POINT pointStack[256];
short pointSP;
void startPaintingL(HDC hdc, short x, short y, int fg, int bg)
void
startPaintingL(HDC hdc, short x, short y, int fg, int bg)
{
startX = x;
startY = y;
@ -37,6 +40,7 @@ void startPaintingL(HDC hdc, short x, short y, int fg, int bg)
case 1:
case 10:
case 11:
case 13:
case 15:
case 16:
newReversible();
@ -67,7 +71,7 @@ void startPaintingL(HDC hdc, short x, short y, int fg, int bg)
case 12:
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
if (pointSP==0)
if (pointSP == 0)
{
newReversible();
pointSP++;
@ -76,8 +80,9 @@ void startPaintingL(HDC hdc, short x, short y, int fg, int bg)
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)
if (pointSP + 1 >= 2)
Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE);
if (pointSP == 0)
{
newReversible();
pointSP++;
@ -86,7 +91,8 @@ void startPaintingL(HDC hdc, short x, short y, int fg, int bg)
}
}
void whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
void
whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
@ -99,11 +105,11 @@ void whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
tempY = max(0, min(y, imgYRes));
rectSel_dest[0] = rectSel_src[0] = min(startX, tempX);
rectSel_dest[1] = rectSel_src[1] = min(startY, tempY);
rectSel_dest[2] = rectSel_src[2] = max(startX, tempX)-min(startX, tempX);
rectSel_dest[3] = rectSel_src[3] = max(startY, tempY)-min(startY, tempY);
rectSel_dest[2] = rectSel_src[2] = max(startX, tempX) - min(startX, tempX);
rectSel_dest[3] = rectSel_src[3] = max(startY, tempY) - min(startY, tempY);
RectSel(hdc, startX, startY, tempX, tempY);
}
break;
}
case 3:
Erase(hdc, lastX, lastY, x, y, bg, rubberRadius);
break;
@ -126,9 +132,16 @@ void whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
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;
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:
@ -139,7 +152,8 @@ void whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
resetToU1();
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, fg, bg, lineWidth, shapeStyle, FALSE);
if (pointSP + 1 >= 2)
Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE);
break;
case 15:
resetToU1();
@ -155,16 +169,20 @@ void whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
lastY = y;
}
void endPaintingL(HDC hdc, short x, short y, int fg, int bg)
void
endPaintingL(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
case 2:
resetToU1();
if ((rectSel_src[2]!=0)&&(rectSel_src[3]!=0))
if ((rectSel_src[2] != 0) && (rectSel_src[3] != 0))
{
DeleteObject(SelectObject(hSelDC, hSelBm = (HBITMAP)CreateDIBWithProperties(rectSel_src[2], rectSel_src[3])));
BitBlt(hSelDC, 0, 0, rectSel_src[2], rectSel_src[3], hDrawingDC, rectSel_src[0], rectSel_src[1], SRCCOPY);
DeleteObject(SelectObject
(hSelDC, hSelBm =
(HBITMAP) CreateDIBWithProperties(rectSel_src[2], rectSel_src[3])));
BitBlt(hSelDC, 0, 0, rectSel_src[2], rectSel_src[3], hDrawingDC, rectSel_src[0],
rectSel_src[1], SRCCOPY);
placeSelWin();
ShowWindow(hSelection, SW_SHOW);
}
@ -182,7 +200,8 @@ void endPaintingL(HDC hdc, short x, short y, int fg, int bg)
break;
case 12:
pointSP++;
if (pointSP==4) pointSP = 0;
if (pointSP == 4)
pointSP = 0;
break;
case 13:
resetToU1();
@ -193,9 +212,10 @@ void endPaintingL(HDC hdc, short x, short y, int fg, int bg)
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
pointSP++;
if (pointSP>=2)
if (pointSP >= 2)
{
if ( (pointStack[0].x-x)*(pointStack[0].x-x) + (pointStack[0].y-y)*(pointStack[0].y-y) <= lineWidth*lineWidth+1)
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;
@ -205,7 +225,8 @@ void endPaintingL(HDC hdc, short x, short y, int fg, int bg)
Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, FALSE);
}
}
if (pointSP==255) pointSP--;
if (pointSP == 255)
pointSP--;
break;
case 15:
resetToU1();
@ -218,7 +239,8 @@ 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
startPaintingR(HDC hdc, short x, short y, int fg, int bg)
{
startX = x;
startY = y;
@ -229,6 +251,7 @@ void startPaintingR(HDC hdc, short x, short y, int fg, int bg)
case 1:
case 10:
case 11:
case 13:
case 15:
case 16:
newReversible();
@ -255,7 +278,7 @@ void startPaintingR(HDC hdc, short x, short y, int fg, int bg)
case 12:
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
if (pointSP==0)
if (pointSP == 0)
{
newReversible();
pointSP++;
@ -264,8 +287,9 @@ void startPaintingR(HDC hdc, short x, short y, int fg, int bg)
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)
if (pointSP + 1 >= 2)
Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE);
if (pointSP == 0)
{
newReversible();
pointSP++;
@ -274,7 +298,8 @@ 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
whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
@ -300,9 +325,16 @@ void whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
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;
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:
@ -313,7 +345,8 @@ void whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
resetToU1();
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, bg, fg, lineWidth, shapeStyle, FALSE);
if (pointSP + 1 >= 2)
Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE);
break;
case 15:
resetToU1();
@ -329,7 +362,8 @@ void whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
lastY = y;
}
void endPaintingR(HDC hdc, short x, short y, int fg, int bg)
void
endPaintingR(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
@ -346,7 +380,8 @@ void endPaintingR(HDC hdc, short x, short y, int fg, int bg)
break;
case 12:
pointSP++;
if (pointSP==4) pointSP = 0;
if (pointSP == 4)
pointSP = 0;
break;
case 13:
resetToU1();
@ -357,9 +392,10 @@ void endPaintingR(HDC hdc, short x, short y, int fg, int bg)
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
pointSP++;
if (pointSP>=2)
if (pointSP >= 2)
{
if ( (pointStack[0].x-x)*(pointStack[0].x-x) + (pointStack[0].y-y)*(pointStack[0].y-y) <= lineWidth*lineWidth+1)
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;
@ -369,7 +405,8 @@ void endPaintingR(HDC hdc, short x, short y, int fg, int bg)
Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, FALSE);
}
}
if (pointSP==255) pointSP--;
if (pointSP == 255)
pointSP--;
break;
case 15:
resetToU1();

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: mouse.h
* FILE: base/applications/paint/mouse.h
* PURPOSE: Things which should not be in the mouse event handler itself
* PROGRAMMERS: Benedikt Freisen
*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: palette.c
* FILE: base/applications/paint/palette.c
* PURPOSE: Window procedure of the palette window
* PROGRAMMERS: Benedikt Freisen
*/
@ -13,92 +13,94 @@
/* FUNCTIONS ********************************************************/
LRESULT CALLBACK PalWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
PalWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
{
RECT rc = {0, 0, 31, 32};
RECT rc = { 0, 0, 31, 32 };
HDC hDC = GetDC(hwnd);
HPEN oldPen;
HBRUSH oldBrush;
int i, a, b;
DefWindowProc (hwnd, message, wParam, lParam);
DefWindowProc(hwnd, message, wParam, lParam);
for (b = 2; b < 30; b++)
for (a = 2; a < 29; a++)
for(b = 2; b < 30; b++)
for(a = 2; a < 29; a++)
if ((a + b) % 2 == 1)
SetPixel(hDC, a, b, GetSysColor(COLOR_BTNHILIGHT));
DrawEdge(hDC, &rc, EDGE_RAISED, BF_TOPLEFT);
DrawEdge(hDC, &rc, BDR_SUNKENOUTER, BF_TOPLEFT|BF_BOTTOMRIGHT);
DrawEdge(hDC, &rc, BDR_SUNKENOUTER, BF_TOPLEFT | BF_BOTTOMRIGHT);
SetRect(&rc, 11, 12, 26, 27);
DrawEdge(hDC, &rc, BDR_RAISEDINNER, BF_RECT|BF_MIDDLE);
DrawEdge(hDC, &rc, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
oldPen = SelectObject(hDC, CreatePen(PS_NULL, 0, 0));
oldBrush = SelectObject(hDC, CreateSolidBrush(bgColor));
Rectangle(hDC, rc.left, rc.top + 2, rc.right -1, rc.bottom - 1);
Rectangle(hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1);
DeleteObject(SelectObject(hDC, oldBrush));
SetRect(&rc, 4, 5, 19, 20);
DrawEdge(hDC, &rc, BDR_RAISEDINNER, BF_RECT|BF_MIDDLE);
DrawEdge(hDC, &rc, BDR_RAISEDINNER, BF_RECT | BF_MIDDLE);
oldBrush = SelectObject(hDC, CreateSolidBrush(fgColor));
Rectangle( hDC, rc.left + 2,rc.top + 2, rc.right - 1, rc.bottom - 1);
Rectangle(hDC, rc.left + 2, rc.top + 2, rc.right - 1, rc.bottom - 1);
DeleteObject(SelectObject(hDC, oldBrush));
DeleteObject(SelectObject(hDC, oldPen));
for (i=0; i<28; i++)
for(i = 0; i < 28; i++)
{
SetRect(&rc, 31 + (i % 14) * 16,
0 + (i / 14) * 16,
16 + 31 + (i % 14) * 16,
16 + 0 + (i / 14) * 16);
0 + (i / 14) * 16, 16 + 31 + (i % 14) * 16, 16 + 0 + (i / 14) * 16);
DrawEdge(hDC, &rc, EDGE_RAISED, BF_TOPLEFT);
DrawEdge(hDC, &rc, BDR_SUNKENOUTER, BF_RECT);
oldPen = SelectObject(hDC, CreatePen(PS_NULL, 0, 0));
oldBrush = SelectObject(hDC, CreateSolidBrush(palColors[i]));
Rectangle(hDC, rc.left + 2,rc.top + 2,rc.right - 1, rc.bottom - 1);
Rectangle(hDC, rc.left + 2, rc.top + 2, rc.right - 1, rc.bottom - 1);
DeleteObject(SelectObject(hDC, oldBrush));
DeleteObject(SelectObject(hDC, oldPen));
}
ReleaseDC(hwnd, hDC);
}
break;
}
case WM_LBUTTONDOWN:
if (LOWORD(lParam)>=31)
if (LOWORD(lParam) >= 31)
{
fgColor = palColors[(LOWORD(lParam)-31)/16+(HIWORD(lParam)/16)*14];
fgColor = palColors[(LOWORD(lParam) - 31) / 16 + (HIWORD(lParam) / 16) * 14];
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case WM_RBUTTONDOWN:
if (LOWORD(lParam)>=31)
if (LOWORD(lParam) >= 31)
{
bgColor = palColors[(LOWORD(lParam)-31)/16+(HIWORD(lParam)/16)*14];
bgColor = palColors[(LOWORD(lParam) - 31) / 16 + (HIWORD(lParam) / 16) * 14];
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case WM_LBUTTONDBLCLK:
if (LOWORD(lParam)>=31) if (ChooseColor(&choosecolor))
if (LOWORD(lParam) >= 31)
if (ChooseColor(&choosecolor))
{
palColors[(LOWORD(lParam)-31)/16+(HIWORD(lParam)/16)*14] = choosecolor.rgbResult;
palColors[(LOWORD(lParam) - 31) / 16 + (HIWORD(lParam) / 16) * 14] =
choosecolor.rgbResult;
fgColor = choosecolor.rgbResult;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case WM_RBUTTONDBLCLK:
if (LOWORD(lParam)>=31) if (ChooseColor(&choosecolor))
if (LOWORD(lParam) >= 31)
if (ChooseColor(&choosecolor))
{
palColors[(LOWORD(lParam)-31)/16+(HIWORD(lParam)/16)*14] = choosecolor.rgbResult;
palColors[(LOWORD(lParam) - 31) / 16 + (HIWORD(lParam) / 16) * 14] =
choosecolor.rgbResult;
bgColor = choosecolor.rgbResult;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: palette.h
* FILE: base/applications/paint/palette.h
* PURPOSE: Window procedure of the palette window
* PROGRAMMERS: Benedikt Freisen
*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: registry.c
* FILE: base/applications/paint/registry.c
* PURPOSE: Offering functions dealing with registry values
* PROGRAMMERS: Benedikt Freisen
*/
@ -13,7 +13,8 @@
/* FUNCTIONS ********************************************************/
void SetWallpaper(TCHAR *FileName, DWORD dwStyle, DWORD dwTile) //FIXME: The pattern (tiled/stretched) is not set
void
SetWallpaper(TCHAR * FileName, DWORD dwStyle, DWORD dwTile) //FIXME: The pattern (tiled/stretched) is not set
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) FileName, SPIF_UPDATEINIFILE);
@ -24,16 +25,18 @@ void SetWallpaper(TCHAR *FileName, DWORD dwStyle, DWORD dwTile) //FIXME: The pat
return;
if (RegOpenKeyEx(HKEY_CURRENT_USER,
_T("Control Panel\\Desktop"), 0,
KEY_READ | KEY_SET_VALUE, &hDesktop) == ERROR_SUCCESS)
_T("Control Panel\\Desktop"), 0, KEY_READ | KEY_SET_VALUE, &hDesktop) == ERROR_SUCCESS)
{
RegSetValueEx(hDesktop, _T("Wallpaper"), 0, REG_SZ, (LPBYTE) FileName, _tcslen(FileName) * sizeof(TCHAR));
RegSetValueEx(hDesktop, _T("Wallpaper"), 0, REG_SZ, (LPBYTE) FileName,
_tcslen(FileName) * sizeof(TCHAR));
_stprintf(szStyle, _T("%i"), dwStyle);
_stprintf(szTile, _T("%i"), dwTile);
RegSetValueEx(hDesktop, _T("WallpaperStyle"), 0, REG_SZ, (LPBYTE) szStyle, _tcslen(szStyle) * sizeof(TCHAR));
RegSetValueEx(hDesktop, _T("TileWallpaper"), 0, REG_SZ, (LPBYTE) szTile, _tcslen(szTile) * sizeof(TCHAR));
RegSetValueEx(hDesktop, _T("WallpaperStyle"), 0, REG_SZ, (LPBYTE) szStyle,
_tcslen(szStyle) * sizeof(TCHAR));
RegSetValueEx(hDesktop, _T("TileWallpaper"), 0, REG_SZ, (LPBYTE) szTile,
_tcslen(szTile) * sizeof(TCHAR));
RegCloseKey(hDesktop);
}*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: registry.h
* FILE: base/applications/paint/registry.h
* PURPOSE: Offering functions dealing with registry values
* PROGRAMMERS: Benedikt Freisen
*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: rsrc.rc
* FILE: base/applications/paint/rsrc.rc
* PURPOSE: Managing the resources
* PROGRAMMERS: Benedikt Freisen
*/

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: selection.c
* FILE: base/applications/paint/selection.c
* PURPOSE: Window procedure of the selection window
* PROGRAMMERS: Benedikt Freisen
*/
@ -20,7 +20,8 @@ BOOL moving = FALSE;
short xPos;
short yPos;
LRESULT CALLBACK SelectionWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
SelectionWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
@ -29,12 +30,13 @@ LRESULT CALLBACK SelectionWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
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);
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);
@ -45,15 +47,19 @@ LRESULT CALLBACK SelectionWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
if (moving)
{
resetToU1();
rectSel_dest[0]+=(short)LOWORD(lParam)-xPos;
rectSel_dest[1]+=(short)HIWORD(lParam)-yPos;
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);
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);
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);
@ -71,7 +77,7 @@ LRESULT CALLBACK SelectionWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARA
}
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;

View file

@ -1,9 +1,9 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: selection.h
* FILE: base/applications/paint/selection.h
* PURPOSE: Window procedure of the selection window
* PROGRAMMERS: Benedikt Freisen
*/
LRESULT CALLBACK SelectionWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK SelectionWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

View file

@ -20,21 +20,20 @@ BOOL resizing = FALSE;
short xOrig;
short yOrig;
LRESULT CALLBACK SizeboxWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
SizeboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_SETCURSOR:
{
if ((hwnd==hSizeboxLeftTop)||(hwnd==hSizeboxRightBottom))
if ((hwnd == hSizeboxLeftTop) || (hwnd == hSizeboxRightBottom))
SetCursor(LoadCursor(NULL, IDC_SIZENWSE));
if ((hwnd==hSizeboxLeftBottom)||(hwnd==hSizeboxRightTop))
if ((hwnd == hSizeboxLeftBottom) || (hwnd == hSizeboxRightTop))
SetCursor(LoadCursor(NULL, IDC_SIZENESW));
if ((hwnd==hSizeboxLeftCenter)||(hwnd==hSizeboxRightCenter))
if ((hwnd == hSizeboxLeftCenter) || (hwnd == hSizeboxRightCenter))
SetCursor(LoadCursor(NULL, IDC_SIZEWE));
if ((hwnd==hSizeboxCenterTop)||(hwnd==hSizeboxCenterBottom))
if ((hwnd == hSizeboxCenterTop) || (hwnd == hSizeboxCenterBottom))
SetCursor(LoadCursor(NULL, IDC_SIZENS));
}
break;
case WM_LBUTTONDOWN:
resizing = TRUE;
@ -48,25 +47,25 @@ LRESULT CALLBACK SizeboxWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
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);
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:
@ -76,30 +75,30 @@ LRESULT CALLBACK SizeboxWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
short yRel;
ReleaseCapture();
resizing = FALSE;
xRel = ((short)LOWORD(lParam)-xOrig)*1000/zoom;
yRel = ((short)HIWORD(lParam)-yOrig)*1000/zoom;
if (hwnd==hSizeboxLeftTop)
cropReversible(imgXRes-xRel, imgYRes-yRel, xRel, yRel);
if (hwnd==hSizeboxCenterTop)
cropReversible(imgXRes, imgYRes-yRel, 0, yRel);
if (hwnd==hSizeboxRightTop)
cropReversible(imgXRes+xRel, imgYRes-yRel, 0, yRel);
if (hwnd==hSizeboxLeftCenter)
cropReversible(imgXRes-xRel, imgYRes, xRel, 0);
if (hwnd==hSizeboxRightCenter)
cropReversible(imgXRes+xRel, imgYRes, 0, 0);
if (hwnd==hSizeboxLeftBottom)
cropReversible(imgXRes-xRel, imgYRes+yRel, xRel, 0);
if (hwnd==hSizeboxCenterBottom)
cropReversible(imgXRes, imgYRes+yRel, 0, 0);
if (hwnd==hSizeboxRightBottom)
cropReversible(imgXRes+xRel, imgYRes+yRel, 0, 0);
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)_T(""));
xRel = ((short)LOWORD(lParam) - xOrig) * 1000 / zoom;
yRel = ((short)HIWORD(lParam) - yOrig) * 1000 / zoom;
if (hwnd == hSizeboxLeftTop)
cropReversible(imgXRes - xRel, imgYRes - yRel, xRel, yRel);
if (hwnd == hSizeboxCenterTop)
cropReversible(imgXRes, imgYRes - yRel, 0, yRel);
if (hwnd == hSizeboxRightTop)
cropReversible(imgXRes + xRel, imgYRes - yRel, 0, yRel);
if (hwnd == hSizeboxLeftCenter)
cropReversible(imgXRes - xRel, imgYRes, xRel, 0);
if (hwnd == hSizeboxRightCenter)
cropReversible(imgXRes + xRel, imgYRes, 0, 0);
if (hwnd == hSizeboxLeftBottom)
cropReversible(imgXRes - xRel, imgYRes + yRel, xRel, 0);
if (hwnd == hSizeboxCenterBottom)
cropReversible(imgXRes, imgYRes + yRel, 0, 0);
if (hwnd == hSizeboxRightBottom)
cropReversible(imgXRes + xRel, imgYRes + yRel, 0, 0);
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) _T(""));
}
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;

View file

@ -1,9 +1,9 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: sizebox.h
* FILE: base/applications/paint/sizebox.h
* PURPOSE: Window procedure of the size boxes
* PROGRAMMERS: Benedikt Freisen
*/
LRESULT CALLBACK SizeboxWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK SizeboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: toolsettings.c
* FILE: base/applications/paint/toolsettings.c
* PURPOSE: Window procedure of the tool settings window
* PROGRAMMERS: Benedikt Freisen
*/
@ -16,31 +16,26 @@
/* FUNCTIONS ********************************************************/
LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
extern void zoomTo(int, int, int);
LRESULT CALLBACK
SettingsWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_VSCROLL:
{
zoomTo(125<<SendMessage(hTrackbarZoom, TBM_GETPOS, 0, 0), 0, 0);
}
zoomTo(125 << SendMessage(hTrackbarZoom, TBM_GETPOS, 0, 0), 0, 0);
break;
case WM_PAINT:
{
HDC hdc = GetDC(hwnd);
int rectang[4] = {0, 0, 42, 66};
int rectang2[4] = {0, 70, 42, 136};
RECT rect1 = { 0, 0, 42, 66 };
RECT rect2 = { 0, 70, 42, 136 };
DefWindowProc (hwnd, message, wParam, lParam);
DefWindowProc(hwnd, message, wParam, lParam);
if (activeTool!=6)
DrawEdge(hdc, (LPRECT)&rectang, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
else
DrawEdge(hdc, (LPRECT)&rectang, BDR_SUNKENOUTER, BF_RECT);
if (activeTool>=13)
DrawEdge(hdc, (LPRECT)&rectang2, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
else
DrawEdge(hdc, (LPRECT)&rectang2, 0, BF_RECT | BF_MIDDLE);
DrawEdge(hdc, &rect1, BDR_SUNKENOUTER, (activeTool == 6) ? BF_RECT : BF_RECT | BF_MIDDLE);
DrawEdge(hdc, &rect2, (activeTool >= 13) ? BDR_SUNKENOUTER : 0, BF_RECT | BF_MIDDLE);
switch (activeTool)
{
case 1:
@ -49,43 +44,44 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
Rectangle(hdc, 2, transpBg*31+2, 41, transpBg*31+33);
Rectangle(hdc, 2, transpBg * 31 + 2, 41, transpBg * 31 + 33);
DeleteObject(SelectObject(hdc, oldPen));
DrawIconEx(hdc, 1, 2, hNontranspIcon, 40, 30, 0, NULL, DI_NORMAL);
DrawIconEx(hdc, 1, 33, hTranspIcon, 40, 30, 0, NULL, DI_NORMAL);
}
break;
}
case 3:
{
int i;
HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
for (i=0; i<4; i++)
for(i = 0; i < 4; i++)
{
if (rubberRadius==i+2)
if (rubberRadius == i + 2)
{
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
Rectangle(hdc, 14, i*15+2, 29, i*15+17);
Rectangle(hdc, 14, i * 15 + 2, 29, i * 15 + 17);
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
} else SelectObject(hdc, GetSysColorBrush(COLOR_WINDOWTEXT));
Rectangle(hdc, 19-i, i*14+7, 24+i, i*16+12);
}
else
SelectObject(hdc, GetSysColorBrush(COLOR_WINDOWTEXT));
Rectangle(hdc, 19 - i, i * 14 + 7, 24 + i, i * 16 + 12);
}
DeleteObject(SelectObject(hdc, oldPen));
}
break;
}
case 8:
{
int i;
HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
Rectangle(hdc, brushStyle%3*13+2, brushStyle/3*15+2, brushStyle%3*13+15, brushStyle/3*15+17);
Rectangle(hdc, brushStyle % 3 * 13 + 2, brushStyle / 3 * 15 + 2, brushStyle % 3 * 13 + 15,
brushStyle / 3 * 15 + 17);
DeleteObject(SelectObject(hdc, oldPen));
for (i=0; i<12; i++)
if (i==brushStyle)
Brush(hdc, i%3*13+7, i/3*15+8, i%3*13+7, i/3*15+8, GetSysColor(COLOR_HIGHLIGHTTEXT), i);
else
Brush(hdc, i%3*13+7, i/3*15+8, i%3*13+7, i/3*15+8, GetSysColor(COLOR_WINDOWTEXT), i);
}
for(i = 0; i < 12; i++)
Brush(hdc, i % 3 * 13 + 7, i / 3 * 15 + 8, i % 3 * 13 + 7, i / 3 * 15 + 8,
GetSysColor((i == brushStyle) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT), i);
break;
}
case 9:
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
@ -105,43 +101,37 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
Rectangle(hdc, 15, 30, 41, 61);
break;
}
if (airBrushWidth==5)
Airbrush(hdc, 10, 15, GetSysColor(COLOR_HIGHLIGHTTEXT), 5);
else
Airbrush(hdc, 10, 15, GetSysColor(COLOR_WINDOWTEXT), 5);
if (airBrushWidth==8)
Airbrush(hdc, 30, 15, GetSysColor(COLOR_HIGHLIGHTTEXT), 8);
else
Airbrush(hdc, 30, 15, GetSysColor(COLOR_WINDOWTEXT), 8);
if (airBrushWidth==3)
Airbrush(hdc, 8, 45, GetSysColor(COLOR_HIGHLIGHTTEXT), 3);
else
Airbrush(hdc, 8, 45, GetSysColor(COLOR_WINDOWTEXT), 3);
if (airBrushWidth==12)
Airbrush(hdc, 27, 45, GetSysColor(COLOR_HIGHLIGHTTEXT), 12);
else
Airbrush(hdc, 27, 45, GetSysColor(COLOR_WINDOWTEXT), 12);
Airbrush(hdc, 10, 15,
GetSysColor((airBrushWidth == 5) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT), 5);
Airbrush(hdc, 30, 15,
GetSysColor((airBrushWidth == 8) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT), 8);
Airbrush(hdc, 8, 45,
GetSysColor((airBrushWidth == 3) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT), 3);
Airbrush(hdc, 27, 45,
GetSysColor((airBrushWidth == 12) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT), 12);
DeleteObject(SelectObject(hdc, oldPen));
}
break;
}
case 11:
case 12:
{
int i;
HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
for (i=0; i<5; i++)
for(i = 0; i < 5; i++)
{
if (lineWidth==i+1)
if (lineWidth == i + 1)
{
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
Rectangle(hdc, 2, i*12+2, 41, i*12+14);
Rectangle(hdc, 2, i * 12 + 2, 41, i * 12 + 14);
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
} else SelectObject(hdc, GetSysColorBrush(COLOR_WINDOWTEXT));
Rectangle(hdc, 5, i*12+6, 38, i*12+8+i);
}
else
SelectObject(hdc, GetSysColorBrush(COLOR_WINDOWTEXT));
Rectangle(hdc, 5, i * 12 + 6, 38, i * 12 + 8 + i);
}
DeleteObject(SelectObject(hdc, oldPen));
}
break;
}
case 13:
case 14:
case 15:
@ -149,40 +139,41 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
int i;
HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
for (i=0; i<3; i++)
for(i = 0; i < 3; i++)
{
if (shapeStyle==i)
if (shapeStyle == i)
{
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
Rectangle(hdc, 2, i*20+2, 41, i*20+22);
Rectangle(hdc, 2, i * 20 + 2, 41, i * 20 + 22);
}
}
if (shapeStyle==0)
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, 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++)
Rect(hdc, 5, 6, 37, 16,
GetSysColor((shapeStyle == 0) ? COLOR_HIGHLIGHTTEXT : COLOR_WINDOWTEXT),
GetSysColor(COLOR_APPWORKSPACE), 1, 0);
Rect(hdc, 5, 26, 37, 36,
GetSysColor((shapeStyle == 1) ? COLOR_HIGHLIGHTTEXT : 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)
if (lineWidth == i + 1)
{
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
Rectangle(hdc, 2, i*12+72, 41, i*12+84);
Rectangle(hdc, 2, i * 12 + 72, 41, i * 12 + 84);
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
} else SelectObject(hdc, GetSysColorBrush(COLOR_WINDOWTEXT));
Rectangle(hdc, 5, i*12+76, 38, i*12+78+i);
}
else
SelectObject(hdc, GetSysColorBrush(COLOR_WINDOWTEXT));
Rectangle(hdc, 5, i * 12 + 76, 38, i * 12 + 78 + i);
}
DeleteObject(SelectObject(hdc, oldPen));
}
break;
}
}
ReleaseDC(hwnd, hdc);
}
break;
}
case WM_LBUTTONDOWN:
{
switch (activeTool)
@ -190,44 +181,52 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case 1:
case 2:
case 10:
if ((HIWORD(lParam)>1)&&(HIWORD(lParam)<64))
if ((HIWORD(lParam) > 1) && (HIWORD(lParam) < 64))
{
transpBg = (HIWORD(lParam)-2)/31;
transpBg = (HIWORD(lParam) - 2) / 31;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case 3:
if ((HIWORD(lParam)>1)&&(HIWORD(lParam)<62))
if ((HIWORD(lParam) > 1) && (HIWORD(lParam) < 62))
{
rubberRadius = (HIWORD(lParam)-2)/15+2;
rubberRadius = (HIWORD(lParam) - 2) / 15 + 2;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case 8:
if ((LOWORD(lParam)>1)&&(LOWORD(lParam)<40)&&(HIWORD(lParam)>1)&&(HIWORD(lParam)<62))
if ((LOWORD(lParam) > 1) && (LOWORD(lParam) < 40) && (HIWORD(lParam) > 1)
&& (HIWORD(lParam) < 62))
{
brushStyle = (HIWORD(lParam)-2)/15*3+(LOWORD(lParam)-2)/13;
brushStyle = (HIWORD(lParam) - 2) / 15 * 3 + (LOWORD(lParam) - 2) / 13;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case 9:
if (HIWORD(lParam)<62)
if (HIWORD(lParam) < 62)
{
if (HIWORD(lParam)<30)
if (HIWORD(lParam) < 30)
{
if (LOWORD(lParam)<20) airBrushWidth=5; else airBrushWidth=8;
}else
if (LOWORD(lParam) < 20)
airBrushWidth = 5;
else
airBrushWidth = 8;
}
else
{
if (LOWORD(lParam)<15) airBrushWidth=3; else airBrushWidth=12;
if (LOWORD(lParam) < 15)
airBrushWidth = 3;
else
airBrushWidth = 12;
}
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
case 11:
case 12:
if (HIWORD(lParam)<=62)
if (HIWORD(lParam) <= 62)
{
lineWidth = (HIWORD(lParam)-2)/12+1;
lineWidth = (HIWORD(lParam) - 2) / 12 + 1;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
@ -235,25 +234,24 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case 14:
case 15:
case 16:
if (HIWORD(lParam)<=60)
if (HIWORD(lParam) <= 60)
{
shapeStyle = (HIWORD(lParam)-2)/20;
shapeStyle = (HIWORD(lParam) - 2) / 20;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
if ((HIWORD(lParam)>=70)&&(HIWORD(lParam)<=132))
if ((HIWORD(lParam) >= 70) && (HIWORD(lParam) <= 132))
{
lineWidth = (HIWORD(lParam)-72)/12+1;
lineWidth = (HIWORD(lParam) - 72) / 12 + 1;
SendMessage(hwnd, WM_PAINT, 0, 0);
}
break;
}
}
break;
}
default:
return DefWindowProc (hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}

View file

@ -1,9 +1,9 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: toolsettings.h
* FILE: base/applications/paint/toolsettings.h
* PURPOSE: Window procedure of the tool settings window
* PROGRAMMERS: Benedikt Freisen
*/
LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK SettingsWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

View file

@ -1,7 +1,7 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: winproc.c
* FILE: base/applications/paint/winproc.c
* PURPOSE: Window procedure of the main window and all children apart from
* hPalWin, hToolSettings and hSelection
* PROGRAMMERS: Benedikt Freisen
@ -25,22 +25,21 @@
/* FUNCTIONS ********************************************************/
void selectTool(int tool)
void
selectTool(int tool)
{
ShowWindow(hSelection, SW_HIDE);
activeTool = tool;
pointSP = 0; // resets the point-buffer of the polygon and bezier functions
SendMessage(hToolSettings, WM_PAINT, 0, 0);
if (tool==6)
ShowWindow(hTrackbarZoom, SW_SHOW);
else
ShowWindow(hTrackbarZoom, SW_HIDE);
ShowWindow(hTrackbarZoom, (tool == 6) ? SW_SHOW : SW_HIDE);
}
void updateCanvasAndScrollbars()
void
updateCanvasAndScrollbars()
{
ShowWindow(hSelection, SW_HIDE);
MoveWindow(hImageArea, 3, 3, imgXRes*zoom/1000, imgYRes*zoom/1000, FALSE);
MoveWindow(hImageArea, 3, 3, imgXRes * zoom / 1000, imgYRes * zoom / 1000, FALSE);
InvalidateRect(hScrollbox, NULL, TRUE);
InvalidateRect(hImageArea, NULL, FALSE);
@ -48,7 +47,8 @@ void updateCanvasAndScrollbars()
SetScrollPos(hScrollbox, SB_VERT, 0, TRUE);
}
void zoomTo(int newZoom, int mouseX, int mouseY)
void
zoomTo(int newZoom, int mouseX, int mouseY)
{
int tbPos = 0;
int tempZoom = newZoom;
@ -56,8 +56,8 @@ void zoomTo(int newZoom, int mouseX, int mouseY)
long clientRectScrollbox[4];
long clientRectImageArea[4];
int x, y, w, h;
GetClientRect(hScrollbox, (LPRECT)&clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT)&clientRectImageArea);
GetClientRect(hScrollbox, (LPRECT) &clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT) &clientRectImageArea);
w = clientRectImageArea[2] * clientRectScrollbox[2] / (clientRectImageArea[2] * newZoom / zoom);
h = clientRectImageArea[3] * clientRectScrollbox[3] / (clientRectImageArea[3] * newZoom / zoom);
x = max(0, min(clientRectImageArea[2] - w, mouseX - w / 2)) * newZoom / zoom;
@ -66,22 +66,23 @@ void zoomTo(int newZoom, int mouseX, int mouseY)
zoom = newZoom;
ShowWindow(hSelection, SW_HIDE);
MoveWindow(hImageArea, 3, 3, imgXRes*zoom/1000, imgYRes*zoom/1000, FALSE);
MoveWindow(hImageArea, 3, 3, imgXRes * zoom / 1000, imgYRes * zoom / 1000, FALSE);
InvalidateRect(hScrollbox, NULL, TRUE);
InvalidateRect(hImageArea, NULL, FALSE);
SendMessage(hScrollbox, WM_HSCROLL, SB_THUMBPOSITION | (x << 16), 0);
SendMessage(hScrollbox, WM_VSCROLL, SB_THUMBPOSITION | (y << 16), 0);
while (tempZoom>125)
while (tempZoom > 125)
{
tbPos++;
tempZoom = tempZoom>>1;
tempZoom = tempZoom >> 1;
}
SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)tbPos);
SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) tbPos);
}
void drawZoomFrame(int mouseX, int mouseY)
void
drawZoomFrame(int mouseX, int mouseY)
{
HDC hdc;
HPEN oldPen;
@ -92,8 +93,8 @@ void drawZoomFrame(int mouseX, int mouseY)
long clientRectScrollbox[4];
long clientRectImageArea[4];
int x, y, w, h;
GetClientRect(hScrollbox, (LPRECT)&clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT)&clientRectImageArea);
GetClientRect(hScrollbox, (LPRECT) &clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT) &clientRectImageArea);
w = clientRectImageArea[2] * clientRectScrollbox[2] / (clientRectImageArea[2] * 2);
h = clientRectImageArea[3] * clientRectScrollbox[3] / (clientRectImageArea[3] * 2);
x = max(0, min(clientRectImageArea[2] - w, mouseX - w / 2));
@ -111,18 +112,19 @@ void drawZoomFrame(int mouseX, int mouseY)
ReleaseDC(hImageArea, hdc);
}
HDC hdc;
BOOL drawing;
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK
WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
PostQuitMessage(0); /* send a WM_QUIT to the message queue */
break;
case WM_CLOSE:
if (hwnd==hwndMiniature)
if (hwnd == hwndMiniature)
{
ShowWindow(hwndMiniature, SW_HIDE);
showMiniature = FALSE;
@ -152,29 +154,36 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
DestroyWindow(hwnd);
}
break;
case WM_INITMENUPOPUP:
switch (lParam)
{
case 0:
if (isAFile)
{
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE, MF_ENABLED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED, MF_ENABLED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERSTRETCHED, MF_ENABLED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE,
MF_ENABLED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED,
MF_ENABLED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERSTRETCHED,
MF_ENABLED | MF_BYCOMMAND);
}
else
{
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE, MF_GRAYED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED, MF_GRAYED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERSTRETCHED, MF_GRAYED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE,
MF_GRAYED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED,
MF_GRAYED | MF_BYCOMMAND);
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERSTRETCHED,
MF_GRAYED | MF_BYCOMMAND);
}
break;
case 1:
if (undoSteps>0)
if (undoSteps > 0)
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITUNDO, MF_ENABLED | MF_BYCOMMAND);
else
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITUNDO, MF_GRAYED | MF_BYCOMMAND);
if (redoSteps>0)
if (redoSteps > 0)
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITREDO, MF_ENABLED | MF_BYCOMMAND);
else
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITREDO, MF_GRAYED | MF_BYCOMMAND);
@ -195,7 +204,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCOPYTO, MF_GRAYED | MF_BYCOMMAND);
}
OpenClipboard(hMainWnd);
if (GetClipboardData(CF_BITMAP)!=NULL)
if (GetClipboardData(CF_BITMAP) != NULL)
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITPASTE, MF_ENABLED | MF_BYCOMMAND);
else
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITPASTE, MF_GRAYED | MF_BYCOMMAND);
@ -206,10 +215,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(GetMenu(hMainWnd), IDM_IMAGECROP, MF_ENABLED | MF_BYCOMMAND);
else
EnableMenuItem(GetMenu(hMainWnd), IDM_IMAGECROP, MF_GRAYED | MF_BYCOMMAND);
if (transpBg==0)
CheckMenuItem(GetMenu(hMainWnd), IDM_IMAGEDRAWOPAQUE, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_IMAGEDRAWOPAQUE, MF_UNCHECKED | MF_BYCOMMAND);
CheckMenuItem(GetMenu(hMainWnd), IDM_IMAGEDRAWOPAQUE, (transpBg == 0) ?
(MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
break;
}
if (IsWindowVisible(hStatusBar))
@ -217,113 +224,90 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSTATUSBAR, MF_UNCHECKED | MF_BYCOMMAND);
if (showGrid)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWGRID, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWGRID, MF_UNCHECKED | MF_BYCOMMAND);
if (showMiniature)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWMINIATURE, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWMINIATURE, MF_UNCHECKED | MF_BYCOMMAND);
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWGRID,
showGrid ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWMINIATURE,
showMiniature ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
if (zoom==125)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM125, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM125, MF_UNCHECKED | MF_BYCOMMAND);
if (zoom==250)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM25, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM25, MF_UNCHECKED | MF_BYCOMMAND);
if (zoom==500)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM50, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM50, MF_UNCHECKED | MF_BYCOMMAND);
if (zoom==1000)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM100, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM100, MF_UNCHECKED | MF_BYCOMMAND);
if (zoom==2000)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM200, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM200, MF_UNCHECKED | MF_BYCOMMAND);
if (zoom==4000)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM400, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM400, MF_UNCHECKED | MF_BYCOMMAND);
if (zoom==8000)
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM800, MF_CHECKED | MF_BYCOMMAND);
else
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM800, MF_UNCHECKED | MF_BYCOMMAND);
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM125,
(zoom == 125) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM25,
(zoom == 250) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM50,
(zoom == 500) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM100,
(zoom == 1000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM200,
(zoom == 2000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM400,
(zoom == 4000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM800,
(zoom == 8000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
break;
case WM_SIZE:
if (hwnd==hMainWnd)
if (hwnd == hMainWnd)
{
int test[] = {LOWORD(lParam)-260, LOWORD(lParam)-140, LOWORD(lParam)-20};
int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
SendMessage(hStatusBar, WM_SIZE, wParam, lParam);
SendMessage(hStatusBar, SB_SETPARTS, 3, (int)&test);
MoveWindow(hScrollbox, 56, 49,LOWORD(lParam)-56, HIWORD(lParam)-72, TRUE);
MoveWindow(hScrollbox, 56, 49, LOWORD(lParam) - 56, HIWORD(lParam) - 72, TRUE);
//InvalidateRect(hwnd, NULL, TRUE);
}
if (hwnd==hImageArea)
if (hwnd == hImageArea)
{
MoveWindow(hSizeboxLeftTop,
0,
0, 3, 3, TRUE);
MoveWindow(hSizeboxCenterTop,
imgXRes*zoom/2000+3*3/4,
imgXRes * zoom / 2000 + 3 * 3 / 4,
0, 3, 3, TRUE);
MoveWindow(hSizeboxRightTop,
imgXRes*zoom/1000+3,
imgXRes * zoom / 1000 + 3,
0, 3, 3, TRUE);
MoveWindow(hSizeboxLeftCenter,
0,
imgYRes*zoom/2000+3*3/4, 3, 3, TRUE);
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
MoveWindow(hSizeboxRightCenter,
imgXRes*zoom/1000+3,
imgYRes*zoom/2000+3*3/4, 3, 3, TRUE);
imgXRes * zoom / 1000 + 3,
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
MoveWindow(hSizeboxLeftBottom,
0,
imgYRes*zoom/1000+3, 3, 3, TRUE);
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
MoveWindow(hSizeboxCenterBottom,
imgXRes*zoom/2000+3*3/4,
imgYRes*zoom/1000+3, 3, 3, TRUE);
imgXRes * zoom / 2000 + 3 * 3 / 4,
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
MoveWindow(hSizeboxRightBottom,
imgXRes*zoom/1000+3,
imgYRes*zoom/1000+3, 3, 3, TRUE);
imgXRes * zoom / 1000 + 3,
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
}
if ((hwnd==hImageArea)||(hwnd==hScrollbox))
if ((hwnd == hImageArea) || (hwnd == hScrollbox))
{
long clientRectScrollbox[4];
long clientRectImageArea[4];
SCROLLINFO horzScroll;
SCROLLINFO vertScroll;
GetClientRect(hScrollbox, (LPRECT)&clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT)&clientRectImageArea);
horzScroll.cbSize = sizeof(SCROLLINFO);
horzScroll.fMask = SIF_PAGE | SIF_RANGE;
horzScroll.nMax = clientRectImageArea[2]+6-1;
horzScroll.nMin = 0;
horzScroll.nPage = clientRectScrollbox[2];
horzScroll.nPos = 0;
horzScroll.nTrackPos = 0;
SetScrollInfo(hScrollbox, SB_HORZ, &horzScroll, TRUE);
GetClientRect(hScrollbox, (LPRECT)clientRectScrollbox);
vertScroll.cbSize = sizeof(SCROLLINFO);
vertScroll.fMask = SIF_PAGE | SIF_RANGE;
vertScroll.nMax = clientRectImageArea[3]+6-1;
vertScroll.nMin = 0;
vertScroll.nPage = clientRectScrollbox[3];
vertScroll.nPos = 0;
vertScroll.nTrackPos = 0;
SetScrollInfo(hScrollbox, SB_VERT, &vertScroll, TRUE);
SCROLLINFO si;
GetClientRect(hScrollbox, (LPRECT) &clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT) &clientRectImageArea);
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_PAGE | SIF_RANGE;
si.nMax = clientRectImageArea[2] + 6 - 1;
si.nMin = 0;
si.nPage = clientRectScrollbox[2];
SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
GetClientRect(hScrollbox, (LPRECT) clientRectScrollbox);
si.nMax = clientRectImageArea[3] + 6 - 1;
si.nPage = clientRectScrollbox[3];
SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
MoveWindow(hScrlClient,
-GetScrollPos(hScrollbox, SB_HORZ), -GetScrollPos(hScrollbox, SB_VERT),
max(clientRectImageArea[2]+6, clientRectScrollbox[2]), max(clientRectImageArea[3]+6, clientRectScrollbox[3]), TRUE);
max(clientRectImageArea[2] + 6, clientRectScrollbox[2]),
max(clientRectImageArea[3] + 6, clientRectScrollbox[3]), TRUE);
}
break;
case WM_HSCROLL:
if (hwnd==hScrollbox)
if (hwnd == hScrollbox)
{
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
@ -350,11 +334,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
-GetScrollPos(hScrollbox, SB_VERT), imgXRes*zoom/1000+6, imgYRes*zoom/1000+6, TRUE);
-GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 + 6,
imgYRes * zoom / 1000 + 6, TRUE);
}
break;
case WM_VSCROLL:
if (hwnd==hScrollbox)
if (hwnd == hScrollbox)
{
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
@ -381,51 +367,56 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
-GetScrollPos(hScrollbox, SB_VERT), imgXRes*zoom/1000+6, imgYRes*zoom/1000+6, TRUE);
-GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 + 6,
imgYRes * zoom / 1000 + 6, TRUE);
}
break;
case WM_GETMINMAXINFO:
if (hwnd==hMainWnd)
if (hwnd == hMainWnd)
{
MINMAXINFO *mm = (LPMINMAXINFO)lParam;
MINMAXINFO *mm = (LPMINMAXINFO) lParam;
(*mm).ptMinTrackSize.x = 330;
(*mm).ptMinTrackSize.y = 430;
}
break;
case WM_PAINT:
DefWindowProc (hwnd, message, wParam, lParam);
if (hwnd==hImageArea)
DefWindowProc(hwnd, message, wParam, lParam);
if (hwnd == hImageArea)
{
HDC hdc = GetDC(hImageArea);
StretchBlt(hdc, 0, 0, imgXRes*zoom/1000, imgYRes*zoom/1000, hDrawingDC, 0, 0, imgXRes, imgYRes, SRCCOPY);
if (showGrid && (zoom>=4000))
StretchBlt(hdc, 0, 0, imgXRes * zoom / 1000, imgYRes * zoom / 1000, hDrawingDC, 0, 0, imgXRes,
imgYRes, SRCCOPY);
if (showGrid && (zoom >= 4000))
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, 0x00a0a0a0));
int counter;
for (counter = 0; counter <= imgYRes; counter++)
for(counter = 0; counter <= imgYRes; counter++)
{
MoveToEx(hdc, 0, counter*zoom/1000, NULL);
LineTo(hdc, imgXRes*zoom/1000, counter*zoom/1000);
MoveToEx(hdc, 0, counter * zoom / 1000, NULL);
LineTo(hdc, imgXRes * zoom / 1000, counter * zoom / 1000);
}
for (counter = 0; counter <= imgXRes; counter++)
for(counter = 0; counter <= imgXRes; counter++)
{
MoveToEx(hdc, counter*zoom/1000, 0, NULL);
LineTo(hdc, counter*zoom/1000, imgYRes*zoom/1000);
MoveToEx(hdc, counter * zoom / 1000, 0, NULL);
LineTo(hdc, counter * zoom / 1000, imgYRes * zoom / 1000);
}
DeleteObject(SelectObject(hdc, oldPen));
}
ReleaseDC(hImageArea, hdc);
SendMessage(hSelection, WM_PAINT, 0, 0);
SendMessage(hwndMiniature, WM_PAINT, 0, 0);
}else
if (hwnd==hwndMiniature)
}
else if (hwnd == hwndMiniature)
{
long mclient[4];
HDC hdc;
GetClientRect(hwndMiniature, (LPRECT)&mclient);
GetClientRect(hwndMiniature, (LPRECT) &mclient);
hdc = GetDC(hwndMiniature);
BitBlt(hdc, -min(imgXRes*GetScrollPos(hScrollbox, SB_HORZ)/10000, imgXRes-mclient[2]),
-min(imgYRes*GetScrollPos(hScrollbox, SB_VERT)/10000, imgYRes-mclient[3]), imgXRes, imgYRes, hDrawingDC, 0, 0, SRCCOPY);
BitBlt(hdc, -min(imgXRes * GetScrollPos(hScrollbox, SB_HORZ) / 10000, imgXRes - mclient[2]),
-min(imgYRes * GetScrollPos(hScrollbox, SB_VERT) / 10000, imgYRes - mclient[3]),
imgXRes, imgYRes, hDrawingDC, 0, 0, SRCCOPY);
ReleaseDC(hwndMiniature, hdc);
}
break;
@ -433,7 +424,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
// mouse events used for drawing
case WM_SETCURSOR:
if (hwnd==hImageArea)
if (hwnd == hImageArea)
{
switch (activeTool)
{
@ -455,84 +446,104 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
default:
SetCursor(LoadCursor(NULL, IDC_CROSS));
}
} else DefWindowProc(hwnd, message, wParam, lParam);
}
else
DefWindowProc(hwnd, message, wParam, lParam);
break;
case WM_LBUTTONDOWN:
if (hwnd==hImageArea)
if (hwnd == hImageArea)
{
if ((!drawing)||(activeTool==5))
if ((!drawing) || (activeTool == 5))
{
SetCapture(hImageArea);
drawing = TRUE;
startPaintingL(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor);
}else
startPaintingL(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom,
fgColor, bgColor);
}
else
{
SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
undo();
}
SendMessage(hImageArea, WM_PAINT, 0, 0);
if ((activeTool==6)&&(zoom<8000)) zoomTo(zoom*2, (short)LOWORD(lParam), (short)HIWORD(lParam));
if ((activeTool == 6) && (zoom < 8000))
zoomTo(zoom * 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
}
break;
case WM_RBUTTONDOWN:
if (hwnd==hImageArea)
if (hwnd == hImageArea)
{
if ((!drawing)||(activeTool==5))
if ((!drawing) || (activeTool == 5))
{
SetCapture(hImageArea);
drawing = TRUE;
startPaintingR(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor);
}else
startPaintingR(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom,
fgColor, bgColor);
}
else
{
SendMessage(hwnd, WM_RBUTTONUP, wParam, lParam);
undo();
}
SendMessage(hImageArea, WM_PAINT, 0, 0);
if ((activeTool==6)&&(zoom>125)) zoomTo(zoom/2, (short)LOWORD(lParam), (short)HIWORD(lParam));
if ((activeTool == 6) && (zoom > 125))
zoomTo(zoom / 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
}
break;
case WM_LBUTTONUP:
if ((hwnd==hImageArea)&&drawing)
if ((hwnd == hImageArea) && drawing)
{
ReleaseCapture();
drawing = FALSE;
endPaintingL(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)
if (activeTool == 5)
{
int tempColor = GetPixel(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom);
if (tempColor!=CLR_INVALID) fgColor = tempColor;
int tempColor =
GetPixel(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom);
if (tempColor != CLR_INVALID)
fgColor = tempColor;
SendMessage(hPalWin, WM_PAINT, 0, 0);
}
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)"");
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
}
break;
case WM_RBUTTONUP:
if ((hwnd==hImageArea)&&drawing)
if ((hwnd == hImageArea) && drawing)
{
ReleaseCapture();
drawing = FALSE;
endPaintingR(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor);
endPaintingR(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom, fgColor,
bgColor);
SendMessage(hImageArea, WM_PAINT, 0, 0);
if (activeTool==5)
if (activeTool == 5)
{
int tempColor = GetPixel(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom);
if (tempColor!=CLR_INVALID) bgColor = tempColor;
int tempColor =
GetPixel(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom);
if (tempColor != CLR_INVALID)
bgColor = tempColor;
SendMessage(hPalWin, WM_PAINT, 0, 0);
}
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)"");
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
}
break;
case WM_MOUSEMOVE:
if (hwnd==hImageArea)
if (hwnd == hImageArea)
{
if ((!drawing)||(activeTool<=9))
if ((!drawing) || (activeTool <= 9))
{
TRACKMOUSEEVENT tme;
TCHAR coordStr[100];
_stprintf(coordStr, _T("%d, %d"), (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom);
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)coordStr);
_stprintf(coordStr, _T("%d, %d"), (short)LOWORD(lParam) * 1000 / zoom,
(short)HIWORD(lParam) * 1000 / zoom);
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
if (activeTool == 6)
{
@ -548,37 +559,40 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
if (drawing)
{
if ((wParam&MK_LBUTTON)!=0)
if ((wParam & MK_LBUTTON) != 0)
{
whilePaintingL(hDrawingDC, (short)LOWORD(lParam)*1000/zoom, (short)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))
if ((activeTool >= 10) || (activeTool == 2))
{
TCHAR sizeStr[100];
_stprintf(sizeStr, _T("%d x %d"), (short)LOWORD(lParam)*1000/zoom-startX, (short)HIWORD(lParam)*1000/zoom-startY);
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
_stprintf(sizeStr, _T("%d x %d"), (short)LOWORD(lParam) * 1000 / zoom - startX,
(short)HIWORD(lParam) * 1000 / zoom - startY);
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
}
}
if ((wParam&MK_RBUTTON)!=0)
if ((wParam & MK_RBUTTON) != 0)
{
whilePaintingR(hDrawingDC, (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom, fgColor, bgColor);
whilePaintingR(hDrawingDC, (short)LOWORD(lParam) * 1000 / zoom,
(short)HIWORD(lParam) * 1000 / zoom, fgColor, bgColor);
SendMessage(hImageArea, WM_PAINT, 0, 0);
if (activeTool>=10)
if (activeTool >= 10)
{
TCHAR sizeStr[100];
_stprintf(sizeStr, _T("%d x %d"), (short)LOWORD(lParam)*1000/zoom-startX, (short)HIWORD(lParam)*1000/zoom-startY);
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr);
_stprintf(sizeStr, _T("%d x %d"), (short)LOWORD(lParam) * 1000 / zoom - startX,
(short)HIWORD(lParam) * 1000 / zoom - startY);
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
}
}
}
}
break;
case WM_MOUSELEAVE:
{
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM)_T(""));
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) _T(""));
if (activeTool == 6)
SendMessage(hImageArea, WM_PAINT, 0, 0);
}
break;
// menu and button events
@ -595,8 +609,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
LoadString(hProgInstance, IDS_INFOTEXT, infotext, SIZEOF(infotext));
ShellAbout(hMainWnd, infotitle, infotext, paintIcon);
DeleteObject(paintIcon);
}
break;
}
case IDM_HELPHELPTOPICS:
//HtmlHelp(hMainWnd, "help\\Paint.chm", 0, 0);
break;
@ -604,15 +618,15 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
SendMessage(hwnd, WM_CLOSE, wParam, lParam);
break;
case IDM_FILENEW:
Rectangle(hDrawingDC, 0-1, 0-1, imgXRes+1, imgYRes+1);
Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, imgYRes + 1);
SendMessage(hImageArea, WM_PAINT, 0, 0);
break;
case IDM_FILEOPEN:
if (GetOpenFileName(&ofn)!=0)
if (GetOpenFileName(&ofn) != 0)
{
HBITMAP bmNew = NULL;
LoadDIBFromFile(&bmNew, ofn.lpstrFile, &fileTime, &fileSize, &fileHPPM, &fileVPPM);
if (bmNew!=NULL)
if (bmNew != NULL)
{
TCHAR tempstr[1000];
TCHAR resstr[100];
@ -631,18 +645,20 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_FILESAVE:
if (isAFile)
{
SaveDIBToFile(hBms[currInd], filepathname, hDrawingDC, &fileTime, &fileSize, fileHPPM, fileVPPM);
SaveDIBToFile(hBms[currInd], filepathname, hDrawingDC, &fileTime, &fileSize, fileHPPM,
fileVPPM);
imageSaved = TRUE;
}
else
SendMessage(hwnd, WM_COMMAND, IDM_FILESAVEAS, 0);
break;
case IDM_FILESAVEAS:
if (GetSaveFileName(&sfn)!=0)
if (GetSaveFileName(&sfn) != 0)
{
TCHAR tempstr[1000];
TCHAR resstr[100];
SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC, &fileTime, &fileSize, fileHPPM, fileVPPM);
SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC, &fileTime, &fileSize,
fileHPPM, fileVPPM);
CopyMemory(filename, sfn.lpstrFileTitle, sizeof(filename));
CopyMemory(filepathname, sfn.lpstrFile, sizeof(filepathname));
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
@ -677,15 +693,18 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
break;
case IDM_EDITPASTE:
OpenClipboard(hMainWnd);
if (GetClipboardData(CF_BITMAP)!=NULL)
if (GetClipboardData(CF_BITMAP) != NULL)
{
DeleteObject(SelectObject(hSelDC, hSelBm = CopyImage(GetClipboardData(CF_BITMAP), IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG)));
DeleteObject(SelectObject(hSelDC, hSelBm = CopyImage(GetClipboardData(CF_BITMAP),
IMAGE_BITMAP, 0, 0,
LR_COPYRETURNORG)));
newReversible();
rectSel_src[0] = rectSel_src[1] = rectSel_src[2] = rectSel_src[3] = 0;
rectSel_dest[0] = rectSel_dest[1] = 0;
rectSel_dest[2] = GetDIBWidth(hSelBm);
rectSel_dest[3] = GetDIBHeight(hSelBm);
BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3], hSelDC, 0, 0, SRCCOPY);
BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3],
hSelDC, 0, 0, SRCCOPY);
placeSelWin();
ShowWindow(hSelection, SW_SHOW);
}
@ -695,7 +714,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
ShowWindow(hSelection, SW_HIDE);
break;
case IDM_EDITSELECTALL:
if (activeTool==2)
if (activeTool == 2)
{
startPaintingL(hDrawingDC, 0, 0, fgColor, bgColor);
whilePaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
@ -703,7 +722,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
break;
case IDM_EDITCOPYTO:
if (GetSaveFileName(&ofn)!=0) SaveDIBToFile(hSelBm, ofn.lpstrFile, hDrawingDC, NULL, NULL, fileHPPM, fileVPPM);
if (GetSaveFileName(&ofn) != 0)
SaveDIBToFile(hSelBm, ofn.lpstrFile, hDrawingDC, NULL, NULL, fileHPPM, fileVPPM);
break;
case IDM_COLORSEDITPALETTE:
if (ChooseColor(&choosecolor))
@ -719,8 +739,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
SetRect(&tempRect, 0, 0, imgXRes, imgYRes);
InvertRect(hDrawingDC, &tempRect);
SendMessage(hImageArea, WM_PAINT, 0, 0);
}
break;
}
case IDM_IMAGEDELETEIMAGE:
newReversible();
Rect(hDrawingDC, 0, 0, imgXRes, imgYRes, bgColor, bgColor, 0, TRUE);
@ -731,17 +751,20 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
case 1:
newReversible();
StretchBlt(hDrawingDC, imgXRes-1, 0, -imgXRes, imgYRes, hDrawingDC, 0, 0, imgXRes, imgYRes, SRCCOPY);
StretchBlt(hDrawingDC, imgXRes - 1, 0, -imgXRes, imgYRes, hDrawingDC, 0, 0,
imgXRes, imgYRes, SRCCOPY);
SendMessage(hImageArea, WM_PAINT, 0, 0);
break;
case 2:
newReversible();
StretchBlt(hDrawingDC, 0, imgYRes-1, imgXRes, -imgYRes, hDrawingDC, 0, 0, imgXRes, imgYRes, SRCCOPY);
StretchBlt(hDrawingDC, 0, imgYRes - 1, imgXRes, -imgYRes, hDrawingDC, 0, 0,
imgXRes, imgYRes, SRCCOPY);
SendMessage(hImageArea, WM_PAINT, 0, 0);
break;
case 4:
newReversible();
StretchBlt(hDrawingDC, imgXRes-1, imgYRes-1, -imgXRes, -imgYRes, hDrawingDC, 0, 0, imgXRes, imgYRes, SRCCOPY);
StretchBlt(hDrawingDC, imgXRes - 1, imgYRes - 1, -imgXRes, -imgYRes, hDrawingDC,
0, 0, imgXRes, imgYRes, SRCCOPY);
SendMessage(hImageArea, WM_PAINT, 0, 0);
break;
}
@ -749,25 +772,27 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case IDM_IMAGEATTRIBUTES:
{
int retVal = attributesDlg();
if ((LOWORD(retVal)!=0)&&(HIWORD(retVal)!=0))
if ((LOWORD(retVal) != 0) && (HIWORD(retVal) != 0))
{
cropReversible(LOWORD(retVal), HIWORD(retVal), 0, 0);
updateCanvasAndScrollbars();
}
}
break;
}
case IDM_IMAGECHANGESIZE:
{
int retVal = changeSizeDlg();
if ((LOWORD(retVal)!=0)&&(HIWORD(retVal)!=0))
if ((LOWORD(retVal) != 0) && (HIWORD(retVal) != 0))
{
insertReversible(CopyImage(hBms[currInd], IMAGE_BITMAP, imgXRes*LOWORD(retVal)/100, imgYRes*HIWORD(retVal)/100, 0));
insertReversible(CopyImage(hBms[currInd], IMAGE_BITMAP,
imgXRes * LOWORD(retVal) / 100,
imgYRes * HIWORD(retVal) / 100, 0));
updateCanvasAndScrollbars();
}
}
break;
}
case IDM_IMAGEDRAWOPAQUE:
transpBg = 1-transpBg;
transpBg = 1 - transpBg;
SendMessage(hToolSettings, WM_PAINT, 0, 0);
break;
case IDM_IMAGECROP:
@ -776,10 +801,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
break;
case IDM_VIEWSTATUSBAR:
if (IsWindowVisible(hStatusBar))
ShowWindow(hStatusBar, SW_HIDE);
else
ShowWindow(hStatusBar, SW_SHOW);
ShowWindow(hStatusBar, IsWindowVisible(hStatusBar) ? SW_HIDE : SW_SHOW);
break;
case IDM_VIEWSHOWGRID:
@ -787,10 +809,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
break;
case IDM_VIEWSHOWMINIATURE:
showMiniature = !showMiniature;
if (showMiniature)
ShowWindow(hwndMiniature, SW_SHOW);
else
ShowWindow(hwndMiniature, SW_HIDE);
ShowWindow(hwndMiniature, showMiniature ? SW_SHOW : SW_HIDE);
break;
case IDM_VIEWZOOM125:
@ -865,9 +884,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}

View file

@ -1,12 +1,10 @@
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
* FILE: winproc.h
* FILE: base/applications/paint/winproc.h
* PURPOSE: Window procedure of the main window and all children apart from
* hPalWin, hToolSettings and hSelection
* PROGRAMMERS: Benedikt Freisen
*/
void ZoomTo(int newZoom);
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);