Updated with latest work. Still far to go...

svn path=/trunk/; revision=3207
This commit is contained in:
Robert Dickenson 2002-07-10 18:39:21 +00:00
parent aaf641d620
commit 0a8fa54c83
24 changed files with 1217 additions and 783 deletions

View file

@ -29,9 +29,9 @@ BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
RCFLAGS = -DGCC -D_WIN32_IE=0x0400 RCFLAGS = -DGCC -D_WIN32_IE=0x0400
OBJS = about.o \ OBJS = framewnd.o \
debug.o \ childwnd.o \
$(TARGET).o main.o
LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32 LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
@ -44,41 +44,13 @@ $(TARGET).exe: $(OBJS) $(TARGET).coff
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
about.o: about.cpp about.h resource.h main.o: main.c main.h framewnd.h resource.h
affinity.o: affinity.cpp affinity.h framewnd.o: framewnd.c framewnd.h resource.h
applicationpage.o: applicationpage.cpp applicationpage.h processpage.h $(TARGET).h resource.h childwnd.o: childwnd.c childwnd.h resource.h
column.o: column.cpp column.h resource.h $(TARGET).o: $(TARGET).c $(TARGET).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: clean:
- $(RM) $(OBJS) - $(RM) $(OBJS)

View file

@ -1,71 +0,0 @@
/*
* ReactOS About Dialog Box
*
* about.cpp
*
* 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.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "regedt32.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;
}

233
rosapps/regedt32/childwnd.c Normal file
View file

@ -0,0 +1,233 @@
/*
* ReactOS regedt32
*
* childwnd.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.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include <assert.h>
#define ASSERT assert
#include "main.h"
#include "childwnd.h"
////////////////////////////////////////////////////////////////////////////////
static void draw_splitbar(HWND hWnd, int x)
{
RECT rt;
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rt);
rt.left = x - SPLIT_WIDTH/2;
rt.right = x + SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
}
static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
{
PAINTSTRUCT ps;
RECT rt;
HDC hdc;
GetClientRect(hWnd, &rt);
hdc = BeginPaint(hWnd, &ps);
FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
EndPaint(hWnd, &ps);
}
static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam)
{
if (wParam != SIZE_MINIMIZED) {
//resize_tree(pChildWnd, LOWORD(lParam), HIWORD(lParam));
}
}
//
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the child windows.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int last_split;
ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA);
ASSERT(pChildWnd);
switch (message) {
case WM_PAINT:
OnPaint(hWnd, pChildWnd);
return 0;
case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
POINT pt;
GetCursorPos(&pt);
ScreenToClient(hWnd, &pt);
if (pt.x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && pt.x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
SetCursor(LoadCursor(0, IDC_SIZEWE));
return TRUE;
}
}
//goto def;
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_LBUTTONDOWN: {
RECT rt;
int x = LOWORD(lParam);
GetClientRect(hWnd, &rt);
if (x>=pChildWnd->nSplitPos-SPLIT_WIDTH/2 && x<pChildWnd->nSplitPos+SPLIT_WIDTH/2+1) {
last_split = pChildWnd->nSplitPos;
#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
#endif
SetCapture(hWnd);
}
break;}
case WM_LBUTTONUP:
if (GetCapture() == hWnd) {
#ifdef _NO_EXTENSIONS
RECT rt;
int x = LOWORD(lParam);
draw_splitbar(hWnd, last_split);
last_split = -1;
GetClientRect(hWnd, &rt);
pChildWnd->nSplitPos = x;
//resize_tree(pChildWnd, rt.right, rt.bottom);
#endif
ReleaseCapture();
}
break;
#ifdef _NO_EXTENSIONS
case WM_CAPTURECHANGED:
if (GetCapture()==hWnd && last_split>=0)
draw_splitbar(hWnd, last_split);
break;
#endif
case WM_KEYDOWN:
if (wParam == VK_ESCAPE)
if (GetCapture() == hWnd) {
RECT rt;
#ifdef _NO_EXTENSIONS
draw_splitbar(hWnd, last_split);
#else
pChildWnd->nSplitPos = last_split;
#endif
GetClientRect(hWnd, &rt);
//resize_tree(pChildWnd, rt.right, rt.bottom);
last_split = -1;
ReleaseCapture();
SetCursor(LoadCursor(0, IDC_ARROW));
}
break;
case WM_MOUSEMOVE:
if (GetCapture() == hWnd) {
RECT rt;
int x = LOWORD(lParam);
#ifdef _NO_EXTENSIONS
HDC hdc = GetDC(hWnd);
GetClientRect(hWnd, &rt);
rt.left = last_split-SPLIT_WIDTH/2;
rt.right = last_split+SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
last_split = x;
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
InvertRect(hdc, &rt);
ReleaseDC(hWnd, hdc);
#else
GetClientRect(hWnd, &rt);
if (x>=0 && x<rt.right) {
pChildWnd->nSplitPos = x;
//resize_tree(pChildWnd, rt.right, rt.bottom);
rt.left = x-SPLIT_WIDTH/2;
rt.right = x+SPLIT_WIDTH/2+1;
InvalidateRect(hWnd, &rt, FALSE);
UpdateWindow(pChildWnd->hLeftWnd);
UpdateWindow(hWnd);
UpdateWindow(pChildWnd->hRightWnd);
}
#endif
}
break;
#ifndef _NO_EXTENSIONS
case WM_GETMINMAXINFO:
DefMDIChildProc(hWnd, message, wParam, lParam);
{LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
break;}
#endif
case WM_SETFOCUS:
SetCurrentDirectory(pChildWnd->szPath);
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hRightWnd: pChildWnd->hLeftWnd);
break;
case WM_TIMER:
break;
case WM_COMMAND:
// Parse the menu selections:
switch (LOWORD(wParam)) {
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
break;
case WM_SIZE:
if (wParam != SIZE_MINIMIZED) {
OnSize(pChildWnd, wParam, lParam);
}
// fall through
default:
return DefMDIChildProc(hWnd, message, wParam, lParam);
}
return 0;
}

View file

@ -1,7 +1,7 @@
/* /*
* ReactOS regedt32 * ReactOS Application MDI Child Window
* *
* regedt32.h * childwnd.h
* *
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org> * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
@ -20,14 +20,23 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __REGEDT32_H__ #ifndef __CHILD_WND_H__
#define __REGEDT32_H__ #define __CHILD_WND_H__
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "resource.h"
LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
#endif // __REGEDT32_H__ #ifdef __cplusplus
};
#endif
#endif // __CHILD_WND_H__

View file

@ -1,39 +0,0 @@
/*
* ReactOS Application Debug Routines
*
* debug.cpp
*
* 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.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "regedt32.h"
#include "debug.h"

View file

@ -1,28 +0,0 @@
/*
* ReactOS Application Debug Routines
*
* debug.cpp
*
* 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 __DEBUG_H__
#define __DEBUG_H__
#endif // __DEBUG_H__

227
rosapps/regedt32/framewnd.c Normal file
View file

@ -0,0 +1,227 @@
/*
* ReactOS regedt32
*
* 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.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include <shellapi.h>
#include "main.h"
#include "framewnd.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop
////////////////////////////////////////////////////////////////////////////////
// Local module support methods
//
////////////////////////////////////////////////////////////////////////////////
static HHOOK hcbthook;
static ChildWnd* newchild = NULL;
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
if (code == HCBT_CREATEWND && newchild) {
ChildWnd* pChildWnd = newchild;
newchild = NULL;
pChildWnd->hWnd = (HWND)wParam;
SetWindowLong(pChildWnd->hWnd, GWL_USERDATA, (LPARAM)pChildWnd);
}
return CallNextHookEx(hcbthook, code, wParam, lParam);
}
static HWND InitChildWindow(LPTSTR param)
{
//TCHAR drv[_MAX_DRIVE];
TCHAR path[MAX_PATH];
ChildWnd* pChildWnd = NULL;
pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
if (pChildWnd != NULL) {
MDICREATESTRUCT mcs = {
szChildClass, path, hInst,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
0/*style*/, 0/*lParam*/
};
memset(pChildWnd, 0, sizeof(ChildWnd));
lstrcpy(pChildWnd->szPath, path);
pChildWnd->pos.length = sizeof(WINDOWPLACEMENT);
pChildWnd->pos.flags = 0;
pChildWnd->pos.showCmd = SW_SHOWNORMAL;
pChildWnd->pos.rcNormalPosition.left = CW_USEDEFAULT;
pChildWnd->pos.rcNormalPosition.top = CW_USEDEFAULT;
pChildWnd->pos.rcNormalPosition.right = CW_USEDEFAULT;
pChildWnd->pos.rcNormalPosition.bottom = CW_USEDEFAULT;
pChildWnd->nFocusPanel = 0;
pChildWnd->nSplitPos = 200;
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
newchild = pChildWnd;
pChildWnd->hWnd = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
UnhookWindowsHookEx(hcbthook);
if (pChildWnd->hWnd == NULL) {
free(pChildWnd);
newchild = pChildWnd = NULL;
}
return pChildWnd->hWnd;
}
return 0;
}
BOOL CALLBACK CloseEnumProc(HWND hWnd, LPARAM lParam)
{
if (!GetWindow(hWnd, GW_OWNER)) {
SendMessage(GetParent(hWnd), WM_MDIRESTORE, (WPARAM)hWnd, 0);
if (SendMessage(hWnd, WM_QUERYENDSESSION, 0, 0)) {
SendMessage(GetParent(hWnd), WM_MDIDESTROY, (WPARAM)hWnd, 0);
}
}
return 1;
}
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes WM_COMMAND messages for the main frame window.
//
//
LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hChildWnd;
if (1) {
switch (LOWORD(wParam)) {
case ID_WINDOW_CLOSEALL:
EnumChildWindows(hMDIClient, &CloseEnumProc, 0);
break;
case ID_WINDOW_CLOSE:
hChildWnd = (HWND) SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
SendMessage(hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
break;
// case ID_FILE_EXIT:
// SendMessage(hWnd, WM_CLOSE, 0, 0);
// break;
// case IDM_EXIT:
// DestroyWindow(hWnd);
// break;
// case ID_FILE_OPEN:
case ID_REGISTRY_PRINTERSETUP:
//PRINTDLG pd;
//PrintDlg(&pd);
//PAGESETUPDLG psd;
//PageSetupDlg(&psd);
break;
case ID_REGISTRY_OPENLOCAL:
case ID_WINDOW_NEW_WINDOW:
InitChildWindow("Child Window");
return 0;
case ID_WINDOW_CASCADE:
SendMessage(hMDIClient, WM_MDICASCADE, 0, 0);
break;
case ID_WINDOW_TILE_HORZ:
SendMessage(hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
break;
case ID_WINDOW_TILE_VERT:
SendMessage(hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
break;
case ID_WINDOW_ARRANGE_ICONS:
SendMessage(hMDIClient, WM_MDIICONARRANGE, 0, 0);
break;
case ID_HELP_ABOUT:
// ShowAboutBox(hWnd);
{
HICON hIcon = LoadIcon(hInst, (LPCTSTR)IDI_REGEDT32);
ShellAbout(hWnd, szTitle, "FrameWndProc", hIcon);
//if (hIcon) DestroyIcon(hIcon); // NOT REQUIRED
}
break;
default:
hChildWnd = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (IsWindow(hChildWnd))
SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
else
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
}
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////
//
// 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:
{
HMENU hMenuWindow = GetSubMenu(hMenuFrame, GetMenuItemCount(hMenuFrame)-2);
CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
0, 0, 0, 0,
hWnd, (HMENU)0, hInst, &ccs);
}
break;
case WM_COMMAND:
return _CmdWndProc(hWnd, message, wParam, lParam);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_QUERYENDSESSION:
case WM_CLOSE:
SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0);
if (GetWindow(hMDIClient, GW_CHILD) != NULL)
return 0;
// else fall thru...
default:
return DefFrameProc(hWnd, hMDIClient, message, wParam, lParam);
}
return 0;
}

