From dc8c16d0fc3ab5e9c57c01bebade23f2d64ac994 Mon Sep 17 00:00:00 2001 From: Robert Dickenson Date: Wed, 3 Jul 2002 17:52:20 +0000 Subject: [PATCH] Created new application - regedit. svn path=/trunk/; revision=3172 --- rosapps/regedit/Makefile | 91 ++++++++ rosapps/regedit/StdAfx.cpp | 8 + rosapps/regedit/StdAfx.h | 33 +++ rosapps/regedit/about.cpp | 71 ++++++ rosapps/regedit/about.h | 30 +++ rosapps/regedit/debug.cpp | 39 ++++ rosapps/regedit/debug.h | 28 +++ rosapps/regedit/folder1.bmp | Bin 0 -> 246 bytes rosapps/regedit/folder2.bmp | Bin 0 -> 246 bytes rosapps/regedit/folder3.bmp | Bin 0 -> 246 bytes rosapps/regedit/regedit.cpp | 447 ++++++++++++++++++++++++++++++++++++ rosapps/regedit/regedit.h | 41 ++++ rosapps/regedit/regedit.ico | Bin 0 -> 1078 bytes rosapps/regedit/regedit.rc | 305 ++++++++++++++++++++++++ rosapps/regedit/reglist.cpp | 68 ++++++ rosapps/regedit/reglist.h | 38 +++ rosapps/regedit/regtree.cpp | 208 +++++++++++++++++ rosapps/regedit/regtree.h | 38 +++ rosapps/regedit/resource.h | 104 +++++++++ rosapps/regedit/small.ico | Bin 0 -> 318 bytes 20 files changed, 1549 insertions(+) create mode 100644 rosapps/regedit/Makefile create mode 100644 rosapps/regedit/StdAfx.cpp create mode 100644 rosapps/regedit/StdAfx.h create mode 100644 rosapps/regedit/about.cpp create mode 100644 rosapps/regedit/about.h create mode 100644 rosapps/regedit/debug.cpp create mode 100644 rosapps/regedit/debug.h create mode 100644 rosapps/regedit/folder1.bmp create mode 100644 rosapps/regedit/folder2.bmp create mode 100644 rosapps/regedit/folder3.bmp create mode 100644 rosapps/regedit/regedit.cpp create mode 100644 rosapps/regedit/regedit.h create mode 100644 rosapps/regedit/regedit.ico create mode 100644 rosapps/regedit/regedit.rc create mode 100644 rosapps/regedit/reglist.cpp create mode 100644 rosapps/regedit/reglist.h create mode 100644 rosapps/regedit/regtree.cpp create mode 100644 rosapps/regedit/regtree.h create mode 100644 rosapps/regedit/resource.h create mode 100644 rosapps/regedit/small.ico diff --git a/rosapps/regedit/Makefile b/rosapps/regedit/Makefile new file mode 100644 index 00000000000..4406ff869c1 --- /dev/null +++ b/rosapps/regedit/Makefile @@ -0,0 +1,91 @@ +# +# ReactOS regedit +# +# 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 = regedit + +BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400 + +RCFLAGS = -DGCC -D_WIN32_IE=0x0400 + + +OBJS = about.o \ + debug.o \ + regtree.o \ + reglist.o \ + $(TARGET).o + +LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32 + +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 + + +about.o: about.cpp about.h resource.h + +affinity.o: affinity.cpp affinity.h + +applicationpage.o: applicationpage.cpp applicationpage.h processpage.h $(TARGET).h resource.h + +column.o: column.cpp column.h resource.h + +debug.o: debug.cpp debug.h + +endproc.o: endproc.cpp endproc.h + +font.o: font.cpp font.h + +graph.o: graph.cpp graph.h resource.h + +graphctrl.o: graphctrl.cpp graphctrl.h resource.h + +optnmenu.o: optnmenu.cpp optnmenu.h resource.h + +perfdata.o: perfdata.cpp perfdata.h + +performancepage.o: performancepage.cpp performancepage.h perfdata.h graphctrl.h graph.h $(TARGET).h resource.h + +priority.o: priority.cpp priority.h + +processpage.o: processpage.cpp processpage.h perfdata.h column.h proclist.h $(TARGET).h resource.h + +proclist.o: proclist.cpp proclist.h + +run.o: run.cpp run.h + +trayicon.o: trayicon.cpp trayicon.h resource.h + +$(TARGET).o: $(TARGET).cpp $(TARGET).h resource.h + +clean: + - $(RM) $(OBJS) + - $(RM) $(TARGET).exe + - $(RM) $(TARGET).sym + - $(RM) $(TARGET).coff + +include ../rules.mak diff --git a/rosapps/regedit/StdAfx.cpp b/rosapps/regedit/StdAfx.cpp new file mode 100644 index 00000000000..6c7578ebd58 --- /dev/null +++ b/rosapps/regedit/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// regedit.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/rosapps/regedit/StdAfx.h b/rosapps/regedit/StdAfx.h new file mode 100644 index 00000000000..d1cb567f563 --- /dev/null +++ b/rosapps/regedit/StdAfx.h @@ -0,0 +1,33 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + + +// Windows Header Files: +#include +#include + +// C RunTime Header Files +#include +#include +#include +#include + +// Local Header Files + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/rosapps/regedit/about.cpp b/rosapps/regedit/about.cpp new file mode 100644 index 00000000000..dd050daebfb --- /dev/null +++ b/rosapps/regedit/about.cpp @@ -0,0 +1,71 @@ +/* + * ReactOS About Dialog Box + * + * about.cpp + * + * 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. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "regedit.h" +#include "about.h" + + +extern HINSTANCE hInst; +//extern HWND hMainWnd; + +LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + + +void ShowAboutBox(HWND hWnd) +{ + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)AboutDialogWndProc); +} + +LRESULT CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND hLicenseEditWnd; + TCHAR strLicense[0x1000]; + + switch (message) { + case WM_INITDIALOG: + hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT); + LoadString(hInst, IDS_LICENSE, strLicense, 0x1000); + SetWindowText(hLicenseEditWnd, strLicense); + return TRUE; + case WM_COMMAND: + if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) { + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + } + return 0; +} diff --git a/rosapps/regedit/about.h b/rosapps/regedit/about.h new file mode 100644 index 00000000000..a12f2b14ae9 --- /dev/null +++ b/rosapps/regedit/about.h @@ -0,0 +1,30 @@ +/* + * ReactOS About Dialog Box + * + * about.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 __ABOUT_H__ +#define __ABOUT_H__ + + +void ShowAboutBox(HWND hWnd); + + +#endif // __ABOUT_H__ diff --git a/rosapps/regedit/debug.cpp b/rosapps/regedit/debug.cpp new file mode 100644 index 00000000000..f2bd341887a --- /dev/null +++ b/rosapps/regedit/debug.cpp @@ -0,0 +1,39 @@ +/* + * ReactOS Application Debug Routines + * + * debug.cpp + * + * 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. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "regedit.h" +#include "debug.h" + diff --git a/rosapps/regedit/debug.h b/rosapps/regedit/debug.h new file mode 100644 index 00000000000..39d1562fe74 --- /dev/null +++ b/rosapps/regedit/debug.h @@ -0,0 +1,28 @@ +/* + * ReactOS Application Debug Routines + * + * debug.cpp + * + * 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 __DEBUG_H__ +#define __DEBUG_H__ + + + +#endif // __DEBUG_H__ \ No newline at end of file diff --git a/rosapps/regedit/folder1.bmp b/rosapps/regedit/folder1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dada286b64daeafc29cbe1abb95401624b3db837 GIT binary patch literal 246 zcmZ?r{l)+RWk5;;hy|dSk%0v)(EuhP1WXRX1IhpqLqh|E0+K)`!+`?_fHX+rKNvCm z{|{mTF%W`;Kzwunlm~$y9bnM#<99U(H2nC!9R!HyL(FaX0o1gkqoef|vX!!BF8Uz}CeBTZN#PcDhHv9l;+R@R`|G&Gsx*sG4 IG#J@J0LHU(N&o-= literal 0 HcmV?d00001 diff --git a/rosapps/regedit/folder3.bmp b/rosapps/regedit/folder3.bmp new file mode 100644 index 0000000000000000000000000000000000000000..dfc3c4fb8c25a53a71e724cbd31a45969fa80e69 GIT binary patch literal 246 zcmZ{cF%Ezr6hkpOFnSC}6BcK8ujAbDABV(|d%0r!F;3W|eLz2dKkm?U5(_=Q9>U}W zJbS@LCD6d+kw&PsvY;KcfvIP8_9LweY>}jB7{$$SiK`)t$xxgT#Xpb|=Ral^ylYuU E4~Mx*tN;K2 literal 0 HcmV?d00001 diff --git a/rosapps/regedit/regedit.cpp b/rosapps/regedit/regedit.cpp new file mode 100644 index 00000000000..adc46075287 --- /dev/null +++ b/rosapps/regedit/regedit.cpp @@ -0,0 +1,447 @@ +/* + * ReactOS regedit + * + * regedit.cpp + * + * 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. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "regedit.h" +#include "regtree.h" +#include "reglist.h" +#include "resource.h" +#include +//#include + + +// Global Variables: +HINSTANCE hInst; // current instance + +HWND hMainWnd; // Main Window +HWND hStatusWnd; // Status Bar Window + +HWND hTreeWnd; // Tree Control Window +HWND hListWnd; // List Control Window +HWND hSplitWnd; // Splitter Bar Control Window + +int nMinimumWidth; // Minimum width of the dialog (OnSize()'s cx) +int nMinimumHeight; // Minimum height of the dialog (OnSize()'s cy) + +int nOldWidth; // Holds the previous client area width +int nOldHeight; // Holds the previous client area height + +BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop + +TCHAR szTitle[MAX_LOADSTRING]; // The title bar text +TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text +TCHAR szFrameClass[MAX_LOADSTRING]; // The title bar text + +// Foward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE hInstance); +ATOM MyRegisterClass2(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM); + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + HACCEL hAccelTable; + + // Initialize global strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_REGEDIT, szWindowClass, MAX_LOADSTRING); + LoadString(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING); + + MyRegisterClass(hInstance); + MyRegisterClass2(hInstance); + + // Perform application initialization: + if (!InitInstance(hInstance, nCmdShow)) { + return FALSE; + } + hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return msg.wParam; +} + + + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +// This function and its usage is only necessary if you want this code +// to be compatible with Win32 systems prior to the 'RegisterClassEx' +// function that was added to Windows 95. It is important to call this function +// so that the application will get 'well formed' small icons associated +// with it. +// +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_REGEDIT); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)SS_BLACKRECT/*(COLOR_WINDOW+1)*/; +// wcex.lpszMenuName = (LPCSTR)IDC_REGEDIT; + wcex.lpszMenuName = (LPCSTR)IDR_REGEDIT_MENU; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon((HINSTANCE)wcex.hInstance, (LPCTSTR)IDI_SMALL); + return RegisterClassEx(&wcex); +} + +ATOM MyRegisterClass2(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)FrameWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_REGEDIT); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = (LPCSTR)IDR_REGEDIT_MENU; + wcex.lpszClassName = szFrameClass; + wcex.hIconSm = LoadIcon((HINSTANCE)wcex.hInstance, (LPCTSTR)IDI_SMALL); + return RegisterClassEx(&wcex); +} + +// +// +// 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) +{ + int nParts[3]; + + // Initialize the Windows Common Controls DLL + InitCommonControls(); + + hInst = hInstance; // Store instance handle in our global variable + hMainWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + if (!hMainWnd) { + return FALSE; + } + + // Get the minimum window sizes +// GetWindowRect(hMainWnd, &rc); +// nMinimumWidth = (rc.right - rc.left); +// nMinimumHeight = (rc.bottom - rc.top); + + // Create the status bar + hStatusWnd = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, + "", hMainWnd, STATUS_WINDOW); + if (!hStatusWnd) + return FALSE; + + // Create the status bar panes + nParts[0] = 100; + nParts[1] = 210; + nParts[2] = 400; + SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts); + +/* + hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, + hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL); + if (!hSplitWnd) + return FALSE; + */ + hTreeWnd = CreateTreeView(hMainWnd, "c:\\foobar.txt"); + if (!hTreeWnd) + return FALSE; + + hListWnd = CreateListView(hMainWnd, ""); + if (!hListWnd) + return FALSE; + + ShowWindow(hMainWnd, nCmdShow); + UpdateWindow(hMainWnd); + return TRUE; +} + + +// OnSize() +// This function handles all the sizing events for the application +// It re-sizes every window, and child window that needs re-sizing +void OnSize(UINT nType, int cx, int cy) +{ + int nParts[3]; + int nXDifference; + int nYDifference; + RECT rc; + + if (nType == SIZE_MINIMIZED) + return; + + nXDifference = cx - nOldWidth; + nYDifference = cy - nOldHeight; + nOldWidth = cx; + nOldHeight = cy; + + // Update the status bar size + GetWindowRect(hStatusWnd, &rc); + SendMessage(hStatusWnd, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top))); + + // Update the status bar pane sizes + nParts[0] = bInMenuLoop ? -1 : 100; + nParts[1] = 210; + nParts[2] = cx; + SendMessage(hStatusWnd, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts); + + GetWindowRect(hStatusWnd, &rc); + + MoveWindow(hTreeWnd,0,0,cx/2,cy-(rc.bottom - rc.top),TRUE); + MoveWindow(hListWnd,cx/2,0,cx,cy-(rc.bottom - rc.top),TRUE); + +} + +void OnEnterMenuLoop(HWND hWnd) +{ + int nParts; + + // Update the status bar pane sizes + nParts = -1; + SendMessage(hStatusWnd, SB_SETPARTS, 1, (long)&nParts); + bInMenuLoop = TRUE; + SendMessage(hStatusWnd, SB_SETTEXT, (WPARAM)0, (LPARAM)_T("")); +} + +void OnExitMenuLoop(HWND hWnd) +{ + RECT rc; + int nParts[3]; +// TCHAR text[260]; + + bInMenuLoop = FALSE; + // Update the status bar pane sizes + GetClientRect(hWnd, &rc); + nParts[0] = 100; + nParts[1] = 210; + nParts[2] = rc.right; + SendMessage(hStatusWnd, SB_SETPARTS, 3, (long)nParts); + SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)_T("")); +// wsprintf(text, _T("CPU Usage: %3d%%"), PerfDataGetProcessorUsage()); +// SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text); +// wsprintf(text, _T("Processes: %d"), PerfDataGetProcessCount()); +// SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text); +} + +void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu) +{ + TCHAR str[100]; + + strcpy(str, TEXT("")); + if (nFlags & MF_POPUP) { + if (hSysMenu != GetMenu(hWnd)) { + if (nItemID == 2) nItemID = 5; + } + } + if (LoadString(hInst, nItemID, str, 100)) { + // load appropriate string + LPTSTR lpsz = str; + // first newline terminates actual string + lpsz = _tcschr(lpsz, '\n'); + if (lpsz != NULL) + *lpsz = '\0'; + } + SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)str); +} + + +LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + TCHAR szHello[MAX_LOADSTRING]; + LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); + + switch (message) { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) { + case IDM_ABOUT: +// ShowAboutBox(hWnd); + { + HICON hIcon = LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT); + ShellAbout(hWnd, szTitle, "FrameWndProc", hIcon); + //if (hIcon) DestroyIcon(hIcon); // NOT REQUIRED + } + break; + case IDM_EXIT: + DestroyWindow(hWnd); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + // TODO: Add any drawing code here... + RECT rt; + GetClientRect(hWnd, &rt); + DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + + +// +// FUNCTION: WndProc(HWND, unsigned, WORD, LONG) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + //TCHAR szHello[MAX_LOADSTRING]; + //LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); + + switch (message) { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) { + case ID_REGISTRY_PRINTERSETUP: + //PRINTDLG pd; + //PrintDlg(&pd); + //PAGESETUPDLG psd; + //PageSetupDlg(&psd); + break; + case ID_REGISTRY_OPENLOCAL: + { + HWND hChildWnd; +// hChildWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD, +// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWnd, NULL, hInst, NULL); + hChildWnd = CreateWindow(szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD, + 0, 0, 150, 170, hWnd, NULL, hInst, NULL); + if (hChildWnd) { + ShowWindow(hChildWnd, 1); + UpdateWindow(hChildWnd); + } + } + break; + case IDM_ABOUT: +// ShowAboutBox(hWnd); + { + HICON hIcon = LoadIcon(hInst, (LPCTSTR)IDI_REGEDIT); + ShellAbout(hWnd, szTitle, "", hIcon); + //if (hIcon) DestroyIcon(hIcon); // NOT REQUIRED + } + break; + case IDM_EXIT: + DestroyWindow(hWnd); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_SIZE: + // Handle the window sizing in it's own function + OnSize(wParam, LOWORD(lParam), HIWORD(lParam)); + break; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + // TODO: Add any drawing code here... + RECT rt; + GetClientRect(hWnd, &rt); + //DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + case WM_TIMER: + break; + + case WM_ENTERMENULOOP: + OnEnterMenuLoop(hWnd); + break; + case WM_EXITMENULOOP: + OnExitMenuLoop(hWnd); + break; + case WM_MENUSELECT: + OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} diff --git a/rosapps/regedit/regedit.h b/rosapps/regedit/regedit.h new file mode 100644 index 00000000000..0307e51433d --- /dev/null +++ b/rosapps/regedit/regedit.h @@ -0,0 +1,41 @@ +/* + * ReactOS regedit + * + * regedit.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 __REGEDIT_H__ +#define __REGEDIT_H__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" + + +#define STATUS_WINDOW 2001 +#define TREE_WINDOW 2002 +#define LIST_WINDOW 2003 +#define SPLIT_WINDOW 2004 + +#define MAX_LOADSTRING 100 + + +#endif // __REGEDIT_H__ diff --git a/rosapps/regedit/regedit.ico b/rosapps/regedit/regedit.ico new file mode 100644 index 0000000000000000000000000000000000000000..386883523bcc032db77b69b047cbc5c15ae3b7fe GIT binary patch literal 1078 zcmeH_K@!3s3`IZHwe$$AoF2oYaWszOk{jR)NR>_(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/regedit/regedit.rc b/rosapps/regedit/regedit.rc new file mode 100644 index 00000000000..0746237025e --- /dev/null +++ b/rosapps/regedit/regedit.rc @@ -0,0 +1,305 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_REGEDIT ICON DISCARDABLE "regedit.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +IDB_OPEN_FILE BITMAP DISCARDABLE "folder1.bmp" +IDB_CLOSED_FILE BITMAP DISCARDABLE "folder2.bmp" +IDB_ROOT BITMAP DISCARDABLE "folder3.bmp" + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_REGEDIT MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + +IDR_REGEDIT_MENU MENU DISCARDABLE +BEGIN + POPUP "&Registry" + BEGIN + MENUITEM "&Import Registry File...", ID_REGISTRY_IMPORTREGISTRYFILE + + MENUITEM "&Export Registry File...", ID_REGISTRY_EXPORTREGISTRYFILE + + MENUITEM SEPARATOR + MENUITEM "&Connect Network Registry...", + ID_REGISTRY_CONNECTNETWORKREGISTRY + + MENUITEM "&Disconnect Network Registry...", + ID_REGISTRY_DISCONNECTNETWORKREGISTRY + , GRAYED + MENUITEM SEPARATOR + MENUITEM "&Print\tCtrl+P", ID_REGISTRY_PRINT + MENUITEM SEPARATOR + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Modify", ID_EDIT_MODIFY + MENUITEM SEPARATOR + POPUP "&New" + BEGIN + MENUITEM "&Key", ID_EDIT_NEW_KEY + MENUITEM SEPARATOR + MENUITEM "&String Value", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Binary Value", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&DWORD Value", ID_EDIT_NEW_DWORDVALUE + END + MENUITEM SEPARATOR + MENUITEM "&Delete\tDel", ID_EDIT_DELETE + MENUITEM "&Rename", ID_EDIT_RENAME + MENUITEM SEPARATOR + MENUITEM "&Copy Key Name", ID_EDIT_COPYKEYNAME + MENUITEM SEPARATOR + MENUITEM "&Find\tCtrl+F", ID_EDIT_FIND + MENUITEM "Find Ne&xt\tF3", ID_EDIT_FINDNEXT + END + POPUP "&View" + BEGIN + MENUITEM "Status &Bar", ID_VIEW_STATUSBAR + MENUITEM SEPARATOR + MENUITEM "Sp&lit", ID_VIEW_SPLIT + MENUITEM SEPARATOR + MENUITEM "&Refresh\tF5", ID_VIEW_REFRESH + END + POPUP "&Favourites" + BEGIN + MENUITEM "&Add to Favourites", ID_FAVOURITES_ADDTOFAVOURITES + MENUITEM "&Remove Favourite", ID_FAVOURITES_REMOVEFAVOURITE + , GRAYED + END + POPUP "&Help" + BEGIN + MENUITEM "&Help Topics", ID_HELP_HELPTOPICS + MENUITEM SEPARATOR + MENUITEM "&About Registry Editor", IDM_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_REGEDIT,IDC_MYICON,14,9,16,16 + LTEXT "ReactOS regedit 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 + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "ReactOS Registry Editor" + IDS_HELLO "Hello World!" + + ID_REGISTRY_MENU "Contains commands for working with the whole registry" + ID_EDIT_MENU "Contains commands for editing values or keys" + ID_EDIT_NEW_MENU "Contains commands for creating new keys or values" + ID_FILE_MENU "Contains commands for customising the registry window" + ID_VIEW_MENU "Contains commands for accessing frequently used keys" + ID_FAVOURITES_MENU "Contains commands for displaying help and information about registry editor" + + ID_REGISTRY_IMPORTREGISTRYFILE "Imports a text file into the registry" + ID_REGISTRY_EXPORTREGISTRYFILE "Exports all or part of the registry to a text file" + ID_REGISTRY_CONNECTNETWORKREGISTRY "Connects to a remote computer's registry" + ID_REGISTRY_DISCONNECTNETWORKREGISTRY "Disconnects from a remote computer's registry" + ID_REGISTRY_PRINT "Prints all or part of the registry" + IDM_EXIT "Quits the registry editor" + + ID_EDIT_MODIFY "Modifies the value's data" + ID_EDIT_NEW_KEY "Adds a new key" + ID_EDIT_NEW_STRINGVALUE "Adds a new string value" + ID_EDIT_NEW_BINARYVALUE "Adds a new binary value" + ID_EDIT_NEW_DWORDVALUE "Adds a new double word value" + + ID_EDIT_DELETE "Deletes the selection" + ID_EDIT_RENAME "Renames the selection" + ID_EDIT_COPYKEYNAME "Copies the name of the selected key to the clipboard" + ID_EDIT_FIND "Finds a text string in a key, value or data" + ID_EDIT_FINDNEXT "Finds next occurrence of text specified in previous search" + + ID_VIEW_STATUSBAR "Shows or hides the status bar" + ID_VIEW_SPLIT "Change position of split between two panes" + ID_VIEW_REFRESH "Refreshes the window" + + ID_FAVOURITES_ADDTOFAVOURITES "Adds keys to the favourites list" + ID_FAVOURITES_REMOVEFAVOURITE "Removes keys from the favourites list" + + ID_HELP_HELPTOPICS "Opens registry editor help" + IDM_ABOUT "Displays program information, version number and copyright" + + IDC_REGEDIT "REGEDIT" + IDC_REGEDIT_FRAME "REGEDIT_FRAME" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (Australia) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// 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 + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_DIALOG1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + ID_HELP_HELPTOPICS "Opens Registry Editor Help." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_ABOUT "Displays program information, version number, and copyright." +END + +#endif // English (Australia) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/rosapps/regedit/reglist.cpp b/rosapps/regedit/reglist.cpp new file mode 100644 index 00000000000..f47e5f552b0 --- /dev/null +++ b/rosapps/regedit/reglist.cpp @@ -0,0 +1,68 @@ +/* + * ReactOS regedit + * + * reglist.cpp + * + * 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. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "regedit.h" +#include "reglist.h" + + +// Global Variables: +extern HINSTANCE hInst; +extern HWND hMainWnd; + + +HWND CreateListView(HWND hwndParent, LPSTR lpszFileName) +{ + RECT rcClient; // dimensions of client area + HWND hwndLV; // handle to list view control + + // Get the dimensions of the parent window's client area, and create the list view control. + GetClientRect(hwndParent, &rcClient); + hwndLV = CreateWindowEx(0, WC_LISTVIEW, "List View", + WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES, + 0, 0, rcClient.right, rcClient.bottom, + hwndParent, (HMENU)LIST_WINDOW, hInst, NULL); + + // Initialize the image list, and add items to the control. +/* + if (!InitListViewImageLists(hwndLV) || + !InitListViewItems(hwndLV, lpszFileName)) { + DestroyWindow(hwndLV); + return FALSE; + } + */ + return hwndLV; +} + diff --git a/rosapps/regedit/reglist.h b/rosapps/regedit/reglist.h new file mode 100644 index 00000000000..a7d05c42304 --- /dev/null +++ b/rosapps/regedit/reglist.h @@ -0,0 +1,38 @@ +/* + * ReactOS regedit + * + * reglist.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 __REGLIST_H__ +#define __REGLIST_H__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" + + + +HWND CreateListView(HWND hwndParent, LPSTR lpszFileName); + + + +#endif // __REGLIST_H__ diff --git a/rosapps/regedit/regtree.cpp b/rosapps/regedit/regtree.cpp new file mode 100644 index 00000000000..b11f9422922 --- /dev/null +++ b/rosapps/regedit/regtree.cpp @@ -0,0 +1,208 @@ +/* + * ReactOS regedit + * + * regtree.cpp + * + * 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. + */ + +#ifdef _MSC_VER +#include "stdafx.h" +#else +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#include "regedit.h" +#include "regtree.h" + +// Global Variables: +extern HINSTANCE hInst; // current instance +extern HWND hMainWnd; // Main Window + +// Global variables and constants +// Image_Open, Image_Closed, and Image_Root - integer variables for +// indexes of the images. +// CX_BITMAP and CY_BITMAP - width and height of an icon. +// NUM_BITMAPS - number of bitmaps to add to the image list. +int Image_Open; +int Image_Closed; +int Image_Root; + +#define CX_BITMAP 16 +#define CY_BITMAP 16 +#define NUM_BITMAPS 3 + + +// AddItemToTree - adds items to a tree view control. +// Returns the handle to the newly added item. +// hwndTV - handle to the tree view control. +// lpszItem - text of the item to add. +// nLevel - level at which to add the item. + +HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel) +{ + TVITEM tvi; + TVINSERTSTRUCT tvins; + static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST; + static HTREEITEM hPrevRootItem = NULL; + static HTREEITEM hPrevLev2Item = NULL; + HTREEITEM hti; + + tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; + + // Set the text of the item. + tvi.pszText = lpszItem; + tvi.cchTextMax = lstrlen(lpszItem); + + // Assume the item is not a parent item, so give it an image. + tvi.iImage = Image_Root; + tvi.iSelectedImage = Image_Root; + + tvi.cChildren = 1; + + + // Save the heading level in the item's application-defined data area. + tvi.lParam = (LPARAM)nLevel; + + tvins.item = tvi; + tvins.hInsertAfter = hPrev; + + // Set the parent item based on the specified level. + if (nLevel == 1) + tvins.hParent = TVI_ROOT; + else if (nLevel == 2) + tvins.hParent = hPrevRootItem; + else + tvins.hParent = hPrevLev2Item; + + // Add the item to the tree view control. + hPrev = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins); + + // Save the handle to the item. + if (nLevel == 1) + hPrevRootItem = hPrev; + else if (nLevel == 2) + hPrevLev2Item = hPrev; + + // The new item is a child item. Give the parent item a + // closed folder bitmap to indicate it now has child items. + if (nLevel > 1) { + hti = TreeView_GetParent(hwndTV, hPrev); + tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvi.hItem = hti; + tvi.iImage = Image_Closed; + tvi.iSelectedImage = Image_Closed; + TreeView_SetItem(hwndTV, &tvi); + } + + return hPrev; +} + +// InitTreeViewItems - extracts headings from the specified file and +// passes them to a function that adds them to a tree view control. +// Returns TRUE if successful, or FALSE otherwise. +// hwndTV - handle to the tree view control. +// lpszFileName - name of file with headings. + +BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName) +{ + HTREEITEM hItem; + + hItem = AddItemToTree(hwndTV, "My Computer", 1); + AddItemToTree(hwndTV, "HKEY_CLASSES_ROOT", 2); + AddItemToTree(hwndTV, "HKEY_CURRENT_USER", 2); + AddItemToTree(hwndTV, "HKEY_LOCAL_MACHINE", 2); + AddItemToTree(hwndTV, "HKEY_USERS", 2); + AddItemToTree(hwndTV, "HKEY_CURRENT_CONFIG", 2); + + TreeView_Expand(hwndTV, hItem, TVE_EXPAND); + return TRUE; +} + +// InitTreeViewImageLists - creates an image list, adds three bitmaps +// to it, and associates the image list with a tree view control. +// Returns TRUE if successful, or FALSE otherwise. +// hwndTV - handle to the tree view control. + +BOOL InitTreeViewImageLists(HWND hwndTV) +{ + HIMAGELIST himl; // handle to image list + HBITMAP hbmp; // handle to bitmap + + // Create the image list. + if ((himl = ImageList_Create(CX_BITMAP, CY_BITMAP, + FALSE, NUM_BITMAPS, 0)) == NULL) + return FALSE; + + // Add the open file, closed file, and document bitmaps. + hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_OPEN_FILE)); + Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOSED_FILE)); + Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_ROOT)); + Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL); + DeleteObject(hbmp); + + // Fail if not all of the images were added. + if (ImageList_GetImageCount(himl) < 3) + return FALSE; + + // Associate the image list with the tree view control. + TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL); + + return TRUE; +} + +// CreateTreeView - creates a tree view control. +// Returns the handle to the new control if successful, +// or NULL otherwise. +// hwndParent - handle to the control's parent window. +// lpszFileName - name of the file to parse for tree view items. + +HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName) +{ + RECT rcClient; // dimensions of client area + HWND hwndTV; // handle to tree view control + + // Get the dimensions of the parent window's client area, and create + // the tree view control. + GetClientRect(hwndParent, &rcClient); + hwndTV = CreateWindowEx(0, WC_TREEVIEW, "Tree View", + WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, + 0, 0, rcClient.right, rcClient.bottom, + hwndParent, (HMENU)TREE_WINDOW, hInst, NULL); + + // Initialize the image list, and add items to the control. + if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, lpszFileName)) { + DestroyWindow(hwndTV); + return FALSE; + } + return hwndTV; +} + diff --git a/rosapps/regedit/regtree.h b/rosapps/regedit/regtree.h new file mode 100644 index 00000000000..54a4d45acc4 --- /dev/null +++ b/rosapps/regedit/regtree.h @@ -0,0 +1,38 @@ +/* + * ReactOS regedit + * + * regtree.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 __REGTREE_H__ +#define __REGTREE_H__ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" + + + +HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName); + + + +#endif // __REGTREE_H__ diff --git a/rosapps/regedit/resource.h b/rosapps/regedit/resource.h new file mode 100644 index 00000000000..b207e3469dd --- /dev/null +++ b/rosapps/regedit/resource.h @@ -0,0 +1,104 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by regedit.rc +// +#define IDC_MYICON 2 +#define IDD_REGED_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDS_HELLO 106 +#define IDI_REGEDIT 107 +#define IDI_SMALL 108 +#define IDC_REGEDIT 109 +#define IDC_REGEDIT_FRAME 110 +#define IDR_MAINFRAME 128 +#define IDR_REGEDIT_MENU 130 +#define IDD_DIALOG1 131 + +#define ID_REGISTRY_MENU 0 +#define ID_EDIT_MENU 1 +#define ID_FILE_MENU 2 +#define ID_VIEW_MENU 3 +#define ID_FAVOURITES_MENU 4 +#define ID_EDIT_NEW_MENU 5 + +#define IDB_OPEN_FILE 97 +#define IDB_CLOSED_FILE 98 +#define IDB_ROOT 99 + +#define ID_HELP_HELPTOPICS 32771 +#define ID_FAVOURITES_ADDTOFAVOURITES 32772 +#define ID_FAVOURITES_REMOVEFAVOURITE 32773 +#define ID_VIEW_STATUSBAR 32774 +#define ID_VIEW_SPLIT 32775 +#define ID_VIEW_REFRESH 32776 +#define ID_EDIT_DELETE 32778 +#define ID_EDIT_RENAME 32779 +#define ID_EDIT_COPYKEYNAME 32781 +#define ID_EDIT_FIND 32782 +#define ID_EDIT_FINDNEXT 32783 +#define ID_EDIT_MODIFY 32784 +#define ID_EDIT_NEW_KEY 32785 +#define ID_EDIT_NEW_STRINGVALUE 32786 +#define ID_EDIT_NEW_BINARYVALUE 32787 +#define ID_EDIT_NEW_DWORDVALUE 32788 +#define ID_REGISTRY_IMPORTREGISTRYFILE 32789 +#define ID_REGISTRY_EXPORTREGISTRYFILE 32790 +#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791 +#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792 +#define ID_REGISTRY_PRINT 32793 +#define ID_HELP_CONTENTS 32795 +#define ID_WINDOW_CASCADE 32797 +#define ID_WINDOW_TILE 32798 +#define ID_WINDOW_ARRANGEICONS 32799 +#define ID_OPTIONS_FONT 32800 +#define ID_OPTIONS_AUTOREFRESH 32801 +#define ID_OPTIONS_READONLYMODE 32802 +#define ID_OPTIONS_CONFIRMONDELETE 32803 +#define ID_OPTIONS_SAVESETTINGSONEXIT 32804 +#define ID_SECURITY_PERMISSIONS 32805 +#define ID_VIEW_TREEANDDATA 32806 +#define ID_VIEW_TREEONLY 32807 +#define ID_VIEW_DATAONLY 32808 +#define ID_VIEW_DISPLAYBINARYDATA 32810 +#define ID_VIEW_REFRESHALL 32811 +#define ID_VIEW_REFRESHACTIVE 32812 +#define ID_VIEW_FINDKEY 32813 +#define ID_TREE_EXPANDONELEVEL 32814 +#define ID_TREE_EXPANDBRANCH 32815 +#define ID_TREE_EXPANDALL 32816 +#define ID_TREE_COLLAPSEBRANCH 32817 +#define ID_EDIT_ADDKEY 32818 +#define ID_EDIT_ADDVALUE 32819 +#define ID_EDIT_BINARY 32821 +#define ID_EDIT_STRING 32822 +#define ID_EDIT_DWORD 32823 +#define ID_EDIT_MULTISTRING 32824 +#define ID_REGISTRY_OPENLOCAL 32825 +#define ID_REGISTRY_CLOSE 32826 +#define ID_REGISTRY_LOADHIVE 32827 +#define ID_REGISTRY_UNLOADHIVE 32828 +#define ID_REGISTRY_RESTORE 32829 +#define ID_REGISTRY_SAVEKEY 32830 +#define ID_REGISTRY_SELECTCOMPUTER 32831 +#define ID_REGISTRY_PRINTSUBTREE 32832 +#define ID_REGISTRY_PRINTERSETUP 32833 +#define ID_REGISTRY_SAVESUBTREEAS 32834 + +#define IDC_LICENSE_EDIT 1029 +#define IDS_LICENSE 32835 + +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 132 +#define _APS_NEXT_COMMAND_VALUE 32836 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/rosapps/regedit/small.ico b/rosapps/regedit/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>