/*
* 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
*/
/* 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
#define IDM_IMAGEINVERTCOLORS 253
#define IDM_IMAGEATTRIBUTES 254
#define IDM_IMAGEDELETEIMAGE 255
-#define IDM_IMAGEDRAWOPAQUE 256
+#define IDM_IMAGEDRAWOPAQUE 256
#define IDM_COLORSEDITPALETTE 260
/*
* 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
*/
/* 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)
{
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)
{
case WM_INITDIALOG:
+ {
+ TCHAR strrc[100];
+ TCHAR res[100];
+
+ CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
+ CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
+ SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
+ SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
+
+ if (isAFile)
{
- TCHAR strrc[100];
- TCHAR res[100];
-
- CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
- CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
- SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
- SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
-
- if (isAFile)
- {
- 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));
- _tcscat(date, _T(" "));
- _tcscat(date, temp);
- 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));
- _stprintf(res, strrc, fileHPPM, fileVPPM);
- SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
- return TRUE;
+ 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));
+ _tcscat(date, _T(" "));
+ _tcscat(date, temp);
+ 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));
+ _stprintf(res, strrc, fileHPPM, fileVPPM);
+ SetDlgItemText(hwnd, IDD_ATTRIBUTESTEXT8, res);
+ return TRUE;
+ }
case WM_CLOSE:
EndDialog(hwnd, 0);
break;
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);
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)
{
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);
return TRUE;
}
-int changeSizeDlg()
+int
+changeSizeDlg()
{
- return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC)CHSIZEDlgWinProc);
+ return DialogBox(hProgInstance, MAKEINTRESOURCE(IDD_CHANGESIZE), hMainWnd, (DLGPROC) CHSIZEDlgWinProc);
}
/*
* 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
*/
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
- * FILE: dib.c
+ * FILE: base/applications/paint/dib.c
* PURPOSE: Some DIB related functions
* PROGRAMMERS: Benedikt Freisen
*/
/* FUNCTIONS ********************************************************/
-HBITMAP CreateDIBWithProperties(int width, int height)
+HBITMAP
+CreateDIBWithProperties(int width, int height)
{
BITMAPINFO bmi;
ZeroMemory(&bmi, sizeof(BITMAPINFO));
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;
BITMAPINFOHEADER bi;
int imgDataSize;
DWORD dwBytesWritten;
- char* buffer;
+ char *buffer;
GetObject(hBitmap, sizeof(BITMAP), &bm);
ZeroMemory(&bi, sizeof(BITMAPINFOHEADER));
imgDataSize = bm.bmWidthBytes * bm.bmHeight;
- bf.bfType = 0x4d42; /* BM */
+ bf.bfType = 0x4d42; /* BM */
bf.bfSize = imgDataSize + 52;
bf.bfOffBits = 54;
bi.biSize = sizeof(BITMAPINFOHEADER);
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)
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;
PVOID pvBits;
DWORD dwBytesRead;
HANDLE hFile;
-
+
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;
CloseHandle(hFile);
return;
}
-
+
if (time)
{
FILETIME ft;
ReadFile(hFile, bi, bfh.bfOffBits - sizeof(BITMAPFILEHEADER), &dwBytesRead, NULL);
*hBitmap = CreateDIBSection(NULL, bi, DIB_RGB_COLORS, &pvBits, NULL, 0);
ReadFile(hFile, pvBits, bfh.bfSize - bfh.bfOffBits, &dwBytesRead, NULL);
-
+
if (hRes)
*hRes = (*bi).bmiHeader.biXPelsPerMeter;
if (vRes)
*vRes = (*bi).bmiHeader.biYPelsPerMeter;
-
+
CloseHandle(hFile);
HeapFree(GetProcessHeap(), 0, bi);
}
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
- * FILE: dib.h
+ * FILE: base/applications/paint/dib.h
* PURPOSE: Some DIB related functions
* PROGRAMMERS: Benedikt Freisen
*/
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);
/*
* 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
*/
/* 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);
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);
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);
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);
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)
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];
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));
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);
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;
}
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;
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;
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));
}
/*
* 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
*/
/*
* 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
*/
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;
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;
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
- * FILE: history.c
+ * FILE: base/applications/paint/history.c
* PURPOSE: Undo and redo functionality
* PROGRAMMERS: Benedikt Freisen
*/
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;
}
}
-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]);
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);
SelectObject(hdc, hBms[currInd]);
-
+
oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, bgColor));
oldBrush = SelectObject(hdc, CreateSolidBrush(bgColor));
Rectangle(hdc, 0, 0, width, height);
DeleteObject(SelectObject(hdc, oldPen));
DeleteDC(hdc);
SelectObject(hDrawingDC, hBms[currInd]);
-
+
setImgXYRes(width, height);
}
/*
- * 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
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
-/* 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
LTEXT "Datum zmìny:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Velikost souboru:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Rozli\9aení:", 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
/*
- * 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
/*
- * 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
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
/*
- * 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
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
/*
- * 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
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
-/* 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
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
/*
- * 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
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
/*
- * 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
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
/*
- * 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
LTEXT "\83t\83@\83C\83\8b\82Ì\93ú\95t:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "\83t\83@\83C\83\8b\82Ì\83T\83C\83Y:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "\89ð\91\9c\93x:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10
- LTEXT "\97\98\97p\95s\89Â\94\\", IDD_ATTRIBUTESTEXT6, 70, 5, 60, 10
- LTEXT "\97\98\97p\95s\89Â\94\\", IDD_ATTRIBUTESTEXT7, 70, 15, 60, 10
- LTEXT "\97\98\97p\95s\89Â\94\\", IDD_ATTRIBUTESTEXT8, 70, 25, 60, 10
+ LTEXT "\97\98\97p\95s\89Â\94\\", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10
+ LTEXT "\97\98\97p\95s\89Â\94\\", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10
+ LTEXT "\97\98\97p\95s\89Â\94\\", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10
GROUPBOX "\92P\88Ê", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27
AUTORADIOBUTTON "\83C\83\93\83`", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP
AUTORADIOBUTTON "cm", IDD_ATTRIBUTESRB2, 52, 69, 35, 10
/*
- * 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
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
/*
- * 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
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
/*
- * 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
LTEXT "Data:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10
LTEXT "Rozmiar:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10
LTEXT "Rozdzielczo\9cæ:", 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
/*
- * 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
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
/*
- * 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
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
/*
- * 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
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
+/*
+ * 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
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
/*
- * 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
LTEXT "Dátum zmeny:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 //File date
LTEXT "Ve¾kos\9d súboru:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 //File size
LTEXT "Rozlí\9aenie:", 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
/*
- * 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
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
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
- * FILE: main.c
+ * FILE: base/applications/paint/main.c
* PURPOSE: Initializing everything
* PROGRAMMERS: Benedikt Freisen
*/
int redoSteps = 0;
BOOL imageSaved = TRUE;
-// global status variables
-
short startX;
short startY;
short lastX;
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;
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;
HBITMAP tempBm;
int i;
TCHAR tooltips[16][30];
+
TCHAR *c;
TCHAR sfnFilename[1000];
TCHAR sfnFiletitle[256];
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;
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;
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;
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;
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;
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 */
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;
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));
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));
- hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM));
- hCurPen = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
- hCurAirbrush = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
+ hCurFill = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_FILL));
+ hCurColor = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_COLOR));
+ hCurZoom = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_ZOOM));
+ 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.fsStyle = TBSTYLE_CHECKGROUP;
- tbbutton.fsState = TBSTATE_ENABLED | wrapnow;
+ 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);
+ tbbutton.iBitmap = i;
+ 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));
+ hSelDC = CreateCompatibleDC(GetDC(hImageArea));
SelectObject(hDrawingDC, CreatePen(PS_SOLID, 0, fgColor));
SelectObject(hDrawingDC, CreateSolidBrush(bgColor));
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);
}
/* initializing the CHOOSECOLOR structure for use with ChooseColor */
- choosecolor.lStructSize = sizeof(CHOOSECOLOR);
- choosecolor.hwndOwner = hwnd;
- choosecolor.hInstance = NULL;
- choosecolor.rgbResult = 0x00ffffff;
- choosecolor.lpCustColors = (COLORREF*)&custColors;
- choosecolor.Flags = 0;
- choosecolor.lCustData = 0;
- choosecolor.lpfnHook = NULL;
- choosecolor.lpTemplateName = NULL;
+ choosecolor.lStructSize = sizeof(CHOOSECOLOR);
+ choosecolor.hwndOwner = hwnd;
+ choosecolor.hInstance = NULL;
+ choosecolor.rgbResult = 0x00ffffff;
+ choosecolor.lpCustColors = (COLORREF*) &custColors;
+ choosecolor.Flags = 0;
+ choosecolor.lCustData = 0;
+ choosecolor.lpfnHook = NULL;
+ choosecolor.lpTemplateName = NULL;
/* 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.hwndOwner = hwnd;
- ofn.hInstance = hThisInstance;
- ofn.lpstrFilter = ofnFilter;
- ofn.lpstrFile = ofnFilename;
- ofn.nMaxFile = SIZEOF(ofnFilename);
- ofn.lpstrFileTitle = ofnFiletitle;
- ofn.nMaxFileTitle = SIZEOF(ofnFiletitle);
- ofn.Flags = OFN_HIDEREADONLY;
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hwnd;
+ ofn.hInstance = hThisInstance;
+ ofn.lpstrFilter = ofnFilter;
+ ofn.lpstrFile = ofnFilename;
+ ofn.nMaxFile = SIZEOF(ofnFilename);
+ ofn.lpstrFileTitle = ofnFiletitle;
+ ofn.nMaxFileTitle = SIZEOF(ofnFiletitle);
+ ofn.Flags = OFN_HIDEREADONLY;
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.hwndOwner = hwnd;
- sfn.hInstance = hThisInstance;
- sfn.lpstrFilter = sfnFilter;
- sfn.lpstrFile = sfnFilename;
- sfn.nMaxFile = SIZEOF(sfnFilename);
- sfn.lpstrFileTitle = sfnFiletitle;
- 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);
+ sfn.lStructSize = sizeof(OPENFILENAME);
+ sfn.hwndOwner = hwnd;
+ sfn.hInstance = hThisInstance;
+ sfn.lpstrFilter = sfnFilter;
+ sfn.lpstrFile = sfnFilename;
+ sfn.nMaxFile = SIZEOF(sfnFilename);
+ sfn.lpstrFileTitle = sfnFiletitle;
+ sfn.nMaxFileTitle = SIZEOF(sfnFiletitle);
+ sfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
+
+ /* 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 */
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);
/*
* 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
*/
/* 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);
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;
case 1:
case 10:
case 11:
+ case 13:
case 15:
case 16:
newReversible();
case 12:
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
- if (pointSP==0)
+ if (pointSP == 0)
{
newReversible();
pointSP++;
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++;
}
}
-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)
{
case 2:
- {
- short tempX;
- short tempY;
- resetToU1();
- tempX = max(0, min(x, imgXRes));
- 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(hdc, startX, startY, tempX, tempY);
- }
- break;
+ {
+ short tempX;
+ short tempY;
+ resetToU1();
+ tempX = max(0, min(x, imgXRes));
+ 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(hdc, startX, startY, tempX, tempY);
+ break;
+ }
case 3:
Erase(hdc, lastX, lastY, x, y, bg, rubberRadius);
break;
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:
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();
RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
break;
}
-
+
lastX = x;
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);
}
break;
case 12:
pointSP++;
- if (pointSP==4) pointSP = 0;
+ if (pointSP == 4)
+ pointSP = 0;
break;
case 13:
resetToU1();
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;
Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, FALSE);
}
}
- if (pointSP==255) pointSP--;
+ if (pointSP == 255)
+ pointSP--;
break;
case 15:
resetToU1();
}
}
-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;
case 1:
case 10:
case 11:
+ case 13:
case 15:
case 16:
newReversible();
case 12:
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
- if (pointSP==0)
+ if (pointSP == 0)
{
newReversible();
pointSP++;
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++;
}
}
-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)
{
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:
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();
RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
break;
}
-
+
lastX = x;
lastY = y;
}
-void endPaintingR(HDC hdc, short x, short y, int fg, int bg)
+void
+endPaintingR(HDC hdc, short x, short y, int fg, int bg)
{
switch (activeTool)
{
break;
case 12:
pointSP++;
- if (pointSP==4) pointSP = 0;
+ if (pointSP == 4)
+ pointSP = 0;
break;
case 13:
resetToU1();
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;
Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, FALSE);
}
}
- if (pointSP==255) pointSP--;
+ if (pointSP == 255)
+ pointSP--;
break;
case 15:
resetToU1();
/*
* 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
*/
/*
* 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
*/
/* 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};
- HDC hDC = GetDC(hwnd);
- HPEN oldPen;
- HBRUSH oldBrush;
- int i, a, b;
+ {
+ 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++)
+ if ((a + b) % 2 == 1)
+ SetPixel(hDC, a, b, GetSysColor(COLOR_BTNHILIGHT));
- 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);
+ SetRect(&rc, 11, 12, 26, 27);
+ 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);
+ DeleteObject(SelectObject(hDC, oldBrush));
+ SetRect(&rc, 4, 5, 19, 20);
+ 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);
+ DeleteObject(SelectObject(hDC, oldBrush));
+ DeleteObject(SelectObject(hDC, oldPen));
+ 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);
DrawEdge(hDC, &rc, EDGE_RAISED, BF_TOPLEFT);
- 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_SUNKENOUTER, BF_RECT);
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);
- DeleteObject(SelectObject(hDC, oldBrush));
- SetRect(&rc, 4, 5, 19, 20);
- 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);
+ oldBrush = SelectObject(hDC, CreateSolidBrush(palColors[i]));
+ 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++)
- {
- SetRect(&rc, 31 + (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);
- DeleteObject(SelectObject(hDC, oldBrush));
- DeleteObject(SelectObject(hDC, oldPen));
- }
- ReleaseDC(hwnd, hDC);
}
+ 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))
- {
- palColors[(LOWORD(lParam)-31)/16+(HIWORD(lParam)/16)*14] = choosecolor.rgbResult;
- fgColor = choosecolor.rgbResult;
- SendMessage(hwnd, WM_PAINT, 0, 0);
- }
+ if (LOWORD(lParam) >= 31)
+ if (ChooseColor(&choosecolor))
+ {
+ 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))
- {
- palColors[(LOWORD(lParam)-31)/16+(HIWORD(lParam)/16)*14] = choosecolor.rgbResult;
- bgColor = choosecolor.rgbResult;
- SendMessage(hwnd, WM_PAINT, 0, 0);
- }
+ if (LOWORD(lParam) >= 31)
+ if (ChooseColor(&choosecolor))
+ {
+ 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;
}
-
/*
* 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
*/
/*
* 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
*/
/* 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);
-
+
/*HKEY hDesktop;
TCHAR szStyle[3], szTile[3];
if ((dwStyle > 2) || (dwTile > 2))
return;
- if (RegOpenKeyEx(HKEY_CURRENT_USER,
- _T("Control Panel\\Desktop"), 0,
- KEY_READ | KEY_SET_VALUE, &hDesktop) == ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_CURRENT_USER,
+ _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);
+ _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);
}*/
/*
* 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
*/
/*
* PROJECT: PAINT for ReactOS
* LICENSE: LGPL
- * FILE: rsrc.rc
+ * FILE: base/applications/paint/rsrc.rc
* PURPOSE: Managing the resources
* PROGRAMMERS: Benedikt Freisen
*/
/*
* 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
*/
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)
{
case WM_PAINT:
+ {
+ if (!moving)
{
- if (!moving)
- {
- HDC hDC = GetDC(hwnd);
- DefWindowProc (hwnd, message, wParam, lParam);
- SelectionFrame(hDC, 1, 1, rectSel_dest[2]*zoom/1000+5, rectSel_dest[3]*zoom/1000+5);
- ReleaseDC(hwnd, hDC);
- }
+ HDC hDC = GetDC(hwnd);
+ DefWindowProc(hwnd, message, wParam, lParam);
+ SelectionFrame(hDC, 1, 1, rectSel_dest[2] * zoom / 1000 + 5,
+ rectSel_dest[3] * zoom / 1000 + 5);
+ ReleaseDC(hwnd, hDC);
}
break;
+ }
case WM_LBUTTONDOWN:
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
if (moving)
{
resetToU1();
- rectSel_dest[0]+=(short)LOWORD(lParam)-xPos;
- rectSel_dest[1]+=(short)HIWORD(lParam)-yPos;
-
- Rect(hDrawingDC, rectSel_src[0], rectSel_src[1], rectSel_src[0]+rectSel_src[2], rectSel_src[1]+rectSel_src[3], bgColor, bgColor, 0, TRUE);
- if (transpBg==0)
- BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3], hSelDC, 0, 0, SRCCOPY);
+ rectSel_dest[0] += (short)LOWORD(lParam) - xPos;
+ rectSel_dest[1] += (short)HIWORD(lParam) - yPos;
+
+ Rect(hDrawingDC, rectSel_src[0], rectSel_src[1], rectSel_src[0] + rectSel_src[2],
+ rectSel_src[1] + rectSel_src[3], bgColor, bgColor, 0, TRUE);
+ if (transpBg == 0)
+ BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3],
+ hSelDC, 0, 0, SRCCOPY);
else
- BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3], hSelDC, 0, 0, SRCAND);
- //TransparentBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3], hSelDC, 0, 0, rectSel_dest[2], rectSel_dest[3], bgColor);
+ 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);
}
break;
default:
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
/*
* 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);
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))
- SetCursor(LoadCursor(NULL, IDC_SIZENWSE));
- if ((hwnd==hSizeboxLeftBottom)||(hwnd==hSizeboxRightTop))
- SetCursor(LoadCursor(NULL, IDC_SIZENESW));
- if ((hwnd==hSizeboxLeftCenter)||(hwnd==hSizeboxRightCenter))
- SetCursor(LoadCursor(NULL, IDC_SIZEWE));
- if ((hwnd==hSizeboxCenterTop)||(hwnd==hSizeboxCenterBottom))
- SetCursor(LoadCursor(NULL, IDC_SIZENS));
- }
+ if ((hwnd == hSizeboxLeftTop) || (hwnd == hSizeboxRightBottom))
+ SetCursor(LoadCursor(NULL, IDC_SIZENWSE));
+ if ((hwnd == hSizeboxLeftBottom) || (hwnd == hSizeboxRightTop))
+ SetCursor(LoadCursor(NULL, IDC_SIZENESW));
+ if ((hwnd == hSizeboxLeftCenter) || (hwnd == hSizeboxRightCenter))
+ SetCursor(LoadCursor(NULL, IDC_SIZEWE));
+ if ((hwnd == hSizeboxCenterTop) || (hwnd == hSizeboxCenterBottom))
+ SetCursor(LoadCursor(NULL, IDC_SIZENS));
break;
case WM_LBUTTONDOWN:
resizing = TRUE;
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:
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;
/*
* 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);
/*
* 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
*/
/* 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};
+ {
+ HDC hdc = GetDC(hwnd);
+ 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);
- switch (activeTool)
+ 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:
+ case 2:
+ case 10:
{
- case 1:
- case 2:
- case 10:
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
+ SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ 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++)
+ {
+ if (rubberRadius == i + 2)
{
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
- 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++)
- {
- if (rubberRadius==i+2)
- {
- SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
- 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);
- }
- DeleteObject(SelectObject(hdc, oldPen));
+ Rectangle(hdc, 14, i * 15 + 2, 29, i * 15 + 17);
+ SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
}
- break;
- case 8:
+ 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);
+ DeleteObject(SelectObject(hdc, oldPen));
+ 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));
+ SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ switch (airBrushWidth)
+ {
+ case 5:
+ Rectangle(hdc, 2, 2, 21, 31);
+ break;
+ case 8:
+ Rectangle(hdc, 20, 2, 41, 31);
+ break;
+ case 3:
+ Rectangle(hdc, 2, 30, 16, 61);
+ break;
+ case 12:
+ Rectangle(hdc, 15, 30, 41, 61);
+ break;
+ }
+ 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++)
+ {
+ if (lineWidth == i + 1)
{
- 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);
- 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);
+ Rectangle(hdc, 2, i * 12 + 2, 41, i * 12 + 14);
+ SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
}
- break;
- case 9:
+ 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:
+ case 16:
+ {
+ int i;
+ HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
+ for(i = 0; i < 3; i++)
+ {
+ if (shapeStyle == i)
{
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
- switch (airBrushWidth)
- {
- case 5:
- Rectangle(hdc, 2, 2, 21, 31);
- break;
- case 8:
- Rectangle(hdc, 20, 2, 41, 31);
- break;
- case 3:
- Rectangle(hdc, 2, 30, 16, 61);
- break;
- case 12:
- 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);
- DeleteObject(SelectObject(hdc, oldPen));
+ Rectangle(hdc, 2, i * 20 + 2, 41, i * 20 + 22);
}
- break;
- case 11:
- case 12:
+ }
+ 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)
{
- int i;
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
- for (i=0; i<5; i++)
- {
- if (lineWidth==i+1)
- {
- SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
- 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);
- }
- DeleteObject(SelectObject(hdc, oldPen));
- }
- break;
- case 13:
- case 14:
- case 15:
- case 16:
- {
- int i;
- HPEN oldPen = SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
- for (i=0; i<3; i++)
- {
- if (shapeStyle==i)
- {
- SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
- 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++)
- {
- if (lineWidth==i+1)
- {
- SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
- 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);
- }
- DeleteObject(SelectObject(hdc, oldPen));
+ SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ Rectangle(hdc, 2, i * 12 + 72, 41, i * 12 + 84);
+ SelectObject(hdc, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
}
- break;
+ 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);
}
+ ReleaseDC(hwnd, hdc);
break;
+ }
case WM_LBUTTONDOWN:
+ {
+ switch (activeTool)
{
- switch (activeTool)
- {
- case 1:
- case 2:
- case 10:
- if ((HIWORD(lParam)>1)&&(HIWORD(lParam)<64))
+ case 1:
+ case 2:
+ case 10:
+ if ((HIWORD(lParam) > 1) && (HIWORD(lParam) < 64))
+ {
+ transpBg = (HIWORD(lParam) - 2) / 31;
+ SendMessage(hwnd, WM_PAINT, 0, 0);
+ }
+ break;
+ case 3:
+ if ((HIWORD(lParam) > 1) && (HIWORD(lParam) < 62))
+ {
+ 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))
+ {
+ 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) < 30)
{
- transpBg = (HIWORD(lParam)-2)/31;
- SendMessage(hwnd, WM_PAINT, 0, 0);
- }
- break;
- case 3:
- if ((HIWORD(lParam)>1)&&(HIWORD(lParam)<62))
- {
- 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))
- {
- 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)<30)
- {
- if (LOWORD(lParam)<20) airBrushWidth=5; else airBrushWidth=8;
- }else
- {
- if (LOWORD(lParam)<15) airBrushWidth=3; else airBrushWidth=12;
- }
- SendMessage(hwnd, WM_PAINT, 0, 0);
- }
- break;
- case 11:
- case 12:
- if (HIWORD(lParam)<=62)
- {
- lineWidth = (HIWORD(lParam)-2)/12+1;
- SendMessage(hwnd, WM_PAINT, 0, 0);
- }
- break;
- case 13:
- case 14:
- case 15:
- case 16:
- if (HIWORD(lParam)<=60)
- {
- shapeStyle = (HIWORD(lParam)-2)/20;
- SendMessage(hwnd, WM_PAINT, 0, 0);
+ if (LOWORD(lParam) < 20)
+ airBrushWidth = 5;
+ else
+ airBrushWidth = 8;
}
- if ((HIWORD(lParam)>=70)&&(HIWORD(lParam)<=132))
+ else
{
- lineWidth = (HIWORD(lParam)-72)/12+1;
- SendMessage(hwnd, WM_PAINT, 0, 0);
+ if (LOWORD(lParam) < 15)
+ airBrushWidth = 3;
+ else
+ airBrushWidth = 12;
}
- break;
- }
+ SendMessage(hwnd, WM_PAINT, 0, 0);
+ }
+ break;
+ case 11:
+ case 12:
+ if (HIWORD(lParam) <= 62)
+ {
+ lineWidth = (HIWORD(lParam) - 2) / 12 + 1;
+ SendMessage(hwnd, WM_PAINT, 0, 0);
+ }
+ break;
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ if (HIWORD(lParam) <= 60)
+ {
+ shapeStyle = (HIWORD(lParam) - 2) / 20;
+ SendMessage(hwnd, WM_PAINT, 0, 0);
+ }
+ if ((HIWORD(lParam) >= 70) && (HIWORD(lParam) <= 132))
+ {
+ 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;
}
-
/*
* 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);
/*
* 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
/* 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
+ 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);
-
+
SetScrollPos(hScrollbox, SB_HORZ, 0, TRUE);
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;
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;
y = max(0, min(clientRectImageArea[3] - h, mouseY - h / 2)) * newZoom / zoom;
-
+
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;
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));
y = max(0, min(clientRectImageArea[3] - h, mouseY - h / 2));
-
+
hdc = GetDC(hImageArea);
oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 0, 0));
logbrush.lbStyle = BS_HOLLOW;
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 */
+ 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;
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);
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);
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))
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSTATUSBAR, MF_CHECKED | MF_BYCOMMAND);
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);
- 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_VIEWSHOWGRID,
+ showGrid ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
+ CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWMINIATURE,
+ showMiniature ? (MF_CHECKED | MF_BYCOMMAND) : (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)
- {
- int test[] = {LOWORD(lParam)-260, LOWORD(lParam)-140, LOWORD(lParam)-20};
+ if (hwnd == hMainWnd)
+ {
+ 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,
- 0, 3, 3, TRUE);
- MoveWindow(hSizeboxRightTop,
- imgXRes*zoom/1000+3,
- 0, 3, 3, TRUE);
- MoveWindow(hSizeboxLeftCenter,
- 0,
- imgYRes*zoom/2000+3*3/4, 3, 3, TRUE);
- MoveWindow(hSizeboxRightCenter,
- imgXRes*zoom/1000+3,
- imgYRes*zoom/2000+3*3/4, 3, 3, TRUE);
- MoveWindow(hSizeboxLeftBottom,
- 0,
- imgYRes*zoom/1000+3, 3, 3, TRUE);
- MoveWindow(hSizeboxCenterBottom,
- 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);
+ MoveWindow(hSizeboxLeftTop,
+ 0,
+ 0, 3, 3, TRUE);
+ MoveWindow(hSizeboxCenterTop,
+ imgXRes * zoom / 2000 + 3 * 3 / 4,
+ 0, 3, 3, TRUE);
+ MoveWindow(hSizeboxRightTop,
+ imgXRes * zoom / 1000 + 3,
+ 0, 3, 3, TRUE);
+ MoveWindow(hSizeboxLeftCenter,
+ 0,
+ imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
+ MoveWindow(hSizeboxRightCenter,
+ imgXRes * zoom / 1000 + 3,
+ imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
+ MoveWindow(hSizeboxLeftBottom,
+ 0,
+ imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
+ MoveWindow(hSizeboxCenterBottom,
+ 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);
}
- 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);
- MoveWindow(hScrlClient,
- -GetScrollPos(hScrollbox, SB_HORZ), -GetScrollPos(hScrollbox, SB_VERT),
- max(clientRectImageArea[2]+6, clientRectScrollbox[2]), max(clientRectImageArea[3]+6, clientRectScrollbox[3]), 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);
}
break;
+
case WM_HSCROLL:
- if (hwnd==hScrollbox)
+ if (hwnd == hScrollbox)
{
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
break;
}
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);
+ MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
+ -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);
break;
}
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);
+ MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
+ -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;
-
- // mouse events used for drawing
-
+ break;
+
+ // mouse events used for drawing
+
case WM_SETCURSOR:
- if (hwnd==hImageArea)
+ if (hwnd == hImageArea)
{
switch (activeTool)
{
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 ((!drawing)||(activeTool==5))
+ if (hwnd == hImageArea)
+ {
+ 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;
+ break;
+
case WM_RBUTTONDOWN:
- if (hwnd==hImageArea)
- {
- if ((!drawing)||(activeTool==5))
+ if (hwnd == hImageArea)
+ {
+ 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;
+ 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)
{
SendMessage(hImageArea, WM_PAINT, 0, 0);
drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam));
}
-
+
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hImageArea;
}
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(""));
- if (activeTool == 6)
- SendMessage(hImageArea, WM_PAINT, 0, 0);
- }
+ SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) _T(""));
+ if (activeTool == 6)
+ SendMessage(hImageArea, WM_PAINT, 0, 0);
break;
-
+
// menu and button events
-
+
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDM_HELPINFO:
- {
- HICON paintIcon = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
- TCHAR infotitle[100];
- TCHAR infotext[200];
- LoadString(hProgInstance, IDS_INFOTITLE, infotitle, SIZEOF(infotitle));
- LoadString(hProgInstance, IDS_INFOTEXT, infotext, SIZEOF(infotext));
- ShellAbout(hMainWnd, infotitle, infotext, paintIcon);
- DeleteObject(paintIcon);
- }
+ {
+ HICON paintIcon = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
+ TCHAR infotitle[100];
+ TCHAR infotext[200];
+ LoadString(hProgInstance, IDS_INFOTITLE, infotitle, SIZEOF(infotitle));
+ 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;
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];
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));
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);
}
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);
}
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))
}
break;
case IDM_IMAGEINVERTCOLORS:
- {
- RECT tempRect;
- newReversible();
- SetRect(&tempRect, 0, 0, imgXRes, imgYRes);
- InvertRect(hDrawingDC, &tempRect);
- SendMessage(hImageArea, WM_PAINT, 0, 0);
- }
- break;
+ {
+ RECT tempRect;
+ newReversible();
+ 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);
{
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;
}
break;
case IDM_IMAGEATTRIBUTES:
+ {
+ int retVal = attributesDlg();
+ if ((LOWORD(retVal) != 0) && (HIWORD(retVal) != 0))
{
- int retVal = attributesDlg();
- if ((LOWORD(retVal)!=0)&&(HIWORD(retVal)!=0))
- {
- cropReversible(LOWORD(retVal), HIWORD(retVal), 0, 0);
- updateCanvasAndScrollbars();
- }
+ cropReversible(LOWORD(retVal), HIWORD(retVal), 0, 0);
+ updateCanvasAndScrollbars();
}
break;
+ }
case IDM_IMAGECHANGESIZE:
+ {
+ int retVal = changeSizeDlg();
+ if ((LOWORD(retVal) != 0) && (HIWORD(retVal) != 0))
{
- int retVal = changeSizeDlg();
- if ((LOWORD(retVal)!=0)&&(HIWORD(retVal)!=0))
- {
- insertReversible(CopyImage(hBms[currInd], IMAGE_BITMAP, imgXRes*LOWORD(retVal)/100, imgYRes*HIWORD(retVal)/100, 0));
- updateCanvasAndScrollbars();
- }
+ 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:
insertReversible(CopyImage(hSelBm, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG));
updateCanvasAndScrollbars();
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:
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:
zoomTo(125, 0, 0);
break;
break;
case ID_FREESEL:
selectTool(1);
- break;
+ break;
case ID_RECTSEL:
selectTool(2);
- break;
+ break;
case ID_RUBBER:
selectTool(3);
- break;
+ break;
case ID_FILL:
selectTool(4);
- break;
+ break;
case ID_COLOR:
selectTool(5);
- break;
+ break;
case ID_ZOOM:
selectTool(6);
- break;
+ break;
case ID_PEN:
selectTool(7);
- break;
+ break;
case ID_BRUSH:
selectTool(8);
- break;
+ break;
case ID_AIRBRUSH:
selectTool(9);
- break;
+ break;
case ID_TEXT:
selectTool(10);
- break;
+ break;
case ID_LINE:
selectTool(11);
- break;
+ break;
case ID_BEZIER:
selectTool(12);
- break;
+ break;
case ID_RECT:
selectTool(13);
- break;
+ break;
case ID_SHAPE:
selectTool(14);
- break;
+ break;
case ID_ELLIPSE:
selectTool(15);
- break;
+ break;
case ID_RRECT:
selectTool(16);
break;
}
break;
default:
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
-
/*
* 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);