View file

@ -1,7 +1,7 @@
/* /*
* ReactOS About Dialog Box * ReactOS Application Main Window
* *
* about.h * framewnd.h
* *
* Copyright (C) 2002 Robert Dickenson <robd@reactos.org> * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
* *
@ -20,18 +20,23 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __ABOUT_H__ #ifndef __FRAME_WND_H__
#define __ABOUT_H__ #define __FRAME_WND_H__
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void ShowAboutBox(HWND hWnd); #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif
#endif // __ABOUT_H__ #endif // __FRAME_WND_H__

180
rosapps/regedt32/main.c Normal file
View file

@ -0,0 +1,180 @@
/*
* ReactOS regedt32
*
* 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.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "main.h"
#include "framewnd.h"
#include "childwnd.h"
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
//
HINSTANCE hInst;
HACCEL hAccel;
HWND hFrameWnd;
HMENU hMenuFrame;
HWND hMDIClient;
HWND hStatusBar;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szFrameClass[MAX_LOADSTRING];
TCHAR szChildClass[MAX_LOADSTRING];
////////////////////////////////////////////////////////////////////////////////
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_REGEDT32)),
LoadCursor(0, IDC_ARROW),
0/*hbrBackground*/,
0/*lpszMenuName*/,
szFrameClass,
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDT32), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
};
ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
WNDCLASSEX wcChild = {
sizeof(WNDCLASSEX),
CS_HREDRAW | CS_VREDRAW/*style*/,
ChildWndProc,
0/*cbClsExtra*/,
sizeof(HANDLE)/*cbWndExtra*/,
hInstance,
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDT32)),
LoadCursor(0, IDC_ARROW),
0/*hbrBackground*/,
0/*lpszMenuName*/,
szChildClass,
(HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDT32), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
};
ATOM hChildWndClass = RegisterClassEx(&wcChild); // register child windows class
HMENU hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU));
HMENU hMenuOptions = GetSubMenu(hMenu, ID_OPTIONS_MENU);
HMENU hChildMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_REGEDT32_MENU));
INITCOMMONCONTROLSEX icc = {
sizeof(INITCOMMONCONTROLSEX),
ICC_BAR_CLASSES
};
hMenuFrame = hMenu;
hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_REGEDT32));
// Initialize the Windows Common Controls DLL
InitCommonControls();
hFrameWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL/*hWndParent*/, hMenuFrame, hInstance, NULL/*lpParam*/);
if (!hFrameWnd) {
return FALSE;
}
#if 0
{
int nParts[3];
// Create the status bar
hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, "", hFrameWnd, STATUS_WINDOW);
if (!hStatusBar)
return FALSE;
// Create the status bar panes
nParts[0] = 100;
nParts[1] = 210;
nParts[2] = 400;
SendMessage(hStatusBar, SB_SETPARTS, 3, (long)nParts);
}
#endif
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;
HWND hMDIClient;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_REGEDT32_FRAME, szFrameClass, MAX_LOADSTRING);
LoadString(hInstance, IDC_REGEDT32, szChildClass, 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_REGEDT32);
hMDIClient = GetWindow(hFrameWnd, GW_CHILD);
// Main message loop:
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateMDISysAccel(hMDIClient, &msg) &&
!TranslateAccelerator(hFrameWnd, hAccel, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
ExitInstance();
return msg.wParam;
}

