Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensizebox.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: PAINT for ReactOS 00003 * LICENSE: LGPL 00004 * FILE: sizebox.c 00005 * PURPOSE: Window procedure of the size boxes 00006 * PROGRAMMERS: Benedikt Freisen 00007 */ 00008 00009 /* INCLUDES *********************************************************/ 00010 00011 #include "precomp.h" 00012 00013 /* FUNCTIONS ********************************************************/ 00014 00015 BOOL resizing = FALSE; 00016 short xOrig; 00017 short yOrig; 00018 00019 LRESULT CALLBACK 00020 SizeboxWinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 00021 { 00022 switch (message) 00023 { 00024 case WM_SETCURSOR: 00025 if ((hwnd == hSizeboxLeftTop) || (hwnd == hSizeboxRightBottom)) 00026 SetCursor(LoadCursor(NULL, IDC_SIZENWSE)); 00027 if ((hwnd == hSizeboxLeftBottom) || (hwnd == hSizeboxRightTop)) 00028 SetCursor(LoadCursor(NULL, IDC_SIZENESW)); 00029 if ((hwnd == hSizeboxLeftCenter) || (hwnd == hSizeboxRightCenter)) 00030 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); 00031 if ((hwnd == hSizeboxCenterTop) || (hwnd == hSizeboxCenterBottom)) 00032 SetCursor(LoadCursor(NULL, IDC_SIZENS)); 00033 break; 00034 case WM_LBUTTONDOWN: 00035 resizing = TRUE; 00036 xOrig = LOWORD(lParam); 00037 yOrig = HIWORD(lParam); 00038 SetCapture(hwnd); 00039 break; 00040 case WM_MOUSEMOVE: 00041 if (resizing) 00042 { 00043 TCHAR sizeStr[100]; 00044 short xRel; 00045 short yRel; 00046 xRel = ((short)LOWORD(lParam) - xOrig) * 1000 / zoom; 00047 yRel = ((short)HIWORD(lParam) - yOrig) * 1000 / zoom; 00048 if (hwnd == hSizeboxLeftTop) 00049 _stprintf(sizeStr, _T("%d x %d"), imgXRes - xRel, imgYRes - yRel); 00050 if (hwnd == hSizeboxCenterTop) 00051 _stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes - yRel); 00052 if (hwnd == hSizeboxRightTop) 00053 _stprintf(sizeStr, _T("%d x %d"), imgXRes + xRel, imgYRes - yRel); 00054 if (hwnd == hSizeboxLeftCenter) 00055 _stprintf(sizeStr, _T("%d x %d"), imgXRes - xRel, imgYRes); 00056 if (hwnd == hSizeboxRightCenter) 00057 _stprintf(sizeStr, _T("%d x %d"), imgXRes + xRel, imgYRes); 00058 if (hwnd == hSizeboxLeftBottom) 00059 _stprintf(sizeStr, _T("%d x %d"), imgXRes - xRel, imgYRes + yRel); 00060 if (hwnd == hSizeboxCenterBottom) 00061 _stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes + yRel); 00062 if (hwnd == hSizeboxRightBottom) 00063 _stprintf(sizeStr, _T("%d x %d"), imgXRes + xRel, imgYRes + yRel); 00064 SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr); 00065 } 00066 break; 00067 case WM_LBUTTONUP: 00068 if (resizing) 00069 { 00070 short xRel; 00071 short yRel; 00072 ReleaseCapture(); 00073 resizing = FALSE; 00074 xRel = ((short)LOWORD(lParam) - xOrig) * 1000 / zoom; 00075 yRel = ((short)HIWORD(lParam) - yOrig) * 1000 / zoom; 00076 if (hwnd == hSizeboxLeftTop) 00077 cropReversible(imgXRes - xRel, imgYRes - yRel, xRel, yRel); 00078 if (hwnd == hSizeboxCenterTop) 00079 cropReversible(imgXRes, imgYRes - yRel, 0, yRel); 00080 if (hwnd == hSizeboxRightTop) 00081 cropReversible(imgXRes + xRel, imgYRes - yRel, 0, yRel); 00082 if (hwnd == hSizeboxLeftCenter) 00083 cropReversible(imgXRes - xRel, imgYRes, xRel, 0); 00084 if (hwnd == hSizeboxRightCenter) 00085 cropReversible(imgXRes + xRel, imgYRes, 0, 0); 00086 if (hwnd == hSizeboxLeftBottom) 00087 cropReversible(imgXRes - xRel, imgYRes + yRel, xRel, 0); 00088 if (hwnd == hSizeboxCenterBottom) 00089 cropReversible(imgXRes, imgYRes + yRel, 0, 0); 00090 if (hwnd == hSizeboxRightBottom) 00091 cropReversible(imgXRes + xRel, imgYRes + yRel, 0, 0); 00092 SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) _T("")); 00093 } 00094 break; 00095 00096 default: 00097 return DefWindowProc(hwnd, message, wParam, lParam); 00098 } 00099 00100 return 0; 00101 } Generated on Fri May 25 2012 04:15:26 for ReactOS by
1.7.6.1
|