Added start of utility application zoomin.

svn path=/trunk/; revision=3437
This commit is contained in:
Robert Dickenson 2002-08-29 20:28:13 +00:00
parent d173db00ea
commit 27e2be0d83
10 changed files with 543 additions and 0 deletions

View file

@ -0,0 +1,11 @@
*.exe
*.o
*.coff
*.dsp
*.dsw
*.aps
*.ncb
*.opt
*.sym
*.plg
*.bak

View file

@ -0,0 +1,100 @@
/*
* ReactOS zoomin
*
* framewnd.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* 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 <windows.h>
#include <tchar.h>
#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;
}

View file

@ -0,0 +1,39 @@
/*
* ReactOS zoomin
*
* framewnd.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* 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__

View file

@ -0,0 +1,132 @@
/*
* ReactOS zoomin
*
* main.c
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* 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 <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#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;
}

View file

@ -0,0 +1,52 @@
/*
* ReactOS zoomin
*
* main.h
*
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
*
* 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__

View file

@ -0,0 +1,53 @@
#
# ReactOS zoomin
#
# Makefile
#
# Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
#
# 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -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

View file

@ -0,0 +1,135 @@
#include <defines.h>
#include <reactos/resource.h>
#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