From 27e2be0d83c949bc7fa5af3e3db35b9959b4879a Mon Sep 17 00:00:00 2001 From: Robert Dickenson Date: Thu, 29 Aug 2002 20:28:13 +0000 Subject: [PATCH] Added start of utility application zoomin. svn path=/trunk/; revision=3437 --- rosapps/devutils/zoomin/.cvsignore | 11 ++ rosapps/devutils/zoomin/framewnd.c | 100 ++++++++++++++++++ rosapps/devutils/zoomin/framewnd.h | 39 +++++++ rosapps/devutils/zoomin/main.c | 132 ++++++++++++++++++++++++ rosapps/devutils/zoomin/main.h | 52 ++++++++++ rosapps/devutils/zoomin/makefile | 53 ++++++++++ rosapps/devutils/zoomin/res/small.ico | Bin 0 -> 318 bytes rosapps/devutils/zoomin/res/zoomin.ico | Bin 0 -> 1078 bytes rosapps/devutils/zoomin/resource.h | 21 ++++ rosapps/devutils/zoomin/zoomin.rc | 135 +++++++++++++++++++++++++ 10 files changed, 543 insertions(+) create mode 100644 rosapps/devutils/zoomin/.cvsignore create mode 100644 rosapps/devutils/zoomin/framewnd.c create mode 100644 rosapps/devutils/zoomin/framewnd.h create mode 100644 rosapps/devutils/zoomin/main.c create mode 100644 rosapps/devutils/zoomin/main.h create mode 100644 rosapps/devutils/zoomin/makefile create mode 100644 rosapps/devutils/zoomin/res/small.ico create mode 100644 rosapps/devutils/zoomin/res/zoomin.ico create mode 100644 rosapps/devutils/zoomin/resource.h create mode 100644 rosapps/devutils/zoomin/zoomin.rc diff --git a/rosapps/devutils/zoomin/.cvsignore b/rosapps/devutils/zoomin/.cvsignore new file mode 100644 index 00000000000..9971cc0b355 --- /dev/null +++ b/rosapps/devutils/zoomin/.cvsignore @@ -0,0 +1,11 @@ +*.exe +*.o +*.coff +*.dsp +*.dsw +*.aps +*.ncb +*.opt +*.sym +*.plg +*.bak diff --git a/rosapps/devutils/zoomin/framewnd.c b/rosapps/devutils/zoomin/framewnd.c new file mode 100644 index 00000000000..257ba58b5dd --- /dev/null +++ b/rosapps/devutils/zoomin/framewnd.c @@ -0,0 +1,100 @@ +/* + * ReactOS zoomin + * + * framewnd.c + * + * Copyright (C) 2002 Robert Dickenson + * + * 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. + * + * 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 +#include +#include + +#include "main.h" +#include "framewnd.h" + + +//////////////////////////////////////////////////////////////////////////////// +// Global and Local Variables: +// + + +//////////////////////////////////////////////////////////////////////////////// +// Local module support methods +// + + +//////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) +// +// 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; + } + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION: FrameWndProc(HWND, unsigned, WORD, LONG) +// +// PURPOSE: Processes messages for the main frame 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); + } + break; + case WM_SIZE: + break; + case WM_TIMER: + break; + case WM_DESTROY: + PostQuitMessage(0); + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + diff --git a/rosapps/devutils/zoomin/framewnd.h b/rosapps/devutils/zoomin/framewnd.h new file mode 100644 index 00000000000..813a90c1f79 --- /dev/null +++ b/rosapps/devutils/zoomin/framewnd.h @@ -0,0 +1,39 @@ +/* + * ReactOS zoomin + * + * framewnd.h + * + * Copyright (C) 2002 Robert Dickenson + * + * 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. + * + * 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. + */ + +#ifndef __FRAMEWND_H__ +#define __FRAMEWND_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM); + + +#ifdef __cplusplus +}; +#endif + +#endif // __FRAMEWND_H__ + diff --git a/rosapps/devutils/zoomin/main.c b/rosapps/devutils/zoomin/main.c new file mode 100644 index 00000000000..fb795a04675 --- /dev/null +++ b/rosapps/devutils/zoomin/main.c @@ -0,0 +1,132 @@ +/* + * ReactOS zoomin + * + * main.c + * + * Copyright (C) 2002 Robert Dickenson + * + * 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. + * + * 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 +#include +#include +#include +#include + +#include "main.h" +#include "framewnd.h" + + +//////////////////////////////////////////////////////////////////////////////// +// Global Variables: +// + +HINSTANCE hInst; +HWND hFrameWnd; +HMENU hMenuFrame; + +TCHAR szTitle[MAX_LOADSTRING]; +TCHAR szFrameClass[MAX_LOADSTRING]; + + +//////////////////////////////////////////////////////////////////////////////// +// +// +// FUNCTION: InitInstance(HANDLE, int) +// +// PURPOSE: Saves instance handle and 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) +{ + WNDCLASSEX wcFrame = { + sizeof(WNDCLASSEX), + CS_HREDRAW | CS_VREDRAW/*style*/, + FrameWndProc, + 0/*cbClsExtra*/, + 0/*cbWndExtra*/, + hInstance, + LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN)), + LoadCursor(0, IDC_ARROW), + 0/*hbrBackground*/, + 0/*lpszMenuName*/, + szFrameClass, + (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_ZOOMIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED) + }; + ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class + + hMenuFrame = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_ZOOMIN_MENU)); + + hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle, + WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, hMenuFrame, hInstance, NULL/*lpParam*/); + + if (!hFrameWnd) { + return FALSE; + } + + ShowWindow(hFrameWnd, nCmdShow); + UpdateWindow(hFrameWnd); + return TRUE; +} + +//////////////////////////////////////////////////////////////////////////////// + +void ExitInstance(void) +{ + DestroyMenu(hMenuFrame); +} + + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + HACCEL hAccel; + + // Initialize global strings + 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: + while (GetMessage(&msg, (HWND)NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + ExitInstance(); + return msg.wParam; +} + diff --git a/rosapps/devutils/zoomin/main.h b/rosapps/devutils/zoomin/main.h new file mode 100644 index 00000000000..1d8264a1b10 --- /dev/null +++ b/rosapps/devutils/zoomin/main.h @@ -0,0 +1,52 @@ +/* + * ReactOS zoomin + * + * main.h + * + * Copyright (C) 2002 Robert Dickenson + * + * 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. + * + * 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. + */ + +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "resource.h" + +#define MAX_LOADSTRING 100 +#define MAX_NAME_LEN 500 + + +//////////////////////////////////////////////////////////////////////////////// +// Global Variables: +// +extern HINSTANCE hInst; +extern HWND hFrameWnd; +extern HMENU hMenuFrame; + +extern TCHAR szTitle[]; +extern TCHAR szFrameClass[]; + +#ifdef __cplusplus +}; +#endif + +#endif // __MAIN_H__ + diff --git a/rosapps/devutils/zoomin/makefile b/rosapps/devutils/zoomin/makefile new file mode 100644 index 00000000000..df99d1bad78 --- /dev/null +++ b/rosapps/devutils/zoomin/makefile @@ -0,0 +1,53 @@ +# +# ReactOS zoomin +# +# Makefile +# +# Copyright (C) 2002 Robert Dickenson +# +# 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. +# +# 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. +# + +PATH_TO_TOP = ../.. + +TARGET = zoomin + +OBJS = framewnd.o \ + main.o + +LIBS = -lkernel32 -lgdi32 -luser32 + +all: $(TARGET).exe + +$(TARGET).res: $(TARGET).rc + +$(TARGET).exe: $(OBJS) $(TARGET).coff + $(CC) -Wl,--subsystem,windows -o $(TARGET).exe $(OBJS) $(TARGET).coff $(LIBS) + $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym + + +main.h: resource.h + +main.o: main.c main.h framewnd.h + +framewnd.o: framewnd.c framewnd.h main.h + +clean: + - $(RM) $(OBJS) + - $(RM) $(TARGET).exe + - $(RM) $(TARGET).sym + - $(RM) $(TARGET).coff + +include $(PATH_TO_TOP)/rules.mak diff --git a/rosapps/devutils/zoomin/res/small.ico b/rosapps/devutils/zoomin/res/small.ico new file mode 100644 index 0000000000000000000000000000000000000000..8f94d9aa8285725af1920f17fa4ba90a7dad97fc GIT binary patch literal 318 zcmbu1u@S&92m|H2^tei$GGj6tBe4N_?3C#ONWzj2Y0z^{b=^ZcTR}S)7&>4n7JrdT ujNG@ttiTl!1hqz0y#czdCNotgVrj}ml}kwpjQ>_(PRDWOZgV)&%Zp6VccBVa2?uQ&sh9LW;!?J w2dwKn!S@jnH5GJS10MR3&V{nkc?%F^XS#jrb=7ItXV>BJ*yg?&H~)SR4}%AClK=n! literal 0 HcmV?d00001 diff --git a/rosapps/devutils/zoomin/resource.h b/rosapps/devutils/zoomin/resource.h new file mode 100644 index 00000000000..5008122271c --- /dev/null +++ b/rosapps/devutils/zoomin/resource.h @@ -0,0 +1,21 @@ +#define ID_ZOOMIN_MENU 0 +#define ID_FILE_MENU 1 +#define ID_OPTIONS_MENU 2 +#define ID_HELP_MENU 3 + +#define IDD_ABOUTBOX 103 +#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 ID_EDIT_EXIT 32700 +#define ID_EDIT_COPY 32701 +#define ID_EDIT_REFRESH 32702 +#define ID_OPTIONS_REFRESH_RATE 32704 +#define ID_HELP_ABOUT 32703 + +#define IDC_STATIC -1 + diff --git a/rosapps/devutils/zoomin/zoomin.rc b/rosapps/devutils/zoomin/zoomin.rc new file mode 100644 index 00000000000..757bc26d1c7 --- /dev/null +++ b/rosapps/devutils/zoomin/zoomin.rc @@ -0,0 +1,135 @@ +#include +#include + +#include "resource.h" + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// 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" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_ZOOMIN_MENU MENU DISCARDABLE +BEGIN + 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 + END + POPUP "&Options" + BEGIN + MENUITEM "&Refresh Rate...", ID_OPTIONS_REFRESH_RATE, GRAYED + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", ID_HELP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_ZOOMIN,IDI_ZOOMIN,14,9,16,16 + LTEXT "ReactOS zoomin Version 1.0",IDC_STATIC,49,10,119,8, + SS_NOPREFIX + LTEXT "Copyright (C) 2002 ReactOS Team",IDC_STATIC,49,20,119,8 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD + PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0" + VALUE "CompanyName", RES_STR_COMPANY_NAME + VALUE "FileDescription", "ReactOS Zoomin by Robert Dickenson\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "zoomin\0" + VALUE "LegalCopyright", "Copyright © 2002 Robert Dickenson\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "zoomin.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", RES_STR_PRODUCT_NAME + VALUE "ProductVersion", RES_STR_PRODUCT_VERSION + VALUE "SpecialBuild", "Non-versioned Development Beta Release\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0xc09, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,129,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "ReactOS Zoomin" + IDC_ZOOMIN "ZOOMIN" +END + + -- 2.17.1