zoomin: - allow to cange zoom factor and display zoom factor - add accelerator table Modified: trunk/rosapps/devutils/zoomin/framewnd.c Modified: trunk/rosapps/devutils/zoomin/framewnd.h Modified: trunk/rosapps/devutils/zoomin/main.c Modified: trunk/rosapps/devutils/zoomin/main.h Modified: trunk/rosapps/devutils/zoomin/resource.h Modified: trunk/rosapps/devutils/zoomin/zoomin.rc _____
Modified: trunk/rosapps/devutils/zoomin/framewnd.c --- trunk/rosapps/devutils/zoomin/framewnd.c 2005-10-12 19:15:54 UTC (rev 18414) +++ trunk/rosapps/devutils/zoomin/framewnd.c 2005-10-12 20:20:18 UTC (rev 18415) @@ -42,11 +42,34 @@
BOOL s_dragging = FALSE;
+ // zoom range + +#define MIN_ZOOM 1 +#define MAX_ZOOM 16 + +
//////////////////////////////////////////////////////////////////////// //////// -// Local module support methods // +// FUNCTION: SetZoom() +// +// PURPOSE: Change zoom level +//
+static void SetZoom(HWND hWnd, int factor) +{ + TCHAR buffer[MAX_LOADSTRING];
+ if (factor>=MIN_ZOOM && factor<=MAX_ZOOM) { + s_factor = factor; + + SetScrollPos(hWnd, SB_VERT, s_factor, TRUE); + + wsprintf(buffer, TEXT("%s %dx"), szTitle, s_factor); + SetWindowText(hWnd, buffer); + } +} + +
//////////////////////////////////////////////////////////////////////// //////// // // FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) @@ -70,6 +93,10 @@ // TODO: break;
+ case ID_REFRESH: + InvalidateRect(hWnd, NULL, FALSE); + break; + default: return FALSE; } @@ -89,6 +116,8 @@ switch (message) { case WM_CREATE: SetTimer(hWnd, 0, 200, NULL); // refresh display all 200 ms + SetScrollRange(hWnd, SB_VERT, 1, MAX_ZOOM, FALSE); + SetZoom(hWnd, s_factor); break;
case WM_COMMAND: @@ -107,10 +136,11 @@ hdcMem = GetDC(GetDesktopWindow());
GetClientRect(hWnd, &clnt); - size.cx = clnt.right / s_factor; - size.cy = clnt.bottom / s_factor; + size.cx = (clnt.right + s_factor-1) / s_factor; + size.cy = (clnt.bottom + s_factor-1) / s_factor;
- StretchBlt(ps.hdc, 0, 0, size.cx*s_factor, size.cy*s_factor, hdcMem, s_srcPos.x, s_srcPos.y, size.cx, size.cy, SRCCOPY); + StretchBlt(ps.hdc, 0, 0, size.cx*s_factor, size.cy*s_factor, + hdcMem, s_srcPos.x, s_srcPos.y, size.cx, size.cy, SRCCOPY);
ReleaseDC(GetDesktopWindow(), hdcMem); EndPaint(hWnd, &ps); @@ -181,6 +211,20 @@ } break;
+ case WM_VSCROLL: + switch(wParam) { + case SB_LINEUP: + case SB_PAGEUP: + SetZoom(hWnd, s_factor-1); + break; + + case SB_LINEDOWN: + case SB_PAGEDOWN: + SetZoom(hWnd, s_factor+1); + break; + } + break; + case WM_DESTROY: KillTimer(hWnd, 0); PostQuitMessage(0); _____
Modified: trunk/rosapps/devutils/zoomin/framewnd.h --- trunk/rosapps/devutils/zoomin/framewnd.h 2005-10-12 19:15:54 UTC (rev 18414) +++ trunk/rosapps/devutils/zoomin/framewnd.h 2005-10-12 20:20:18 UTC (rev 18415) @@ -23,17 +23,10 @@
#ifndef __FRAMEWND_H__ #define __FRAMEWND_H__
-#ifdef __cplusplus -extern "C" { -#endif - - LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
-#ifdef __cplusplus -}; -#endif +#define WNDCLASS_ZOOMIN TEXT("ZOOMIN")
-#endif // __FRAMEWND_H__
+#endif // __FRAMEWND_H__ _____
Modified: trunk/rosapps/devutils/zoomin/main.c --- trunk/rosapps/devutils/zoomin/main.c 2005-10-12 19:15:54 UTC (rev 18414) +++ trunk/rosapps/devutils/zoomin/main.c 2005-10-12 20:20:18 UTC (rev 18415) @@ -38,7 +38,6 @@
HMENU hMenuFrame;
TCHAR szTitle[MAX_LOADSTRING]; -TCHAR szFrameClass[MAX_LOADSTRING];
//////////////////////////////////////////////////////////////////////// //////// @@ -61,7 +60,7 @@ LoadCursor(0, IDC_ARROW), 0,//(HBRUSH)(COLOR_BTNFACE+1), 0/*lpszMenuName*/, - szFrameClass, + WNDCLASS_ZOOMIN, (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) }; @@ -70,7 +69,7 @@ hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_ZOOMIN_MENU));
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle, - WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, + WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, 250, 250, NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
@@ -80,6 +79,7 @@
ShowWindow(hFrameWnd, nCmdShow); UpdateWindow(hFrameWnd); + return TRUE; }
@@ -97,22 +97,21 @@ int nCmdShow) { MSG msg; - HACCEL hAccel; + HACCEL hAccel;
// Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); - LoadString(hInstance, IDC_ZOOMIN, szFrameClass, MAX_LOADSTRING);
// Perform application initialization: if (!InitInstance(hInstance, nCmdShow)) { return FALSE; }
- hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_ZOOMIN); + hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ZOOMIN));
// Main message loop: while (GetMessage(&msg, (HWND)NULL, 0, 0)) { - if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) { + if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } _____
Modified: trunk/rosapps/devutils/zoomin/main.h --- trunk/rosapps/devutils/zoomin/main.h 2005-10-12 19:15:54 UTC (rev 18414) +++ trunk/rosapps/devutils/zoomin/main.h 2005-10-12 20:20:18 UTC (rev 18415) @@ -23,11 +23,6 @@
#ifndef __MAIN_H__ #define __MAIN_H__
-#ifdef __cplusplus -extern "C" { -#endif - - #include "resource.h"
#define MAX_LOADSTRING 100 @@ -40,11 +35,6 @@ extern HMENU hMenuFrame;
extern TCHAR szTitle[]; -extern TCHAR szFrameClass[];
-#ifdef __cplusplus -}; -#endif
#endif // __MAIN_H__ - _____
Modified: trunk/rosapps/devutils/zoomin/resource.h --- trunk/rosapps/devutils/zoomin/resource.h 2005-10-12 19:15:54 UTC (rev 18414) +++ trunk/rosapps/devutils/zoomin/resource.h 2005-10-12 20:20:18 UTC (rev 18415) @@ -7,9 +7,8 @@
#define IDS_APP_TITLE 103 #define IDI_ZOOMIN 107 #define IDI_SMALL 108 -#define IDC_ZOOMIN 109 -#define IDR_ZOOMIN_MENU 110 -#define IDD_DIALOG1 111 +#define IDR_ZOOMIN_MENU 109 +#define IDR_ZOOMIN 110
#define ID_EDIT_EXIT 32700 #define ID_EDIT_COPY 32701 @@ -17,5 +16,7 @@ #define ID_OPTIONS_REFRESH_RATE 32704 #define ID_HELP_ABOUT 32703
+#define ID_REFRESH 40001 + #define IDC_STATIC -1
_____
Modified: trunk/rosapps/devutils/zoomin/zoomin.rc --- trunk/rosapps/devutils/zoomin/zoomin.rc 2005-10-12 19:15:54 UTC (rev 18414) +++ trunk/rosapps/devutils/zoomin/zoomin.rc 2005-10-12 20:20:18 UTC (rev 18415) @@ -31,12 +31,14 @@
IDR_ZOOMIN_MENU MENU DISCARDABLE BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit\tAlt-F4", ID_EDIT_EXIT + END POPUP "&Edit" BEGIN MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY, GRAYED - MENUITEM "&Refresh\tF5", ID_EDIT_REFRESH, GRAYED - MENUITEM SEPARATOR - MENUITEM "E&xit\tAlt-F4", ID_EDIT_EXIT + MENUITEM "&Refresh\tF5", ID_EDIT_REFRESH END POPUP "&Options" BEGIN @@ -69,26 +71,21 @@
//////////////////////////////////////////////////////////////////////// ///// // -// Dialog +// String Table //
-IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" +STRINGTABLE DISCARDABLE BEGIN - DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 + IDS_APP_TITLE "ReactOS Zoomin" END
//////////////////////////////////////////////////////////////////////// ///// // -// String Table +// Accelerator //
-STRINGTABLE DISCARDABLE +IDR_ZOOMIN ACCELERATORS DISCARDABLE BEGIN - IDS_APP_TITLE "ReactOS Zoomin" - IDC_ZOOMIN "ZOOMIN" + VK_F5, ID_REFRESH, VIRTKEY, NOINVERT END