75
rosapps/regedt32/main.h Normal file
View file

@ -0,0 +1,75 @@
/*
* ReactOS regedt32
*
* 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
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h"
////////////////////////////////////////////////////////////////////////////////
#define SPLIT_WIDTH 5
#define MAX_LOADSTRING 100
typedef struct {
HWND hWnd;
HWND hLeftWnd;
HWND hRightWnd;
int nFocusPanel; // 0: left 1: right
int nSplitPos;
WINDOWPLACEMENT pos;
TCHAR szPath[MAX_PATH];
} ChildWnd;
//void UpdateStatusBar(void);
////////////////////////////////////////////////////////////////////////////////
// Global Variables:
extern HINSTANCE hInst;
extern HACCEL hAccel;
extern HWND hFrameWnd;
extern HMENU hMenuFrame;
extern HWND hMDIClient;
//extern HWND hStatusBar;
//extern HWND hToolBar;
extern HFONT hFont;
extern TCHAR szTitle[];
extern TCHAR szFrameClass[];
extern TCHAR szChildClass[];
#ifdef __cplusplus
};
#endif
#endif // __MAIN_H__

View file

@ -1,419 +0,0 @@
/*
* ReactOS regedt32
*
* regedt32.cpp
*
* 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.
*/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <process.h>
#include <stdio.h>
#endif
#include "resource.h"
#include <shellapi.h>
//#include <winspool.h>
#define STATUS_WINDOW 2001
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
HWND hMainWnd; // Main Window
HWND hStatusWnd; // Status Bar Window
HWND hTabWnd; // Tab 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_REGEDT32, szWindowClass, MAX_LOADSTRING);
LoadString(hInstance, IDC_REGEDT32_FRAME, szFrameClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
MyRegisterClass2(hInstance);
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDT32);
// 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_REGEDT32);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)SS_BLACKRECT/*(COLOR_WINDOW+1)*/;
// wcex.lpszMenuName = (LPCSTR)IDC_REGEDT32;
wcex.lpszMenuName = (LPCSTR)IDR_REGEDT32_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_REGEDT32);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCSTR)IDR_REGEDT32_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);
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);
}
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 (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_REGEDT32);
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_REGEDT32);
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;
}

View file

@ -119,17 +119,16 @@ BEGIN
END END
POPUP "&Window" POPUP "&Window"
BEGIN BEGIN
MENUITEM "&Cascade\tShift+F5", ID_WINDOW_CASCADE, GRAYED MENUITEM "&Cascade\tShift+F5", ID_WINDOW_CASCADE
MENUITEM "&Tile\tShift+F4", ID_WINDOW_TILE, GRAYED MENUITEM "&Tile\tShift+F4", ID_WINDOW_TILE
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGEICONS MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE_ICONS
, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
END END
POPUP "&Help" POPUP "&Help"
BEGIN BEGIN
MENUITEM "&Contents", ID_HELP_CONTENTS MENUITEM "&Contents", ID_HELP_CONTENTS
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&About Registry Editor...", IDM_ABOUT MENUITEM "&About Registry Editor...", ID_HELP_ABOUT
END END
END END
@ -224,7 +223,7 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
ID_HELP_HELPTOPICS "Opens Registry Editor Help." ID_HELP_HELPTOPICS "Opens Registry Editor Help."
IDM_ABOUT "Displays program information, version number, and copyright." ID_HELP_ABOUT "Displays program information, version number, and copyright."
END END
#endif // English (Australia) resources #endif // English (Australia) resources

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View file

@ -2,9 +2,23 @@
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by regedt32.rc // Used by regedt32.rc
// //
#define IDW_FIRST_CHILD 200
#define ID_REGISTRY_MENU 0
#define ID_EDIT_MENU 1
#define ID_TREE_MENU 2
#define ID_VIEW_MENU 3
#define ID_SECURITY_MENU 4
#define ID_OPTIONS_MENU 5
#define ID_WINDOW_MENU 6
#define ID_HELP_MENU 7
#define ID_WINDOW_CLOSE 798
#define ID_WINDOW_CLOSEALL 799
#define STATUS_WINDOW 2001
#define IDD_ABOUTBOX 103 #define IDD_ABOUTBOX 103
#define IDS_APP_TITLE 103 #define IDS_APP_TITLE 103
#define IDM_ABOUT 104
#define IDM_EXIT 105 #define IDM_EXIT 105
#define IDS_HELLO 106 #define IDS_HELLO 106
#define IDI_REGEDT32 107 #define IDI_REGEDT32 107
@ -13,6 +27,7 @@
#define IDC_REGEDT32_FRAME 110 #define IDC_REGEDT32_FRAME 110
#define IDR_REGEDT32_MENU 129 #define IDR_REGEDT32_MENU 129
#define IDR_REGEDT_MENU 130 #define IDR_REGEDT_MENU 130
#define ID_HELP_ABOUT 32770
#define ID_HELP_HELPTOPICS 32771 #define ID_HELP_HELPTOPICS 32771
#define ID_FAVORITES_ADDTOFAVOURITES 32772 #define ID_FAVORITES_ADDTOFAVOURITES 32772
#define ID_FAVORITES_REMOVEFAVOURITE 32773 #define ID_FAVORITES_REMOVEFAVOURITE 32773
@ -29,15 +44,15 @@
#define ID_EDIT_NEW_STRINGVALUE 32786 #define ID_EDIT_NEW_STRINGVALUE 32786
#define ID_EDIT_NEW_BINARYVALUE 32787 #define ID_EDIT_NEW_BINARYVALUE 32787
#define ID_EDIT_NEW_DWORDVALUE 32788 #define ID_EDIT_NEW_DWORDVALUE 32788
#define ID_REGISTRY_IMPORTREGISTRYFILE 32789
#define ID_REGISTRY_EXPORTREGISTRYFILE 32790 #define ID_WINDOW_NEW_WINDOW 32794
#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32791 #define ID_WINDOW_CASCADE 32795
#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32792 #define ID_WINDOW_TILE 32796
#define ID_REGISTRY_PRINT 32793 #define ID_WINDOW_TILE_HORZ 32796
#define ID_HELP_CONTENTS 32795 #define ID_WINDOW_TILE_VERT 32797
#define ID_WINDOW_CASCADE 32797 #define ID_WINDOW_ARRANGE_ICONS 32798
#define ID_WINDOW_TILE 32798 #define ID_WINDOW_REFRESH 32799
#define ID_WINDOW_ARRANGEICONS 32799
#define ID_OPTIONS_FONT 32800 #define ID_OPTIONS_FONT 32800
#define ID_OPTIONS_AUTOREFRESH 32801 #define ID_OPTIONS_AUTOREFRESH 32801
#define ID_OPTIONS_READONLYMODE 32802 #define ID_OPTIONS_READONLYMODE 32802
@ -71,6 +86,12 @@
#define ID_REGISTRY_PRINTSUBTREE 32832 #define ID_REGISTRY_PRINTSUBTREE 32832
#define ID_REGISTRY_PRINTERSETUP 32833 #define ID_REGISTRY_PRINTERSETUP 32833
#define ID_REGISTRY_SAVESUBTREEAS 32834 #define ID_REGISTRY_SAVESUBTREEAS 32834
#define ID_REGISTRY_IMPORTREGISTRYFILE 32835
#define ID_REGISTRY_EXPORTREGISTRYFILE 32836
#define ID_REGISTRY_CONNECTNETWORKREGISTRY 32837
#define ID_REGISTRY_DISCONNECTNETWORKREGISTRY 32838
#define ID_REGISTRY_PRINT 32839
#define ID_HELP_CONTENTS 32840
#define IDC_LICENSE_EDIT 1029 #define IDC_LICENSE_EDIT 1029
#define IDS_LICENSE 32835 #define IDS_LICENSE 32835

