switch (message)
{
case WM_INITDIALOG:
- CheckDlgButton(hwnd, IDD_ATTRIBUTESRB3, BST_CHECKED);
- CheckDlgButton(hwnd, IDD_ATTRIBUTESRB5, BST_CHECKED);
- SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT1, imgXRes, FALSE);
- SetDlgItemInt(hwnd, IDD_ATTRIBUTESEDIT2, imgYRes, FALSE);
- TCHAR strrc[100];
- 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);
+ 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 res[100];
- 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;
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);
- int x, y, w, h;
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;
SendMessage(hScrollbox, WM_HSCROLL, SB_THUMBPOSITION | (x << 16), 0);
SendMessage(hScrollbox, WM_VSCROLL, SB_THUMBPOSITION | (y << 16), 0);
- int tbPos = 0;
- int tempZoom = newZoom;
while (tempZoom>125)
{
tbPos++;
void drawZoomFrame(int mouseX, int mouseY)
{
+ HDC hdc;
+ HPEN oldPen;
+ HBRUSH oldBrush;
+ LOGBRUSH logbrush;
+ int rop;
+
long clientRectScrollbox[4];
long clientRectImageArea[4];
+ int x, y, w, h;
GetClientRect(hScrollbox, (LPRECT)&clientRectScrollbox);
GetClientRect(hImageArea, (LPRECT)&clientRectImageArea);
- int x, y, w, h;
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 hdc;
+
hdc = GetDC(hImageArea);
- HPEN oldPen;
oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 0, 0));
- HBRUSH oldBrush;
- LOGBRUSH logbrush;
logbrush.lbStyle = BS_HOLLOW;
oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush));
- int rop;
rop = SetROP2(hdc, R2_NOT);
Rectangle(hdc, x, y, x + w, y + h);
SetROP2(hdc, rop);
{
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);
drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam));
}
- TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hImageArea;