basic implementation of zoomin functionality Modified: trunk/rosapps/devutils/zoomin/framewnd.c Modified: trunk/rosapps/devutils/zoomin/main.c Modified: trunk/rosapps/devutils/zoomin/main.h Deleted: trunk/rosapps/devutils/zoomin/res/small.ico Modified: trunk/rosapps/devutils/zoomin/zoomin.rc Property changes on: trunk/rosapps/devutils/zoomin ___________________________________________________________________ Name: svn:ignore - *.exe *.o *.coff *.dsp *.dsw *.aps *.ncb *.opt *.sym *.plg *.bak *.map *.a + *.exe *.o *.coff *.dsp *.dsw *.aps *.ncb *.opt *.sym *.plg *.bak *.map *.a Debug Release _____
Modified: trunk/rosapps/devutils/zoomin/framewnd.c --- trunk/rosapps/devutils/zoomin/framewnd.c 2005-10-08 19:24:54 UTC (rev 18354) +++ trunk/rosapps/devutils/zoomin/framewnd.c 2005-10-08 19:29:20 UTC (rev 18355) @@ -1,27 +1,29 @@
/* - * ReactOS zoomin + * ReactOS zoomin * - * framewnd.c + * framewnd.c * - * Copyright (C) 2002 Robert Dickenson robd@reactos.org + * Copyright (C) 2002 Robert Dickenson robd@reactos.org + * Copyright (C) 2005 Martin Fuchs martin-fuchs@gmx.net * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <windows.h> +#include <windowsx.h> #include <tchar.h>
#include "main.h" @@ -29,10 +31,14 @@
//////////////////////////////////////////////////////////////////////// //////// -// Global and Local Variables: +// Global Variables: //
+static int s_factor = 2; // zoom factor
+static POINT s_srcPos = {0, 0}; // zoom factor + +
//////////////////////////////////////////////////////////////////////// //////// // Local module support methods // @@ -40,61 +46,117 @@
//////////////////////////////////////////////////////////////////////// //////// // -// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) +// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) // -// PURPOSE: Processes WM_COMMAND messages for the main frame window. +// PURPOSE: Processes WM_COMMAND messages for the main frame window. // //
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { - // Parse the menu selections: - case ID_EDIT_EXIT: - DestroyWindow(hWnd); - break; - case ID_EDIT_COPY: - case ID_EDIT_REFRESH: - case ID_OPTIONS_REFRESH_RATE: - case ID_HELP_ABOUT: - // TODO: - break; - default: - return FALSE; - } + // Parse the menu selections: + case ID_EDIT_EXIT: + DestroyWindow(hWnd); + break; + + case ID_EDIT_COPY: + case ID_EDIT_REFRESH: + case ID_OPTIONS_REFRESH_RATE: + case ID_HELP_ABOUT: + // TODO: + break; + + default: + return FALSE; + } + return TRUE; }
//////////////////////////////////////////////////////////////////////// //////// // -// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG) +// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG) // -// PURPOSE: Processes messages for the main frame window. +// PURPOSE: Processes messages for the main window. // -// WM_COMMAND - process the application menu -// WM_DESTROY - post a quit message and return -// -//
LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - switch (message) { - case WM_CREATE: - break; - case WM_COMMAND: - if (!_CmdWndProc(hWnd, message, wParam, lParam)) { - return DefWindowProc(hWnd, message, wParam, lParam); - } + switch (message) { + case WM_CREATE: + SetTimer(hWnd, 0, 200, NULL); // refresh display all 200 ms break; - case WM_SIZE: - break; - case WM_TIMER: - break; - case WM_DESTROY: - PostQuitMessage(0); - default: - return DefWindowProc(hWnd, message, wParam, lParam); + + case WM_COMMAND: + if (!_CmdWndProc(hWnd, message, wParam, lParam)) { + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + + case WM_PAINT: { + PAINTSTRUCT ps; + HDC hdcMem; + RECT rect; + SIZE size; + + BeginPaint(hWnd, &ps); + hdcMem = GetDC(GetDesktopWindow()); + + GetClientRect(hWnd, &rect); + size.cx = rect.right / s_factor; + size.cy = rect.bottom / 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); + + ReleaseDC(GetDesktopWindow(), hdcMem); + EndPaint(hWnd, &ps); + break;} + + case WM_TIMER: + if (GetCapture() == hWnd) { + RECT rect; + + int width = GetSystemMetrics(SM_CXSCREEN); + int height = GetSystemMetrics(SM_CYSCREEN); + + GetClientRect(hWnd, &rect); + + GetCursorPos(&s_srcPos); + + s_srcPos.x -= rect.right / s_factor / 2; + s_srcPos.y -= rect.bottom / s_factor / 2; + + if (s_srcPos.x < 0) + s_srcPos.x = 0; + else if (s_srcPos.x+rect.right/s_factor > width) + s_srcPos.x = width - rect.right/s_factor; + + if (s_srcPos.y < 0) + s_srcPos.y = 0; + else if (s_srcPos.y+rect.bottom/s_factor > height) + s_srcPos.y = height - rect.bottom/s_factor; + } + + InvalidateRect(hWnd, NULL, FALSE); + break; + + case WM_LBUTTONDOWN: + SetCapture(hWnd); + break; + + case WM_LBUTTONUP: + ReleaseCapture(); + break; + + case WM_DESTROY: + KillTimer(hWnd, 0); + PostQuitMessage(0); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); } + return 0; } - _____
Modified: trunk/rosapps/devutils/zoomin/main.c --- trunk/rosapps/devutils/zoomin/main.c 2005-10-08 19:24:54 UTC (rev 18354) +++ trunk/rosapps/devutils/zoomin/main.c 2005-10-08 19:29:20 UTC (rev 18355) @@ -34,7 +34,6 @@
// Global Variables: //
-HINSTANCE hInst; HWND hFrameWnd; HMENU hMenuFrame;
@@ -44,16 +43,10 @@
//////////////////////////////////////////////////////////////////////// //////// // -// // FUNCTION: InitInstance(HANDLE, int) // -// PURPOSE: Saves instance handle and creates main window +// PURPOSE: creates main window // -// COMMENTS: -// -// In this function, we save the instance handle in a global variable and -// create and display the main program window. -//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { @@ -66,7 +59,7 @@ hInstance, LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN)), LoadCursor(0, IDC_ARROW), - 0/*hbrBackground*/, + 0,//(HBRUSH)(COLOR_BTNFACE+1), 0/*lpszMenuName*/, szFrameClass, (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN), IMAGE_ICON, @@ -78,7 +71,7 @@
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle, WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, 250, 250, NULL, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) { @@ -110,13 +103,11 @@ LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_ZOOMIN, szFrameClass, MAX_LOADSTRING);
- // Store instance handle in our global variable - hInst = hInstance; - // Perform application initialization: if (!InitInstance(hInstance, nCmdShow)) { return FALSE; } + hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_ZOOMIN);
// Main message loop: @@ -129,4 +120,3 @@ ExitInstance(); return msg.wParam; } - _____
Modified: trunk/rosapps/devutils/zoomin/main.h --- trunk/rosapps/devutils/zoomin/main.h 2005-10-08 19:24:54 UTC (rev 18354) +++ trunk/rosapps/devutils/zoomin/main.h 2005-10-08 19:29:20 UTC (rev 18355) @@ -31,13 +31,11 @@
#include "resource.h"
#define MAX_LOADSTRING 100 -#define MAX_NAME_LEN 500
//////////////////////////////////////////////////////////////////////// //////// // Global Variables: // -extern HINSTANCE hInst; extern HWND hFrameWnd; extern HMENU hMenuFrame;
_____
Deleted: trunk/rosapps/devutils/zoomin/res/small.ico (Binary files differ) _____
Modified: trunk/rosapps/devutils/zoomin/zoomin.rc --- trunk/rosapps/devutils/zoomin/zoomin.rc 2005-10-08 19:24:54 UTC (rev 18354) +++ trunk/rosapps/devutils/zoomin/zoomin.rc 2005-10-08 19:29:20 UTC (rev 18355) @@ -3,7 +3,7 @@
#include <windows.h> #include "resource.h"
-#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Zoomin by Robert Dickenson\0" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Zoomin Utility\0" #define REACTOS_STR_INTERNAL_NAME "zoomin\0" #define REACTOS_STR_ORIGINAL_FILENAME "zoomin.exe\0" #include <reactos/version.rc> @@ -17,7 +17,6 @@ // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_ZOOMIN ICON DISCARDABLE "res/zoomin.ico" -IDI_SMALL ICON DISCARDABLE "res/small.ico"
//////////////////////////////////////////////////////////////////////// ///// // @@ -93,5 +92,3 @@ IDS_APP_TITLE "ReactOS Zoomin" IDC_ZOOMIN "ZOOMIN" END - -