View file

@ -317,7 +317,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
switch(message) { switch(message) {
case WM_CREATE: case WM_CREATE:
CreateTreeWnd(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT, pChildWnd->szPath); CreateTreeWnd(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT);
CreateListWnd(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, pChildWnd->szPath); CreateListWnd(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, pChildWnd->szPath);
//create_tree_window(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT, IDW_HEADER_LEFT, pChildWnd->szPath); //create_tree_window(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT, IDW_HEADER_LEFT, pChildWnd->szPath);
//create_list_window(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT); //create_list_window(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT);
@ -515,9 +515,16 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_NOTIFY: { case WM_NOTIFY: {
int idCtrl = (int)wParam; int idCtrl = (int)wParam;
NMHDR* pnmh = (NMHDR*)lParam; NMHDR* pnmh = (NMHDR*)lParam;
//return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &pChildWnd->left: &pChildWnd->right, pnmh); //return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &pChildWnd->left: &pChildWnd->right, pnmh);
if (idCtrl == IDW_TREE_LEFT) { if (idCtrl == IDW_TREE_LEFT) {
if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) {
Entry* entry = (Entry*)((NMTREEVIEW*)lParam)->itemNew.lParam;
if (entry != NULL) {
//RefreshList(pChildWnd->right.hWnd, entry);
//void set_curdir(ChildWnd* child, Entry* entry)
set_curdir(pChildWnd, entry);
}
}
SendMessage(pChildWnd->left.hWnd, message, wParam, lParam); SendMessage(pChildWnd->left.hWnd, message, wParam, lParam);
} }
if (idCtrl == IDW_TREE_RIGHT) { if (idCtrl == IDW_TREE_RIGHT) {
@ -538,9 +545,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
return 0; return 0;
} }
/*
RegenerateUserEnvironment
*/
ATOM RegisterChildWnd(HINSTANCE hInstance, int res_id) ATOM RegisterChildWnd(HINSTANCE hInstance, int res_id)
{ {
WNDCLASSEX wcFrame = { WNDCLASSEX wcFrame = {

View file

@ -342,6 +342,69 @@ static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
resize_frame_client(hWnd); resize_frame_client(hWnd);
} }
////////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK EnumNetConnectionsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
return 0;
}
/*
DWORD WNetOpenEnum(
DWORD dwScope, // scope of enumeration
DWORD dwType, // resource types to list
DWORD dwUsage, // resource usage to list
LPNETRESOURCE lpNetResource, // resource structure
LPHANDLE lphEnum // enumeration handle buffer
);
result = WNetOpenEnum(RESOURCE_CONNECTED, RESOURCETYPE_DISK, RESOURCEUSAGE_ALL, NULL, &EnumNetConnectionsProc);
*/
DWORD MapNetworkDrives(HWND hWnd, BOOL connect)
{
DWORD result = 0L;
#if 1
if (connect) {
WNetConnectionDialog(hWnd, RESOURCETYPE_DISK);
} else {
WNetDisconnectDialog(hWnd, RESOURCETYPE_DISK);
}
#else
if (connect) {
NETRESOURCE netResouce;
CONNECTDLGSTRUCT connectDlg;
//netResouce.dwScope;
//netResouce.dwType;
netResouce.dwDisplayType = 0;
//netResouce.dwUsage;
//netResouce.lpLocalName;
//netResouce.lpRemoteName;
//netResouce.lpComment;
//netResouce.lpProvider;
//connectDlg.cbStructure;
connectDlg.hwndOwner = hWnd;
connectDlg.lpConnRes = &netResouce;
//connectDlg.dwFlags;
//connectDlg.dwDevNum;
result = WNetConnectionDialog1(&connectDlg);
} else {
DISCDLGSTRUCT disconnectDlg;
//disconnectDlg.cbStructure;
disconnectDlg.hwndOwner = hWnd;
//disconnectDlg.lpLocalName;
//disconnectDlg.lpRemoteName;
//disconnectDlg.dwFlags;
result = WNetDisconnectDialog1(&disconnectDlg);
}
#endif
return result;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG) // FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
@ -398,6 +461,10 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ID_FILE_RUN: case ID_FILE_RUN:
OnFileRun(); OnFileRun();
break; break;
case ID_DISK_COPY_DISK:
break;
case ID_DISK_LABEL_DISK:
break;
case ID_DISK_FORMAT_DISK: case ID_DISK_FORMAT_DISK:
// SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0); // SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
{ {
@ -408,6 +475,20 @@ LRESULT _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
SetErrorMode(OldMode); // Put it back the way it was. SetErrorMode(OldMode); // Put it back the way it was.
} }
break; break;
case ID_DISK_CONNECT_NETWORK_DRIVE:
MapNetworkDrives(hWnd, TRUE);
break;
case ID_DISK_DISCONNECT_NETWORK_DRIVE:
MapNetworkDrives(hWnd, FALSE);
break;
case ID_DISK_SHARE_AS:
break;
case ID_DISK_STOP_SHARING:
break;
case ID_DISK_SELECT_DRIVE:
break;
case ID_VIEW_BY_FILE_TYPE: case ID_VIEW_BY_FILE_TYPE:
{ {
struct ExecuteDialog dlg = {{0}}; struct ExecuteDialog dlg = {{0}};

View file

@ -81,7 +81,8 @@ static void AddEntryToList(HWND hwndLV, int idx, Entry* entry)
item.stateMask = 0; item.stateMask = 0;
// item.pszText = entry->data.cFileName; // item.pszText = entry->data.cFileName;
item.pszText = LPSTR_TEXTCALLBACK; item.pszText = LPSTR_TEXTCALLBACK;
item.cchTextMax = strlen(entry->data.cFileName); // item.cchTextMax = strlen(entry->data.cFileName);
item.cchTextMax = 0;
item.iImage = 0; item.iImage = 0;
// item.iImage = I_IMAGECALLBACK; // item.iImage = I_IMAGECALLBACK;
item.lParam = (LPARAM)entry; item.lParam = (LPARAM)entry;
@ -92,13 +93,9 @@ static void AddEntryToList(HWND hwndLV, int idx, Entry* entry)
} }
// insert listctrl entries after index idx // insert listctrl entries after index idx
static void InsertListEntries(Pane* pane, Entry* parent, int idx) static void InsertListEntries(HWND hWnd, Entry* entry, int idx)
{ {
Entry* entry = parent; ShowWindow(hWnd, SW_HIDE);
if (!entry)
return;
ShowWindow(pane->hWnd, SW_HIDE);
if (idx == -1) { if (idx == -1) {
} }
@ -109,11 +106,11 @@ static void InsertListEntries(Pane* pane, Entry* parent, int idx)
if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue; continue;
#endif #endif
//ListBox_InsertItemData(pane->hWnd, idx, entry); //ListBox_InsertItemData(hWnd, idx, entry);
AddEntryToList(pane->hWnd, idx, entry); AddEntryToList(hWnd, idx, entry);
++idx; ++idx;
} }
ShowWindow(pane->hWnd, SW_SHOW); ShowWindow(hWnd, SW_SHOW);
} }
static void CreateListColumns(HWND hWndListView) static void CreateListColumns(HWND hWndListView)
@ -333,8 +330,9 @@ void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName)
SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE); SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
// insert entries into listbox // insert entries into listbox
if (entry) if (entry) {
InsertListEntries(pane, entry, -1); InsertListEntries(pane->hWnd, entry, -1);
}
// calculate column widths // calculate column widths
// if (!s_init) { // if (!s_init) {
@ -344,3 +342,39 @@ void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName)
// calc_widths(pane, TRUE); // calc_widths(pane, TRUE);
} }
void RefreshList(HWND hWnd, Entry* entry)
{
if (hWnd != NULL) {
ListView_DeleteAllItems(hWnd);
if (entry != NULL) {
//TRACE("RefreshList(...) entry name: %s\n", entry->data.cFileName);
InsertListEntries(hWnd, entry, -1);
}
}
}
/*
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
*/
/*
Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
if (pane != NULL) {
// ListBox_RemoveAll(hWnd, TRUE, 1);
ListView_DeleteAllItems(pane->hWnd);
if (entry) {
InsertListEntries(pane->hWnd, entry, -1);
}
}
*/

View file

@ -35,6 +35,7 @@ extern "C" {
void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName); void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName);
void RefreshList(HWND hWnd, Entry* entry);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -42,6 +42,9 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Global Variables: // Global Variables:
// //
UINT OemCodePage;
UINT AnsiCodePage;
LCID UserDefaultLCID;
HINSTANCE hInst; HINSTANCE hInst;
#ifdef USE_GLOBAL_STRUCT #ifdef USE_GLOBAL_STRUCT
@ -310,6 +313,7 @@ static BOOL CALLBACK EnumWndProc(HWND hWnd, LPARAM lparam)
GetClassName(hWnd, cls, 128); GetClassName(hWnd, cls, 128);
if (!lstrcmp(cls, (LPCTSTR)lparam)) { if (!lstrcmp(cls, (LPCTSTR)lparam)) {
g_foundPrevInstance++; g_foundPrevInstance++;
SetForegroundWindow(hWnd);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -322,6 +326,13 @@ void ExitInstance(void)
ImageList_Destroy(Globals.himl); ImageList_Destroy(Globals.himl);
} }
/*
struct _cpinfo {
UINT MaxCharSize;
BYTE DefaultChar[MAX_DEFAULTCHAR];
BYTE LeadByte[MAX_LEADBYTES];
} CPINFO, *LPCPINFO;
*/
int APIENTRY WinMain(HINSTANCE hInstance, int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
@ -332,6 +343,15 @@ int APIENTRY WinMain(HINSTANCE hInstance,
HACCEL hAccel; HACCEL hAccel;
HWND hMDIClient; HWND hMDIClient;
CPINFO CPinfo;
OemCodePage = GetOEMCP();
AnsiCodePage = GetACP();
UserDefaultLCID = GetUserDefaultLCID();
if (GetCPInfo(UserDefaultLCID, &CPinfo)) {
}
// Initialize global strings // Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_WINFILE, szFrameClass, MAX_LOADSTRING); LoadString(hInstance, IDC_WINFILE, szFrameClass, MAX_LOADSTRING);
@ -339,8 +359,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
// Allow only one running instance // Allow only one running instance
EnumWindows(EnumWndProc, (LPARAM)szFrameClass); EnumWindows(EnumWndProc, (LPARAM)szFrameClass);
if (g_foundPrevInstance) if (g_foundPrevInstance) {
return 1; return 1;
}
// Store instance handle in our global variable // Store instance handle in our global variable
hInst = hInstance; hInst = hInstance;
@ -365,4 +386,16 @@ int APIENTRY WinMain(HINSTANCE hInstance,
return msg.wParam; return msg.wParam;
} }
void _GetFreeSpaceEx(void)
{
BOOL fResult;
TCHAR szDrive[MAX_PATH];
ULARGE_INTEGER i64FreeBytesToCaller;
ULARGE_INTEGER i64TotalBytes;
ULARGE_INTEGER i64FreeBytes;
fResult = GetDiskFreeSpaceEx(szDrive,
(PULARGE_INTEGER)&i64FreeBytesToCaller,
(PULARGE_INTEGER)&i64TotalBytes,
(PULARGE_INTEGER)&i64FreeBytes);
}

View file

@ -67,6 +67,8 @@ int Image_Root;
#define NUM_BITMAPS 3 #define NUM_BITMAPS 3
#if 0
/*
// AddItemToTree - adds items to a tree view control. // AddItemToTree - adds items to a tree view control.
// Returns the handle to the newly added item. // Returns the handle to the newly added item.
// hwndTV - handle to the tree view control. // hwndTV - handle to the tree view control.
@ -82,7 +84,7 @@ HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
static HTREEITEM hPrevLev2Item = NULL; static HTREEITEM hPrevLev2Item = NULL;
HTREEITEM hti; HTREEITEM hti;
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
// Set the text of the item. // Set the text of the item.
tvi.pszText = lpszItem; tvi.pszText = lpszItem;
tvi.cchTextMax = lstrlen(lpszItem); tvi.cchTextMax = lstrlen(lpszItem);
@ -90,6 +92,7 @@ HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
tvi.iImage = Image_Root; tvi.iImage = Image_Root;
tvi.iSelectedImage = Image_Root; tvi.iSelectedImage = Image_Root;
tvi.cChildren = 1; tvi.cChildren = 1;
// Save the heading level in the item's application-defined data area. // Save the heading level in the item's application-defined data area.
tvi.lParam = (LPARAM)nLevel; tvi.lParam = (LPARAM)nLevel;
@ -125,6 +128,27 @@ HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
} }
return hPrev; return hPrev;
} }
*/
#endif
static void init_output(HWND hWnd)
{
TCHAR b[16];
HFONT old_font;
HDC hdc = GetDC(hWnd);
if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
Globals.num_sep = b[1];
else
Globals.num_sep = _T('.');
old_font = SelectFont(hdc, Globals.hFont);
GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
SelectFont(hdc, old_font);
ReleaseDC(hWnd, hdc);
}
HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry) HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
{ {
@ -138,11 +162,11 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST; static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
static HTREEITEM hPrevRootItem = NULL; static HTREEITEM hPrevRootItem = NULL;
static HTREEITEM hPrevLev2Item = NULL; static HTREEITEM hPrevLev2Item = NULL;
HTREEITEM hti;
TRACE("AddEntryToTree(level:%u - %s)\n", entry->level, entry->data.cFileName); //TRACE("AddEntryToTree(level:%u - %s)\n", entry->level, entry->data.cFileName);
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
/*
// Set the text of the item. // Set the text of the item.
tvi.pszText = entry->data.cFileName; tvi.pszText = entry->data.cFileName;
tvi.cchTextMax = lstrlen(entry->data.cFileName); tvi.cchTextMax = lstrlen(entry->data.cFileName);
@ -152,6 +176,12 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
tvi.cChildren = 1; tvi.cChildren = 1;
// Save the heading level in the item's application-defined data area. // Save the heading level in the item's application-defined data area.
//tvi.lParam = (LPARAM)entry->level; //tvi.lParam = (LPARAM)entry->level;
*/
tvi.pszText = LPSTR_TEXTCALLBACK;
tvi.cchTextMax = 0;
tvi.iImage = I_IMAGECALLBACK;
tvi.iSelectedImage = I_IMAGECALLBACK;
tvi.cChildren = I_CHILDRENCALLBACK;
// Save the entry pointer in the item's application-defined data area. // Save the entry pointer in the item's application-defined data area.
tvi.lParam = (LPARAM)entry; tvi.lParam = (LPARAM)entry;
@ -159,15 +189,10 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
tvins.hInsertAfter = hPrev; tvins.hInsertAfter = hPrev;
// Set the parent item based on the specified level. // Set the parent item based on the specified level.
// if (entry->level == 0 || entry->level == 1) {
if (entry->level == 0) { if (entry->level == 0) {
tvins.hParent = TVI_ROOT; tvins.hParent = TVI_ROOT;
} else if (entry->level == 1) { } else if (entry->level == 1) {
tvins.hParent = hPrevRootItem; tvins.hParent = hPrevRootItem;
if (hPrevRootItem) {
//tvins.hParent = entry->up->hTreeItem;
int foobar = entry->level * 2;
}
} else { } else {
tvins.hParent = hPrevLev2Item; tvins.hParent = hPrevLev2Item;
if (hPrevLev2Item) { if (hPrevLev2Item) {
@ -183,10 +208,11 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
hPrevRootItem = hPrev; hPrevRootItem = hPrev;
else if (entry->level == 1) else if (entry->level == 1)
hPrevLev2Item = hPrev; hPrevLev2Item = hPrev;
/*
// The new item is a child item. Give the parent item a // The new item is a child item. Give the parent item a
// closed folder bitmap to indicate it now has child items. // closed folder bitmap to indicate it now has child items.
if (entry->level > 1) { if (entry->level > 1) {
HTREEITEM hti;
hti = TreeView_GetParent(hwndTV, hPrev); hti = TreeView_GetParent(hwndTV, hPrev);
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hti; tvi.hItem = hti;
@ -194,34 +220,70 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
tvi.iSelectedImage = Image_Closed; tvi.iSelectedImage = Image_Closed;
TreeView_SetItem(hwndTV, &tvi); TreeView_SetItem(hwndTV, &tvi);
} }
*/
hItem = hPrev; hItem = hPrev;
#endif #endif
return hItem; return hItem;
} }
// InitTreeViewItems - extracts headings from the specified file and static BOOL InitTreeViewItems(HWND hwndTV)
// 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.
static BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName)
{ {
/*
HTREEITEM hItem;
hItem = AddItemToTree(hwndTV, "C:\\ - FAT32", 1);
AddItemToTree(hwndTV, "reactos", 2);
AddItemToTree(hwndTV, "bin", 3);
AddItemToTree(hwndTV, "media", 3);
AddItemToTree(hwndTV, "symbols", 3);
AddItemToTree(hwndTV, "system32", 3);
TreeView_Expand(hwndTV, hItem, TVE_EXPAND);
*/
return TRUE; return TRUE;
} }
// insert treectrl entries after index idx
static void insert_tree_entries(HWND hWnd, Entry* entry, int idx)
{
static HTREEITEM hItemVisible;
static int hItemVisibleIdx;
if (!entry)
return;
if (entry->hTreeItem)
return;
ShowWindow(hWnd, SW_HIDE);
for(; entry; entry=entry->next) {
#ifndef _LEFT_FILES
if (!(entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
continue;
#endif
// don't display entries "." and ".." in the left pane
if ((entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && entry->data.cFileName[0]==_T('.')) {
if (entry->data.cFileName[1] == _T('\0') ||
(entry->data.cFileName[1] == _T('.') &&
entry->data.cFileName[2] == _T('\0'))) {
continue;
}
}
// if (idx != -1)
// idx++;
// ListBox_InsertItemData(hWnd, idx, entry);
//TRACE("Adding item %u [level:%u] - %s\n", ++idx, entry->level, entry->data.cFileName);
if (entry->hTreeItem) continue;
entry->hTreeItem = AddEntryToTree(hWnd, entry);
if (entry->expanded) {
insert_tree_entries(hWnd, entry->down, idx + 1);
TreeView_Expand(hWnd, entry->hTreeItem, TVE_EXPAND);
}
if (idx > hItemVisibleIdx) {
hItemVisibleIdx = idx;
hItemVisible = entry->hTreeItem;
}
}
if (hItemVisible && idx == 0) {
TreeView_SelectSetFirstVisible(hWnd, hItemVisible);
}
ShowWindow(hWnd, SW_SHOW);
}
// InitTreeViewImageLists - creates an image list, adds three bitmaps // InitTreeViewImageLists - creates an image list, adds three bitmaps
// to it, and associates the image list with a tree view control. // to it, and associates the image list with a tree view control.
// Returns TRUE if successful, or FALSE otherwise. // Returns TRUE if successful, or FALSE otherwise.
@ -264,9 +326,8 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
// Returns the handle to the new control if successful, // Returns the handle to the new control if successful,
// or NULL otherwise. // or NULL otherwise.
// hwndParent - handle to the control's parent window. // hwndParent - handle to the control's parent window.
// lpszFileName - name of the file to parse for tree view items.
static HWND CreateTreeView(HWND hwndParent, int id, LPSTR lpszFileName) static HWND CreateTreeView(HWND hwndParent, int id)
{ {
RECT rcClient; // dimensions of client area RECT rcClient; // dimensions of client area
HWND hwndTV; // handle to tree view control HWND hwndTV; // handle to tree view control
@ -284,13 +345,133 @@ static HWND CreateTreeView(HWND hwndParent, int id, LPSTR lpszFileName)
0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0); 0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
*/ */
// Initialize the image list, and add items to the control. // Initialize the image list, and add items to the control.
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, lpszFileName)) { if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV)) {
DestroyWindow(hwndTV); DestroyWindow(hwndTV);
return NULL; return NULL;
} }
return hwndTV; return hwndTV;
} }
static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
{
static char buffer[200];
// LVITEM* pItem = &(ptvdi->item);
// Entry* entry = (Entry*)pItem->lParam;
Entry* entry = (Entry*)ptvdi->item.lParam;
ASSERT(entry);
if (ptvdi->item.mask & TVIF_CHILDREN ) {
ptvdi->item.cChildren = 5;
}
if (ptvdi->item.mask & TVIF_IMAGE) {
ptvdi->item.iImage = Image_Root;
}
if (ptvdi->item.mask & TVIF_SELECTEDIMAGE) {
ptvdi->item.iSelectedImage = Image_Closed;
}
if (ptvdi->item.mask & TVIF_TEXT) {
ptvdi->item.pszText = entry->data.cFileName;
ptvdi->item.cchTextMax = lstrlen(entry->data.cFileName);
}
}
/*
typedef struct tagTVITEM{
UINT mask;
HTREEITEM hItem;
UINT state;
UINT stateMask;
LPTSTR pszText;
int cchTextMax;
int iImage;
int iSelectedImage;
int cChildren;
LPARAM lParam;
} TVITEM, FAR *LPTVITEM;
TVITEM structure that identifies and contains information about the tree view item. The mask member of the TVITEM structure specifies which information is being set or retrieved. It can be one or more of the following values: TVIF_CHILDREN The cChildren member specifies, or is to receive, a value that indicates whether the item has child items.
TVIF_IMAGE The iImage member specifies, or is to receive, the index of the item's nonselected icon in the image list.
TVIF_SELECTEDIMAGE The iSelectedImage member specifies, or is to receive, the index of the item's selected icon in the image list.
TVIF_TEXT The pszText member specifies the new item text or the address of a buffer that is to receive the item text.
If the structure is receiving item text, you typically copy the text to the buffer pointed to by the pszText member of the TVITEM structure. However, you can return a string in the pszText member instead. If you do so, you cannot change or delete the string until the corresponding item text is deleted or until two additional TVN_GETDISPINFO notification messages have been sent.
*/
/*
typedef struct _BY_HANDLE_FILE_INFORMATION {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
*/
// OnEndLabelEdit - processes the LVN_ENDLABELEDIT notification message.
// Returns TRUE if the label is changed, or FALSE otherwise.
static BOOL OnEndLabelEdit(NMTVDISPINFO* ptvdi)
{
// if (ptvdi->item.iItem == -1)
// return FALSE;
// Copy the new label text to the application-defined structure.
// lstrcpyn(rgPetInfo[ptvdi->item.iItem].szKind, ptvdi->item.pszText, 10);
return TRUE;
// To make a more robust application you should send an EM_LIMITTEXT
// message to the edit control to prevent the user from entering too
// many characters in the field.
}
static BOOL OnExpand(int flag, HTREEITEM* pti)
{
TRACE("TreeWndProc(...) OnExpand()\n");
// pnmtv = (NMTREEVIEW) lParam
//TRACE("OnExpand(...) entry name: %s\n", entry->data.cFileName);
/*
TVE_COLLAPSE Collapses the list.
TVE_COLLAPSERESET Collapses the list and removes the child items. The TVIS_EXPANDEDONCE state flag is reset. This flag must be used with the TVE_COLLAPSE flag.
TVE_EXPAND Expands the list.
TVE_EXPANDPARTIAL Version 4.70. Partially expands the list. In this state, the child items are visible and the parent item's plus symbol is displayed. This flag must be used in combination with the TVE_EXPAND flag.
TVE_TOGGLE Collapses the list if it is expanded or expands it if it is collapsed.
*/
return TRUE;
}
static BOOL OnExpanding(HWND hWnd, NMTREEVIEW* pnmtv)
{
static int expanding;
//LPARAM parm = pnmtv->itemNew.lParam;
Entry* entry = (Entry*)pnmtv->itemNew.lParam;
TRACE("TreeWndProc(...) OnExpanding() entry: %p\n", entry);
if (expanding) return FALSE;
expanding = TRUE;
if (entry) {
insert_tree_entries(hWnd, entry->down, 0);
// insert_tree_entries(hWnd, entry, 0);
}
expanding = FALSE;
return TRUE;
}
/*
static BOOL OnSelChanged(NMTREEVIEW* pnmtv)
{
LPARAM parm = pnmtv->itemNew.lParam;
ChildWnd* child = (ChildWnd*)pnmtv->itemNew.lParam;
return TRUE;
}
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static WNDPROC g_orgTreeWndProc; static WNDPROC g_orgTreeWndProc;
@ -308,125 +489,62 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
#endif #endif
case WM_NOTIFY: case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) { switch (((LPNMHDR)lParam)->code) {
// case LVN_GETDISPINFO: case TVM_EXPAND:
// OnGetDispInfo((NMLVDISPINFO*)lParam); //return OnExpand((int)wParam, (HTREEITEM*)lParam);
// break; OnExpand((int)wParam, (HTREEITEM*)lParam);
// case LVN_ENDLABELEDIT: break;
// return OnEndLabelEdit((NMLVDISPINFO*)lParam); case TVN_GETDISPINFO:
OnGetDispInfo((NMTVDISPINFO*)lParam);
break;
case TVN_ITEMEXPANDING:
return OnExpanding(hWnd, (NMTREEVIEW*)lParam);
break;
// case TVN_SELCHANGED:
// return OnSelChanged((NMTREEVIEW*)lParam);
// break; // break;
case TVN_SINGLEEXPAND:
TRACE("TreeWndProc(...) TVN_SINGLEEXPAND\n");
//lpnmtv = (LPNMTREEVIEW)lParam;
//return TVNRET_DEFAULT;
// return TVNRET_SKIPOLD; // Skip default processing of the item being unselected.
// return TVNRET_SKIPNEW; // Skip default processing of the item being selected.
break;
case TVN_ENDLABELEDIT:
return OnEndLabelEdit((NMTVDISPINFO*)lParam);
break;
} }
// break; break;
return 0;
case WM_SETFOCUS: case WM_SETFOCUS:
child->nFocusPanel = pane == &child->right? 1: 0; child->nFocusPanel = pane == &child->right? 1: 0;
//ListBox_SetSel(hWnd, TRUE, 1); //ListBox_SetSel(hWnd, TRUE, 1);
//TODO: check menu items //TODO: check menu items
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
if (wParam == VK_TAB) { if (wParam == VK_TAB) {
//TODO: SetFocus(Globals.hDriveBar) //TODO: SetFocus(Globals.hDriveBar)
SetFocus(child->nFocusPanel ? child->left.hWnd: child->right.hWnd); SetFocus(child->nFocusPanel ? child->left.hWnd: child->right.hWnd);
} }
break;
} }
return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam); return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam);
} }
static void init_output(HWND hWnd)
{
TCHAR b[16];
HFONT old_font;
HDC hdc = GetDC(hWnd);
if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
Globals.num_sep = b[1];
else
Globals.num_sep = _T('.');
old_font = SelectFont(hdc, Globals.hFont);
GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
SelectFont(hdc, old_font);
ReleaseDC(hWnd, hdc);
}
// insert treectrl entries after index idx
static void insert_tree_entries(Pane* pane, Entry* parent, int idx)
{
static HTREEITEM hItemVisible;
static int hItemVisibleIdx;
HTREEITEM hItem;
Entry* entry = parent;
if (!entry)
return;
ShowWindow(pane->hWnd, SW_HIDE);
for(; entry; entry=entry->next) {
#ifndef _LEFT_FILES
if (pane->treePane && !(entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
continue;
#endif
// don't display entries "." and ".." in the left pane
if (pane->treePane && (entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && entry->data.cFileName[0]==_T('.')) {
if (
#ifndef _NO_EXTENSIONS
entry->data.cFileName[1]==_T('\0') ||
#endif
(entry->data.cFileName[1]==_T('.') && entry->data.cFileName[2]==_T('\0'))) {
continue;
}
}
// if (idx != -1)
// idx++;
// ListBox_InsertItemData(pane->hWnd, idx, entry);
//TRACE("Adding item %u [level:%u] - %s\n", ++idx, entry->level, entry->data.cFileName);
//hItem = AddItemToTree(pane->hWnd, entry->data.cFileName, idx);
//hItem = AddItemToTree(pane->hWnd, entry->data.cFileName, entry->level);
hItem = AddEntryToTree(pane->hWnd, entry);
if (hItem != NULL) {
entry->hTreeItem = hItem; // already done in AddEntryToTree
}
//TreeView_Expand(pane->hWnd, hItem, TVE_EXPAND);
if (pane->treePane && entry->expanded) {
insert_tree_entries(pane, entry->down, idx + 1);
TreeView_Expand(pane->hWnd, hItem, TVE_EXPAND);
}
if (idx > hItemVisibleIdx) {
hItemVisibleIdx = idx;
hItemVisible = hItem;
}
}
if (hItemVisible && idx == 0) {
TreeView_SelectSetFirstVisible(pane->hWnd, hItemVisible);
}
ShowWindow(pane->hWnd, SW_SHOW);
}
//void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPSTR lpszFileName) //void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPSTR lpszFileName)
void CreateTreeWnd(HWND parent, Pane* pane, int id, LPSTR lpszFileName) void CreateTreeWnd(HWND parent, Pane* pane, int id)
{ {
static int s_init = 0; static int s_init = 0;
Entry* entry = pane->root; Entry* entry = pane->root;
pane->treePane = 1; pane->treePane = 1;
pane->hWnd = CreateTreeView(parent, id, lpszFileName); pane->hWnd = CreateTreeView(parent, id);
SetWindowLong(pane->hWnd, GWL_USERDATA, (LPARAM)pane); SetWindowLong(pane->hWnd, GWL_USERDATA, (LPARAM)pane);
g_orgTreeWndProc = SubclassWindow(pane->hWnd, TreeWndProc); g_orgTreeWndProc = SubclassWindow(pane->hWnd, TreeWndProc);
SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE); SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
// insert entries into treectrl // insert entries into treectrl
if (entry) { if (entry) {
//insert_tree_entries(pane, entry, -1); insert_tree_entries(pane->hWnd, entry, 0);
insert_tree_entries(pane, entry, 0);
} }
// calculate column widths // calculate column widths
@ -439,6 +557,3 @@ void CreateTreeWnd(HWND parent, Pane* pane, int id, LPSTR lpszFileName)
// pane->hwndHeader = create_header(parent, pane, id_header); // pane->hwndHeader = create_header(parent, pane, id_header);
//#endif //#endif
} }

View file

@ -34,12 +34,12 @@ extern "C" {
#include "resource.h" #include "resource.h"
void CreateTreeWnd(HWND parent, Pane* pane, int id, LPSTR lpszFileName); void CreateTreeWnd(HWND parent, Pane* pane, int id);
HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel); HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel);
//HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName); //HWND CreateTreeView(HWND hwndParent);
//void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPSTR lpszFileName); //void create_tree_window(HWND parent, Pane* pane, int id, int id_header);
//LRESULT CALLBACK TreeWndProc(HWND, UINT, WPARAM, LPARAM); //LRESULT CALLBACK TreeWndProc(HWND, UINT, WPARAM, LPARAM);

View file

@ -319,13 +319,18 @@ void set_curdir(ChildWnd* child, Entry* entry)
if (!entry->scanned) if (!entry->scanned)
scan_entry(child, entry); scan_entry(child, entry);
else { else {
ListBox_ResetContent(child->right.hWnd); // ListBox_ResetContent(child->right.hWnd);
insert_entries(&child->right, entry->down, -1); // insert_entries(&child->right, entry->down, -1);
calc_widths(&child->right, FALSE);
#ifndef _NO_EXTENSIONS // RefreshList(child->right.hWnd, entry);
set_header(&child->right);
#endif // calc_widths(&child->right, FALSE);
//#ifndef _NO_EXTENSIONS
// set_header(&child->right);
//#endif
} }
RefreshList(child->right.hWnd, entry->down);
get_path(entry, path); get_path(entry, path);
lstrcpy(child->szPath, path); lstrcpy(child->szPath, path);
SetWindowText(child->hWnd, path); SetWindowText(child->hWnd, path);

View file

@ -87,10 +87,7 @@ BEGIN
MENUITEM "&Format Disk..\t", ID_DISK_FORMAT_DISK MENUITEM "&Format Disk..\t", ID_DISK_FORMAT_DISK
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Connect &Network Drive...", ID_DISK_CONNECT_NETWORK_DRIVE MENUITEM "Connect &Network Drive...", ID_DISK_CONNECT_NETWORK_DRIVE
, GRAYED MENUITEM "&Disconnect Network Drive...",ID_DISK_DISCONNECT_NETWORK_DRIVE
MENUITEM "&Disconnect Network Drive...",
ID_DISK_DISCONNECT_NETWORK_DRIVE
, GRAYED
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Share &As...", ID_DISK_SHARE_AS, GRAYED MENUITEM "Share &As...", ID_DISK_SHARE_AS, GRAYED
MENUITEM "S&top Sharing...", ID_DISK_STOP_SHARING, GRAYED MENUITEM "S&top Sharing...", ID_DISK_STOP_SHARING, GRAYED