mirror of
https://github.com/reactos/reactos.git
synced 2025-03-30 17:10:22 +00:00
getting some mods from a while ago sync'd.
svn path=/trunk/; revision=4184
This commit is contained in:
parent
c3ff43d969
commit
562b3cf13b
30 changed files with 544 additions and 453 deletions
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "about.h"
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <ctype.h>
|
||||
|
@ -65,7 +61,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Local module support methods
|
||||
//
|
||||
|
||||
/*
|
||||
static BOOL pane_command(Pane* pane, UINT cmd)
|
||||
{
|
||||
switch(cmd) {
|
||||
|
@ -100,7 +96,7 @@ static BOOL pane_command(Pane* pane, UINT cmd)
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*/
|
||||
static void draw_splitbar(HWND hWnd, int x)
|
||||
{
|
||||
RECT rt;
|
||||
|
@ -119,8 +115,8 @@ static void ResizeWnd(ChildWnd* pChildWnd, int cx, int cy)
|
|||
RECT rt = {0, 0, cx, cy};
|
||||
|
||||
cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2;
|
||||
DeferWindowPos(hdwp, pChildWnd->left.hWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
DeferWindowPos(hdwp, pChildWnd->right.hWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
EndDeferWindowPos(hdwp);
|
||||
}
|
||||
|
||||
|
@ -250,6 +246,61 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL OnNotify(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ChildWnd* pChildWnd = (ChildWnd*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
{
|
||||
if ((int)wParam == TREE_WINDOW) {
|
||||
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
case TVN_ITEMEXPANDING:
|
||||
// return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
|
||||
OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
|
||||
return FALSE;
|
||||
|
||||
case TVN_SELCHANGED:
|
||||
{
|
||||
Entry* entry = (Entry*)((NMTREEVIEW*)lParam)->itemNew.lParam;
|
||||
if (entry != NULL) {
|
||||
//RefreshList(pChildWnd->hListWnd, entry);
|
||||
//void set_curdir(ChildWnd* child, Entry* entry)
|
||||
// set_curdir(pChildWnd, entry);
|
||||
|
||||
// UpdateStatus(hWnd, pChildWnd->left.cur->down);
|
||||
|
||||
}
|
||||
case TVN_GETDISPINFO:
|
||||
OnGetDispInfo((NMTVDISPINFO*)lParam);
|
||||
break;
|
||||
/*
|
||||
HKEY hKey;
|
||||
TCHAR keyPath[1000];
|
||||
int keyPathLen = 0;
|
||||
keyPath[0] = _T('\0');
|
||||
hKey = FindRegRoot(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR));
|
||||
RefreshListView(pChildWnd->hListWnd, hKey, keyPath);
|
||||
|
||||
keyPathLen = 0;
|
||||
keyPath[0] = _T('\0');
|
||||
MakeFullRegPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, keyPath, &keyPathLen, sizeof(keyPath)/sizeof(TCHAR));
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)keyPath);
|
||||
*/
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else
|
||||
if ((int)wParam == LIST_WINDOW) {
|
||||
if (!SendMessage(pChildWnd->hListWnd, WM_NOTIFY, wParam, lParam)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
|
||||
|
@ -261,20 +312,22 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
// 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);
|
||||
ASSERT(pChildWnd || (message == WM_CREATE));
|
||||
|
||||
switch(message) {
|
||||
case WM_CREATE:
|
||||
CreateTreeWnd(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT);
|
||||
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_list_window(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT);
|
||||
return 0;
|
||||
pChildWnd = (ChildWnd*)((MDICREATESTRUCT*)((CREATESTRUCT*)lParam)->lpCreateParams)->lParam;
|
||||
ASSERT(pChildWnd);
|
||||
SetWindowLong(hWnd, GWL_USERDATA, (LONG)pChildWnd);
|
||||
|
||||
pChildWnd->nSplitPos = 250;
|
||||
pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd, TREE_WINDOW);
|
||||
pChildWnd->hListWnd = CreateListView(hWnd, pChildWnd/*, pChildWnd->szPath*/, LIST_WINDOW);
|
||||
//return -1; // terminate window creation on error
|
||||
break;
|
||||
case WM_PAINT:
|
||||
OnPaint(hWnd, pChildWnd);
|
||||
|
@ -299,8 +352,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
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;
|
||||
draw_splitbar(hWnd, last_split);
|
||||
pChildWnd->last_split = pChildWnd->nSplitPos;
|
||||
draw_splitbar(hWnd, pChildWnd->last_split);
|
||||
SetCapture(hWnd);
|
||||
}
|
||||
break;}
|
||||
|
@ -309,8 +362,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
int x = LOWORD(lParam);
|
||||
draw_splitbar(hWnd, last_split);
|
||||
last_split = -1;
|
||||
draw_splitbar(hWnd, pChildWnd->last_split);
|
||||
pChildWnd->last_split = -1;
|
||||
GetClientRect(hWnd, &rt);
|
||||
pChildWnd->nSplitPos = x;
|
||||
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||
|
@ -319,18 +372,18 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
break;
|
||||
|
||||
case WM_CAPTURECHANGED:
|
||||
if (GetCapture()==hWnd && last_split>=0)
|
||||
draw_splitbar(hWnd, last_split);
|
||||
if (GetCapture()==hWnd && pChildWnd->last_split>=0)
|
||||
draw_splitbar(hWnd, pChildWnd->last_split);
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_ESCAPE)
|
||||
if (GetCapture() == hWnd) {
|
||||
RECT rt;
|
||||
draw_splitbar(hWnd, last_split);
|
||||
draw_splitbar(hWnd, pChildWnd->last_split);
|
||||
GetClientRect(hWnd, &rt);
|
||||
ResizeWnd(pChildWnd, rt.right, rt.bottom);
|
||||
last_split = -1;
|
||||
pChildWnd->last_split = -1;
|
||||
ReleaseCapture();
|
||||
SetCursor(LoadCursor(0, IDC_ARROW));
|
||||
}
|
||||
|
@ -342,10 +395,10 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
int x = LOWORD(lParam);
|
||||
HDC hdc = GetDC(hWnd);
|
||||
GetClientRect(hWnd, &rt);
|
||||
rt.left = last_split-SPLIT_WIDTH/2;
|
||||
rt.right = last_split+SPLIT_WIDTH/2+1;
|
||||
rt.left = pChildWnd->last_split-SPLIT_WIDTH/2;
|
||||
rt.right = pChildWnd->last_split+SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
last_split = x;
|
||||
pChildWnd->last_split = x;
|
||||
rt.left = x-SPLIT_WIDTH/2;
|
||||
rt.right = x+SPLIT_WIDTH/2+1;
|
||||
InvertRect(hdc, &rt);
|
||||
|
@ -355,15 +408,15 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
|
||||
case WM_SETFOCUS:
|
||||
SetCurrentDirectory(pChildWnd->szPath);
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->right.hWnd: pChildWnd->left.hWnd);
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
|
||||
break;
|
||||
|
||||
case WM_DISPATCH_COMMAND:
|
||||
if (_CmdWndProc(hWnd, message, wParam, lParam)) break;
|
||||
if (1) {
|
||||
return SendMessage(pChildWnd->right.hWnd, message, wParam, lParam);
|
||||
return SendMessage(pChildWnd->hListWnd, message, wParam, lParam);
|
||||
} else {
|
||||
return SendMessage(pChildWnd->left.hWnd, message, wParam, lParam);
|
||||
return SendMessage(pChildWnd->hTreeWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -372,7 +425,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
||||
|
||||
// if (LOWORD(wParam) > ID_CMD_FIRST && LOWORD(wParam) < ID_CMD_LAST) {
|
||||
// if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
|
||||
// if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
|
||||
// return DefMDIChildProc(hWnd, message, wParam, lParam);
|
||||
// }
|
||||
// } else {
|
||||
|
@ -380,29 +433,35 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
// }
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
|
||||
if (!OnNotify(hWnd, wParam, lParam)) {
|
||||
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
/*
|
||||
{
|
||||
int idCtrl = (int)wParam;
|
||||
//NMHDR* pnmh = (NMHDR*)lParam;
|
||||
//return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &pChildWnd->left: &pChildWnd->right, pnmh);
|
||||
if ((int)wParam == IDW_TREE_LEFT) {
|
||||
if ((int)wParam == TREE_WINDOW) {
|
||||
if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) {
|
||||
Entry* entry = (Entry*)((NMTREEVIEW*)lParam)->itemNew.lParam;
|
||||
if (entry != NULL) {
|
||||
//RefreshList(pChildWnd->right.hWnd, entry);
|
||||
//RefreshList(pChildWnd->hListWnd, entry);
|
||||
//void set_curdir(ChildWnd* child, Entry* entry)
|
||||
set_curdir(pChildWnd, entry);
|
||||
}
|
||||
}
|
||||
if (!SendMessage(pChildWnd->left.hWnd, message, wParam, lParam)) {
|
||||
if (!SendMessage(pChildWnd->hTreeWnd, message, wParam, lParam)) {
|
||||
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
} else
|
||||
if ((int)wParam == IDW_TREE_RIGHT) {
|
||||
if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
|
||||
if ((int)wParam == LIST_WINDOW) {
|
||||
if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
|
||||
return DefMDIChildProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "debug.h"
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <shellapi.h>
|
||||
//#include <winspool.h>
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "settings.h"
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
|
@ -176,21 +172,20 @@ void free_entries(Entry* parent)
|
|||
}
|
||||
|
||||
// insert listbox entries after index idx
|
||||
void insert_entries(Pane* pane, Entry* parent, int idx)
|
||||
void insert_entries(HWND hWnd, Entry* parent, int idx)
|
||||
{
|
||||
/*
|
||||
Entry* entry = parent;
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
ShowWindow(pane->hWnd, SW_HIDE);
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
for(; entry; entry=entry->next) {
|
||||
#ifndef _LEFT_FILES
|
||||
if (pane->treePane && !(entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
|
||||
if (!(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)
|
||||
if ((entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
|
||||
&& entry->data.cFileName[0]==_T('.'))
|
||||
if (
|
||||
#ifndef _NO_EXTENSIONS
|
||||
|
@ -200,12 +195,11 @@ void insert_entries(Pane* pane, Entry* parent, int idx)
|
|||
continue;
|
||||
if (idx != -1)
|
||||
idx++;
|
||||
ListBox_InsertItemData(pane->hWnd, idx, entry);
|
||||
if (pane->treePane && entry->expanded)
|
||||
insert_entries(pane, entry->down, idx);
|
||||
ListBox_InsertItemData(hWnd, idx, entry);
|
||||
if (entry->expanded)
|
||||
insert_entries(hWnd, entry->down, idx);
|
||||
}
|
||||
ShowWindow(pane->hWnd, SW_SHOW);
|
||||
*/
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
}
|
||||
|
||||
|
||||
|
@ -213,22 +207,22 @@ void scan_entry(ChildWnd* child, Entry* entry)
|
|||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
/*
|
||||
int idx = ListBox_GetCurSel(child->left.hWnd);
|
||||
int idx = ListBox_GetCurSel(child->hTreeWnd);
|
||||
HCURSOR crsrOld = SetCursor(LoadCursor(0, IDC_WAIT));
|
||||
|
||||
// delete sub entries in left pane
|
||||
for(;;) {
|
||||
LRESULT res = ListBox_GetItemData(child->left.hWnd, idx+1);
|
||||
LRESULT res = ListBox_GetItemData(child->hTreeWnd, idx+1);
|
||||
Entry* sub = (Entry*) res;
|
||||
|
||||
if (res==LB_ERR || !sub || sub->level<=entry->level)
|
||||
break;
|
||||
|
||||
ListBox_DeleteString(child->left.hWnd, idx+1);
|
||||
ListBox_DeleteString(child->hTreeWnd, idx+1);
|
||||
}
|
||||
|
||||
// empty right pane
|
||||
ListBox_ResetContent(child->right.hWnd);
|
||||
ListBox_ResetContent(child->hListWnd);
|
||||
*/
|
||||
// release memory
|
||||
free_entries(entry);
|
||||
|
@ -274,12 +268,12 @@ BOOL expand_entry(ChildWnd* child, Entry* dir)
|
|||
if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
|
||||
return FALSE;
|
||||
/*
|
||||
idx = ListBox_FindItemData(child->left.hWnd, 0, dir);
|
||||
idx = ListBox_FindItemData(child->hTreeWnd, 0, dir);
|
||||
*/
|
||||
dir->expanded = TRUE;
|
||||
|
||||
// insert entries in left pane
|
||||
insert_entries(&child->left, p, idx);
|
||||
insert_entries(child->hTreeWnd, p, idx);
|
||||
/*
|
||||
if (!child->header_wdths_ok) {
|
||||
if (calc_widths(&child->left, FALSE)) {
|
||||
|
@ -335,7 +329,7 @@ void activate_entry(ChildWnd* child, Pane* pane)
|
|||
if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='\0')
|
||||
return;
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='.' && entry->data.cFileName[2]=='\0') {
|
||||
entry = child->left.cur->up;
|
||||
collapse_entry(&child->left, entry);
|
||||
|
@ -346,15 +340,14 @@ void activate_entry(ChildWnd* child, Pane* pane)
|
|||
expand_entry(child, child->left.cur);
|
||||
|
||||
if (!pane->treePane) focus_entry: {
|
||||
int idx = ListBox_FindItemData(child->left.hWnd, ListBox_GetCurSel(child->left.hWnd), entry);
|
||||
ListBox_SetCurSel(child->left.hWnd, idx);
|
||||
int idx = ListBox_FindItemData(child->hTreeWnd, ListBox_GetCurSel(child->hTreeWnd), entry);
|
||||
ListBox_SetCurSel(child->hTreeWnd, idx);
|
||||
set_curdir(child, entry);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
if (!scanned_old) {
|
||||
calc_widths(pane, FALSE);
|
||||
|
||||
#ifndef _NO_EXTENSIONS
|
||||
set_header(pane);
|
||||
#endif
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
|
||||
typedef struct _Entry {
|
||||
struct _Entry* next;
|
||||
|
@ -74,9 +69,6 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
HWND hWnd;
|
||||
#ifndef _NO_EXTENSIONS
|
||||
HWND hwndHeader;
|
||||
#endif
|
||||
|
||||
#ifndef _NO_EXTENSIONS
|
||||
#define COLUMNS 10
|
||||
|
@ -86,29 +78,30 @@ typedef struct {
|
|||
int widths[COLUMNS];
|
||||
int positions[COLUMNS+1];
|
||||
|
||||
BOOL treePane;
|
||||
int visible_cols;
|
||||
Entry* root;
|
||||
Entry* cur;
|
||||
} Pane;
|
||||
|
||||
typedef struct {
|
||||
HWND hWnd;
|
||||
HWND hTreeWnd;
|
||||
HWND hListWnd;
|
||||
int nFocusPanel; // 0: left 1: right
|
||||
int nSplitPos;
|
||||
WINDOWPLACEMENT pos;
|
||||
TCHAR szPath[MAX_PATH];
|
||||
|
||||
// Root root;
|
||||
Root* pRoot;
|
||||
Pane left;
|
||||
Pane right;
|
||||
int nFocusPanel; // 0: left 1: right
|
||||
WINDOWPLACEMENT pos;
|
||||
int nSplitPos;
|
||||
BOOL header_wdths_ok;
|
||||
|
||||
TCHAR szPath[MAX_PATH];
|
||||
Root root;
|
||||
|
||||
SORT_ORDER sortOrder;
|
||||
int last_split;
|
||||
|
||||
} ChildWnd;
|
||||
|
||||
|
||||
void insert_entries(Pane* pane, Entry* parent, int idx);
|
||||
void insert_entries(HWND hWnd, Entry* parent, int idx);
|
||||
void scan_entry(ChildWnd* child, Entry* entry);
|
||||
void activate_entry(ChildWnd* child, Pane* pane);
|
||||
void collapse_entry(Pane* pane, Entry* dir);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
//#include <shellapi.h>
|
||||
#include <windowsx.h>
|
||||
|
@ -150,19 +146,25 @@ BOOL FindChildWindow(int cmd)
|
|||
static ChildWnd* alloc_child_window(LPCTSTR path)
|
||||
{
|
||||
TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
|
||||
ChildWnd* pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
|
||||
Root* root = &pChildWnd->root;
|
||||
Entry* entry;
|
||||
Root* root;
|
||||
// ChildWnd* pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
|
||||
// memset(pChildWnd, 0, sizeof(ChildWnd));
|
||||
ChildWnd* pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd)+sizeof(Root));
|
||||
memset(pChildWnd, 0, sizeof(ChildWnd)+sizeof(Root));
|
||||
pChildWnd->pRoot = (Root*)((BYTE*)pChildWnd + sizeof(ChildWnd));
|
||||
pChildWnd->pRoot = (Root*)&pChildWnd[1];
|
||||
root = pChildWnd->pRoot;
|
||||
|
||||
memset(pChildWnd, 0, sizeof(ChildWnd));
|
||||
pChildWnd->left.treePane = TRUE;
|
||||
pChildWnd->left.visible_cols = 0;
|
||||
pChildWnd->right.treePane = FALSE;
|
||||
#ifndef _NO_EXTENSIONS
|
||||
pChildWnd->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_INDEX|COL_LINKS;
|
||||
#else
|
||||
pChildWnd->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES;
|
||||
#endif
|
||||
// root = &pChildWnd->root;
|
||||
// pChildWnd->left.treePane = TRUE;
|
||||
// pChildWnd->left.visible_cols = 0;
|
||||
// pChildWnd->right.treePane = FALSE;
|
||||
//#ifndef _NO_EXTENSIONS
|
||||
// pChildWnd->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_INDEX|COL_LINKS;
|
||||
//#else
|
||||
// pChildWnd->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES;
|
||||
//#endif
|
||||
pChildWnd->pos.length = sizeof(WINDOWPLACEMENT);
|
||||
pChildWnd->pos.flags = 0;
|
||||
pChildWnd->pos.showCmd = SW_SHOWNORMAL;
|
||||
|
@ -173,7 +175,7 @@ static ChildWnd* alloc_child_window(LPCTSTR path)
|
|||
pChildWnd->nFocusPanel = 0;
|
||||
pChildWnd->nSplitPos = 300;
|
||||
pChildWnd->sortOrder = SORT_NAME;
|
||||
pChildWnd->header_wdths_ok = FALSE;
|
||||
// pChildWnd->header_wdths_ok = FALSE;
|
||||
lstrcpy(pChildWnd->szPath, path);
|
||||
_tsplitpath(path, drv, dir, name, ext);
|
||||
#if !defined(_NO_EXTENSIONS) && defined(__linux__)
|
||||
|
@ -233,7 +235,7 @@ HWND CreateChildWindow(int drv_id)
|
|||
// CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
// CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
20, 20, 200, 200,
|
||||
WS_MAXIMIZE, 0
|
||||
WS_MAXIMIZE, (LPARAM)pChildWnd
|
||||
// 0/*style*/, 0/*lParam*/
|
||||
};
|
||||
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
|
||||
|
@ -346,7 +348,8 @@ static BOOL activate_drive_window(LPCTSTR path)
|
|||
child_wnd = GetNextWindow(child_wnd, GW_HWNDNEXT)) {
|
||||
ChildWnd* pChildWnd = (ChildWnd*) GetWindowLong(child_wnd, GWL_USERDATA);
|
||||
if (pChildWnd) {
|
||||
_tsplitpath(pChildWnd->root.path, drv2, 0, 0, 0);
|
||||
//_tsplitpath(pChildWnd->root.path, drv2, 0, 0, 0);
|
||||
_tsplitpath(pChildWnd->pRoot->path, drv2, 0, 0, 0);
|
||||
if (!lstrcmpi(drv2, drv1)) {
|
||||
SendMessage(Globals.hMDIClient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
|
||||
if (IsMinimized(child_wnd))
|
||||
|
@ -563,7 +566,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
case ID_HELP_ABOUT:
|
||||
#ifdef WINSHELLAPI
|
||||
ShellAbout(hWnd, szTitle, "", LoadIcon(Globals.hInstance, (LPCTSTR)IDI_WINFILE));
|
||||
ShellAbout(hWnd, szTitle, _T(""), LoadIcon(Globals.hInstance, (LPCTSTR)IDI_WINFILE));
|
||||
#else
|
||||
ShowAboutBox(hWnd);
|
||||
#endif
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
LRESULT CALLBACK FrameWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HWND CreateChildWindow(int drv_id);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
#include "main.h"
|
||||
|
@ -423,7 +419,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
//TODO: SetFocus(Globals.hDriveBar)
|
||||
SetFocus(child->nFocusPanel ? child->left.hWnd: child->right.hWnd);
|
||||
SetFocus(child->nFocusPanel ? child->hTreeWnd: child->hListWnd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -435,7 +431,7 @@ void CreateListWnd(HWND parent, Pane* pane, int id, LPTSTR lpszPathName)
|
|||
RECT rcClient; // dimensions of client area
|
||||
Entry* entry = pane->root;
|
||||
|
||||
pane->treePane = 0;
|
||||
// pane->treePane = 0;
|
||||
|
||||
GetClientRect(parent, &rcClient);
|
||||
pane->hWnd = CreateWindowEx(0, WC_LISTVIEW, _T("List View"),
|
||||
|
@ -462,3 +458,30 @@ void CreateListWnd(HWND parent, Pane* pane, int id, LPTSTR lpszPathName)
|
|||
InsertListEntries(pane->hWnd, entry, -1);
|
||||
}
|
||||
}
|
||||
|
||||
HWND CreateListView(HWND hwndParent, ChildWnd* pChildWnd, int id)
|
||||
{
|
||||
RECT rcClient;
|
||||
HWND hwndLV;
|
||||
|
||||
// Get the dimensions of the parent window's client area, and create the list view control.
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
|
||||
WS_VISIBLE | WS_CHILD | LVS_REPORT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
|
||||
|
||||
// Initialize the image list, and add items to the control.
|
||||
/*
|
||||
if (!InitListViewImageLists(hwndLV) ||
|
||||
!InitListViewItems(hwndLV, szName)) {
|
||||
DestroyWindow(hwndLV);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
CreateListColumns(hwndLV);
|
||||
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
||||
return hwndLV;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
void CreateListWnd(HWND parent, Pane* pane, int id, LPTSTR lpszPathName);
|
||||
void RefreshList(HWND hWnd, Entry* entry);
|
||||
|
||||
HWND CreateListView(HWND hwndParent, ChildWnd* pChildWnd, int id);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "settings.h"
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
#include "entries.h"
|
||||
|
@ -69,13 +66,16 @@ enum IMAGE {
|
|||
|
||||
#define IDW_FIRST_CHILD 0xC000 //0x200
|
||||
|
||||
#define IDW_TREE_LEFT 3
|
||||
#define IDW_TREE_RIGHT 6
|
||||
#define IDW_HEADER_LEFT 2
|
||||
#define IDW_HEADER_RIGHT 5
|
||||
//#define IDW_TREE_LEFT 3
|
||||
//#define IDW_TREE_RIGHT 6
|
||||
//#define IDW_HEADER_LEFT 2
|
||||
//#define IDW_HEADER_RIGHT 5
|
||||
|
||||
#define IDW_STATUS_WINDOW 7
|
||||
|
||||
#define TREE_WINDOW 8
|
||||
#define LIST_WINDOW 9
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void _wsplitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
|
||||
void _splitpath(const CHAR* path, CHAR* drv, CHAR* dir, CHAR* name, CHAR* ext);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "network.h"
|
||||
|
@ -160,7 +156,7 @@ static void NetErrorHandler(HWND hwnd, DWORD dwResult, LPTSTR str)
|
|||
static void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
|
||||
{
|
||||
LPTSTR str = NULL;
|
||||
TRACE(_T("DisplayStruct(%p)"), lpnrLocal);
|
||||
//TRACE(_T("DisplayStruct(%p)\n"), lpnrLocal);
|
||||
|
||||
switch (lpnrLocal->dwScope) {
|
||||
case RESOURCE_CONNECTED: str = _T("Enumerate currently connected resources. The dwUsage member cannot be specified."); break;
|
||||
|
@ -168,7 +164,7 @@ static void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
|
|||
case RESOURCE_REMEMBERED: str = _T("Enumerate remembered (persistent) connections. The dwUsage member cannot be specified."); break;
|
||||
default: str = _T("Unknown Scope."); break;
|
||||
}
|
||||
TRACE(_T(" %s\n"), str);
|
||||
//TRACE(_T(" %s\n"), str);
|
||||
|
||||
switch (lpnrLocal->dwType) {
|
||||
case RESOURCETYPE_ANY: str = _T("All resources."); break;
|
||||
|
@ -176,7 +172,7 @@ static void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
|
|||
case RESOURCETYPE_PRINT: str = _T("Print resources."); break;
|
||||
default: str = _T("Unknown Type."); break;
|
||||
}
|
||||
TRACE(_T(" %s\n"), str);
|
||||
//TRACE(_T(" %s\n"), str);
|
||||
|
||||
switch (lpnrLocal->dwDisplayType) {
|
||||
case RESOURCEDISPLAYTYPE_DOMAIN: str = _T("The object should be displayed as a domain."); break;
|
||||
|
@ -185,15 +181,15 @@ static void DisplayStruct(HDC hdc, LPNETRESOURCE lpnrLocal)
|
|||
case RESOURCEDISPLAYTYPE_GENERIC: str = _T("The method used to display the object does not matter."); break;
|
||||
default: str = _T("Unknown DisplayType."); break;
|
||||
}
|
||||
TRACE(_T(" %s\n"), str);
|
||||
//TRACE(_T(" %s\n"), str);
|
||||
|
||||
// switch (lpnrLocal->dwUsage ) {
|
||||
// case RESOURCEUSAGE_CONNECTABLE: str = _T("The resource is a connectable resource; the name pointed to by the lpRemoteName member can be passed to the WNetAddConnection function to make a network connection."); break;
|
||||
// case RESOURCEUSAGE_CONTAINER: str = _T("The resource is a container resource; the name pointed to by the lpRemoteName member can be passed to the WNetOpenEnum function to enumerate the resources in the container."); break;
|
||||
// default: str = _T("Unknown Usage."); break;
|
||||
// }
|
||||
TRACE(_T("\tLocalName: %s\tRemoteName: %s"), lpnrLocal->lpLocalName, lpnrLocal->lpRemoteName);
|
||||
TRACE(_T("\tComment: %s\tProvider: %s\n"), lpnrLocal->lpComment, lpnrLocal->lpProvider);
|
||||
//TRACE(_T("\tLocalName: %s\tRemoteName: %s"), lpnrLocal->lpLocalName, lpnrLocal->lpRemoteName);
|
||||
//TRACE(_T("\tComment: %s\tProvider: %s\n"), lpnrLocal->lpComment, lpnrLocal->lpProvider);
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "settings.h"
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "shell.h"
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <shellapi.h>
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
|
||||
#include "entries.h"
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -4,33 +4,13 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include "windows.h"
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifdef WIN32
|
||||
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
//#include <windows.h>
|
||||
//#include <assert.h>
|
||||
//WINBASEAPI VOID WINAPI DebugBreak(VOID);
|
||||
//WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString);
|
||||
//WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString);
|
||||
//void __stdcall DebugBreak(void);
|
||||
//void __stdcall OutputDebugStringA(char* lpOutputString);
|
||||
//void __stdcall OutputDebugStringW(wchar_t* lpOutputString);
|
||||
#ifdef UNICODE
|
||||
#define OutputDebugString OutputDebugStringW
|
||||
#else
|
||||
#define OutputDebugString OutputDebugStringA
|
||||
#endif // !UNICODE
|
||||
|
||||
#else
|
||||
#include "hardware.h"
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
|
||||
|
@ -46,20 +26,14 @@ void Trace(TCHAR* lpszFormat, ...)
|
|||
TCHAR szBuffer[512];
|
||||
|
||||
va_start(args, lpszFormat);
|
||||
// nBuf = vsprintf(szBuffer, lpszFormat, args);
|
||||
// nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
|
||||
#ifdef _UNICODE
|
||||
nBuf = _vsnwprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
|
||||
#else
|
||||
nBuf = _vsnprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
|
||||
#endif
|
||||
nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
|
||||
OutputDebugString(szBuffer);
|
||||
// was there an error? was the expanded string too long?
|
||||
// ASSERT(nBuf >= 0);
|
||||
//ASSERT(nBuf >= 0);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg)
|
||||
void Assert(void* assert, const char* file, int line, void* msg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
printf("ASSERT -- %s occured on line %u of file %s.\n",
|
||||
|
@ -70,13 +44,10 @@ void Assert(void* assert, TCHAR* file, int line, void* msg)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
//inline void Trace(TCHAR* lpszFormat, ...) { };
|
||||
//inline void Assert(void* assert, TCHAR* file, int line, void* msg) { };
|
||||
void Trace(TCHAR* lpszFormat, ...) { };
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
|
||||
void Assert(void* assert, const char* file, int line, void* msg) { };
|
||||
|
||||
#endif //_DEBUG
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,39 +1,30 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#ifndef __TRACE_H__
|
||||
#define __TRACE_H__
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
//=============================================================================
|
||||
// BreakPoint() macro.
|
||||
//=============================================================================
|
||||
|
||||
#ifdef _X86_
|
||||
#define BreakPoint() _asm { int 3h }
|
||||
#else
|
||||
#define BreakPoint() _DebugBreak()
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
// MACRO: ASSERT()
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp) \
|
||||
{ \
|
||||
if ( !(exp) ) \
|
||||
{ \
|
||||
Assert(#exp, __FILE__, __LINE__, NULL); \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, NULL); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
} \
|
||||
|
||||
#define ASSERTMSG(exp, msg) \
|
||||
{ \
|
||||
if ( !(exp) ) \
|
||||
{ \
|
||||
Assert(#exp, __FILE__, __LINE__, msg); \
|
||||
if (!(exp)) { \
|
||||
Assert(#exp, __FILE__, __LINE__, msg); \
|
||||
BreakPoint(); \
|
||||
} \
|
||||
}
|
||||
|
@ -43,30 +34,28 @@
|
|||
// MACRO: TRACE()
|
||||
//=============================================================================
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
void Trace1(int code, TCHAR* lpszFormat, ...);
|
||||
|
||||
#define TRACE Trace
|
||||
#define TRACE0 Trace
|
||||
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
//=============================================================================
|
||||
// Define away MACRO's ASSERT() and TRACE() in non debug builds
|
||||
//=============================================================================
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(exp)
|
||||
#define ASSERTMSG(exp, msg)
|
||||
#endif
|
||||
|
||||
//#define TRACE0 TRACE
|
||||
//#define TRACE1 TRACE
|
||||
|
||||
void Assert(void* assert, TCHAR* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
|
||||
#define TRACE 0 ? (void)0 : Trace
|
||||
|
||||
|
||||
#endif // !_DEBUG
|
||||
|
||||
|
||||
void Assert(void* assert, const char* file, int line, void* msg);
|
||||
void Trace(TCHAR* lpszFormat, ...);
|
||||
|
||||
|
||||
#endif // __TRACE_H__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <shellapi.h>
|
||||
|
@ -56,75 +52,47 @@ int Image_Open;
|
|||
int Image_Closed;
|
||||
int Image_Root;
|
||||
|
||||
static int s_init = 0;
|
||||
|
||||
#define CX_BITMAP 16
|
||||
#define CY_BITMAP 16
|
||||
#define NUM_BITMAPS 3
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
// 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, LPTSTR 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_CHILDREN | 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;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
Root* FindPathRoot(HWND hwndTV, HTREEITEM hItem, LPTSTR szPath, int* pPathLen, int max)
|
||||
{
|
||||
Root* pRoot = NULL;
|
||||
TVITEM item;
|
||||
item.mask = TVIF_PARAM;
|
||||
item.hItem = TreeView_GetParent(hwndTV, hItem);
|
||||
|
||||
if (TreeView_GetItem(hwndTV, &item)) {
|
||||
if (item.lParam == 0) {
|
||||
// recurse
|
||||
pRoot = FindPathRoot(hwndTV, item.hItem, szPath, pPathLen, max);
|
||||
szPath[*pPathLen] = _T('\\');
|
||||
++(*pPathLen);
|
||||
item.mask = TVIF_TEXT;
|
||||
item.hItem = hItem;
|
||||
item.pszText = &szPath[*pPathLen];
|
||||
item.cchTextMax = max - *pPathLen;
|
||||
if (TreeView_GetItem(hwndTV, &item)) {
|
||||
*pPathLen += _tcslen(item.pszText);
|
||||
}
|
||||
} else {
|
||||
// found root key with valid key value
|
||||
pRoot = (Root*)item.lParam;
|
||||
item.mask = TVIF_TEXT;
|
||||
item.hItem = hItem;
|
||||
item.pszText = szPath;
|
||||
item.cchTextMax = max;
|
||||
if (TreeView_GetItem(hwndTV, &item)) {
|
||||
*pPathLen += _tcslen(item.pszText);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pRoot;
|
||||
}
|
||||
|
||||
static void init_output(HWND hWnd)
|
||||
{
|
||||
|
@ -143,6 +111,7 @@ static void init_output(HWND hWnd)
|
|||
ReleaseDC(hWnd, hdc);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
|
||||
{
|
||||
|
@ -154,19 +123,7 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
|
|||
static HTREEITEM hPrevLev2Item = NULL;
|
||||
|
||||
//TRACE("AddEntryToTree(level:%u - %s)\n", entry->level, entry->data.cFileName);
|
||||
|
||||
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
|
||||
/*
|
||||
// Set the text of the item.
|
||||
tvi.pszText = entry->data.cFileName;
|
||||
tvi.cchTextMax = lstrlen(entry->data.cFileName);
|
||||
// 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)entry->level;
|
||||
*/
|
||||
tvi.pszText = LPSTR_TEXTCALLBACK;
|
||||
tvi.cchTextMax = 0;
|
||||
tvi.iImage = I_IMAGECALLBACK;
|
||||
|
@ -174,10 +131,8 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
|
|||
tvi.cChildren = I_CHILDRENCALLBACK;
|
||||
// Save the entry pointer in the item's application-defined data area.
|
||||
tvi.lParam = (LPARAM)entry;
|
||||
|
||||
tvins.item = tvi;
|
||||
tvins.hInsertAfter = hPrev;
|
||||
|
||||
// Set the parent item based on the specified level.
|
||||
if (entry->level == 0) {
|
||||
tvins.hParent = TVI_ROOT;
|
||||
|
@ -189,50 +144,51 @@ HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
|
|||
tvins.hParent = entry->up->hTreeItem;
|
||||
}
|
||||
}
|
||||
|
||||
// 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 (entry->level == 0)
|
||||
hPrevRootItem = hPrev;
|
||||
else if (entry->level == 1)
|
||||
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 (entry->level > 1) {
|
||||
HTREEITEM hti;
|
||||
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);
|
||||
}
|
||||
*/
|
||||
hItem = hPrev;
|
||||
return hItem;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static BOOL InitTreeViewItems(HWND hwndTV)
|
||||
static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, Root* entry, DWORD dwChildren)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HTREEITEM hItem = 0;
|
||||
TVITEM tvi;
|
||||
TVINSERTSTRUCT tvins;
|
||||
|
||||
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
|
||||
tvi.pszText = label;
|
||||
tvi.cchTextMax = lstrlen(tvi.pszText);
|
||||
tvi.iImage = Image_Closed;
|
||||
tvi.iSelectedImage = Image_Open;
|
||||
tvi.cChildren = dwChildren;
|
||||
tvi.lParam = (LPARAM)entry;
|
||||
tvins.item = tvi;
|
||||
if (entry) tvins.hInsertAfter = (HTREEITEM)TVI_LAST;
|
||||
else tvins.hInsertAfter = (HTREEITEM)TVI_SORT;
|
||||
tvins.hParent = hParent;
|
||||
hItem = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
|
||||
return hItem;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// insert treectrl entries after index idx
|
||||
static void insert_tree_entries(HWND hWnd, Entry* entry, int idx)
|
||||
static void insert_tree_entries(HWND hWnd, Entry* entry/*Root* pRoot*/, int idx)
|
||||
{
|
||||
static HTREEITEM hItemVisible;
|
||||
static int hItemVisibleIdx;
|
||||
// Entry* entry = &pRoot->entry;
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
if (entry->hTreeItem)
|
||||
return;
|
||||
|
||||
if (!entry) return;
|
||||
if (entry->hTreeItem) return;
|
||||
ShowWindow(hWnd, SW_HIDE);
|
||||
for(; entry; entry=entry->next) {
|
||||
#ifndef _LEFT_FILES
|
||||
|
@ -247,17 +203,18 @@ static void insert_tree_entries(HWND hWnd, Entry* entry, int idx)
|
|||
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);
|
||||
|
||||
|
||||
entry->hTreeItem = AddEntryToTree(hWnd, entry);
|
||||
if (entry->up && entry->up->hTreeItem) {
|
||||
// entry->hTreeItem = AddEntryToTree(hWnd, entry->up->hTreeItem, entry->data.cFileName, entry, 0);
|
||||
entry->hTreeItem = AddEntryToTree(hWnd, entry->up->hTreeItem, entry->data.cFileName, NULL, 1);
|
||||
} else {
|
||||
entry->hTreeItem = AddEntryToTree(hWnd, TVI_ROOT, entry->data.cFileName, NULL, 0);
|
||||
// AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwCount);
|
||||
}
|
||||
if (entry->expanded) {
|
||||
// insert_tree_entries(hWnd, entry->down, idx + 1);
|
||||
insert_tree_entries(hWnd, entry->down, idx + 1);
|
||||
TreeView_Expand(hWnd, entry->hTreeItem, TVE_EXPAND);
|
||||
}
|
||||
|
@ -272,6 +229,44 @@ static void insert_tree_entries(HWND hWnd, Entry* entry, int idx)
|
|||
ShowWindow(hWnd, SW_SHOW);
|
||||
}
|
||||
|
||||
static BOOL InitTreeViewItems(HWND hwndTV, ChildWnd* pChildWnd)
|
||||
{
|
||||
TVITEM tvi;
|
||||
TVINSERTSTRUCT tvins;
|
||||
HTREEITEM hRoot;
|
||||
TCHAR buffer[MAX_PATH];
|
||||
|
||||
wsprintf(buffer, _T("%s - [%s]"), pChildWnd->pRoot->path, pChildWnd->pRoot->fs);
|
||||
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM;
|
||||
tvi.pszText = buffer;
|
||||
tvi.cchTextMax = lstrlen(tvi.pszText);
|
||||
tvi.iImage = Image_Root;
|
||||
tvi.iSelectedImage = Image_Root;
|
||||
tvi.cChildren = 5;
|
||||
// tvi.lParam = (LPARAM)&pChildWnd->pRoot->entry;
|
||||
tvi.lParam = (LPARAM)pChildWnd->pRoot;
|
||||
// tvi.lParam = (LPARAM)pChildWnd;
|
||||
tvins.item = tvi;
|
||||
tvins.hInsertAfter = (HTREEITEM)TVI_FIRST;
|
||||
tvins.hParent = TVI_ROOT;
|
||||
// Add the item to the tree view control.
|
||||
hRoot = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
|
||||
pChildWnd->pRoot->entry.hTreeItem = hRoot;
|
||||
// TreeView_Expand(hwndTV, hRoot, TVE_EXPAND);
|
||||
// insert_tree_entries(hwndTV, &pChildWnd->pRoot->entry, 0);
|
||||
// insert entries into treectrl
|
||||
// if (pChildWnd->pRoot) {
|
||||
// insert_tree_entries(hwndTV, &pChildWnd->pRoot->entry, 0);
|
||||
// }
|
||||
// TreeView_Expand(hwndTV, pChildWnd->pRoot->entry.hTreeItem, TVE_EXPAND);
|
||||
// calculate column widths
|
||||
if (!s_init) {
|
||||
s_init = 1;
|
||||
init_output(hwndTV);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// InitTreeViewImageLists - creates an image list, adds three bitmaps
|
||||
// to it, and associates the image list with a tree view control.
|
||||
|
@ -313,31 +308,171 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
|
|||
|
||||
BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
||||
{
|
||||
Root* pRoot = NULL;
|
||||
TCHAR szPath[1000];
|
||||
int keyPathLen = 0;
|
||||
|
||||
static int expanding;
|
||||
|
||||
Entry* entry = (Entry*)pnmtv->itemNew.lParam;
|
||||
|
||||
if (expanding) return FALSE;
|
||||
if (pnmtv->itemNew.state & TVIS_EXPANDEDONCE ) {
|
||||
return TRUE;
|
||||
}
|
||||
expanding = TRUE;
|
||||
if (entry) {
|
||||
insert_tree_entries(hwndTV, entry->down, 0);
|
||||
// insert_tree_entries(hwndTV, entry, 0);
|
||||
// check if this is either the root or a subkey item...
|
||||
if ((Root*)pnmtv->itemNew.lParam == NULL) {
|
||||
szPath[0] = _T('\0');
|
||||
pRoot = FindPathRoot(hwndTV, pnmtv->itemNew.hItem, szPath, &keyPathLen, sizeof(szPath)/sizeof(TCHAR));
|
||||
} else {
|
||||
pRoot = (Root*)pnmtv->itemNew.lParam;
|
||||
szPath[0] = _T('\0');
|
||||
}
|
||||
if (pRoot != NULL) {
|
||||
// Root* pNewRoot = NULL;
|
||||
// insert_tree_entries(hwndTV, &pRoot->entry, 0);
|
||||
|
||||
insert_tree_entries(hwndTV, pRoot->entry.down, 0);
|
||||
|
||||
// entry->hTreeItem = AddEntryToTree(hWnd, entry->up->hTreeItem, entry->data.cFileName, NULL, 1);
|
||||
|
||||
/*
|
||||
HKEY hNewKey;
|
||||
LONG errCode = RegOpenKeyEx(hKey, szPath, 0, KEY_READ, &hNewKey);
|
||||
if (errCode == ERROR_SUCCESS) {
|
||||
TCHAR Name[MAX_PATH];
|
||||
DWORD cName = MAX_PATH;
|
||||
FILETIME LastWriteTime;
|
||||
DWORD dwIndex = 0L;
|
||||
//ShowWindow(hwndTV, SW_HIDE);
|
||||
while (RegEnumKeyEx(hNewKey, dwIndex, Name, &cName, NULL, NULL, NULL, &LastWriteTime) == ERROR_SUCCESS) {
|
||||
DWORD dwCount = 0L;
|
||||
errCode = RegOpenKeyEx(hNewKey, Name, 0, KEY_READ, &hKey);
|
||||
if (errCode == ERROR_SUCCESS) {
|
||||
TCHAR SubName[MAX_PATH];
|
||||
DWORD cSubName = MAX_PATH;
|
||||
while (RegEnumKeyEx(hKey, dwCount, SubName, &cSubName, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
|
||||
++dwCount;
|
||||
}
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwCount);
|
||||
cName = MAX_PATH;
|
||||
++dwIndex;
|
||||
}
|
||||
//ShowWindow(hwndTV, SW_SHOWNOACTIVATE);
|
||||
RegCloseKey(hNewKey);
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
}
|
||||
expanding = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
/*
|
||||
static void read_directory_win(Entry* parent, LPCTSTR path)
|
||||
{
|
||||
Entry* entry = (Entry*)malloc(sizeof(Entry));
|
||||
int level = parent->level + 1;
|
||||
Entry* last = 0;
|
||||
HANDLE hFind;
|
||||
HANDLE hFile;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define NMTVDISPINFO TV_DISPINFO
|
||||
#define NMTVDISPINFO TV_DISPINFO
|
||||
#endif
|
||||
TCHAR buffer[MAX_PATH], *p;
|
||||
for(p=buffer; *path; )
|
||||
*p++ = *path++;
|
||||
lstrcpy(p, _T("\\*"));
|
||||
memset(entry, 0, sizeof(Entry));
|
||||
hFind = FindFirstFile(buffer, &entry->data);
|
||||
if (hFind != INVALID_HANDLE_VALUE) {
|
||||
parent->down = entry;
|
||||
do {
|
||||
entry->down = 0;
|
||||
entry->up = parent;
|
||||
entry->expanded = FALSE;
|
||||
entry->scanned = FALSE;
|
||||
entry->level = level;
|
||||
entry->unix_dir = FALSE;
|
||||
entry->bhfi_valid = FALSE;
|
||||
lstrcpy(p+1, entry->data.cFileName);
|
||||
hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
|
||||
0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
if (GetFileInformationByHandle(hFile, &entry->bhfi))
|
||||
entry->bhfi_valid = TRUE;
|
||||
|
||||
static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
last = entry;
|
||||
entry = (Entry*) malloc(sizeof(Entry));
|
||||
memset(entry, 0, sizeof(Entry));
|
||||
if (last)
|
||||
last->next = entry;
|
||||
} while(FindNextFile(hFind, &entry->data));
|
||||
last->next = 0;
|
||||
FindClose(hFind);
|
||||
} else {
|
||||
parent->down = 0;
|
||||
}
|
||||
free(entry);
|
||||
parent->scanned = TRUE;
|
||||
}
|
||||
|
||||
|
||||
void read_directory(Entry* parent, LPCTSTR path, int sortOrder)
|
||||
{
|
||||
TCHAR buffer[MAX_PATH];
|
||||
Entry* entry;
|
||||
LPCTSTR s;
|
||||
PTSTR d;
|
||||
|
||||
read_directory_win(parent, path);
|
||||
if (Globals.prescan_node) {
|
||||
s = path;
|
||||
d = buffer;
|
||||
while(*s)
|
||||
*d++ = *s++;
|
||||
*d++ = _T('\\');
|
||||
for(entry=parent->down; entry; entry=entry->next)
|
||||
if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
lstrcpy(d, entry->data.cFileName);
|
||||
read_directory_win(entry, buffer);
|
||||
SortDirectory(entry, sortOrder);
|
||||
}
|
||||
}
|
||||
SortDirectory(parent, sortOrder);
|
||||
}
|
||||
|
||||
Entry* read_tree_win(Root* root, LPCTSTR path, int sortOrder)
|
||||
{
|
||||
TCHAR buffer[MAX_PATH];
|
||||
Entry* entry = &root->entry;
|
||||
LPCTSTR s = path;
|
||||
PTSTR d = buffer;
|
||||
|
||||
entry->unix_dir = FALSE;
|
||||
while(entry) {
|
||||
while(*s && *s!=_T('\\') && *s!=_T('/'))
|
||||
*d++ = *s++;
|
||||
while(*s==_T('\\') || *s==_T('/'))
|
||||
s++;
|
||||
*d++ = _T('\\');
|
||||
*d = _T('\0');
|
||||
read_directory(entry, buffer, sortOrder);
|
||||
if (entry->down)
|
||||
entry->expanded = TRUE;
|
||||
if (!*s)
|
||||
break;
|
||||
entry = find_entry_win(entry, s);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
*/
|
||||
void OnGetDispInfo(NMTVDISPINFO* ptvdi)
|
||||
{
|
||||
// static TCHAR buffer[200];
|
||||
// LVITEM* pItem = &(ptvdi->item);
|
||||
// Entry* entry = (Entry*)pItem->lParam;
|
||||
Entry* entry = (Entry*)ptvdi->item.lParam;
|
||||
Root* entry = (Root*)ptvdi->item.lParam;
|
||||
ASSERT(entry);
|
||||
|
||||
if (ptvdi->item.mask & TVIF_CHILDREN ) {
|
||||
|
@ -350,28 +485,11 @@ static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
|
|||
ptvdi->item.iSelectedImage = Image_Closed;
|
||||
}
|
||||
if (ptvdi->item.mask & TVIF_TEXT) {
|
||||
ptvdi->item.pszText = entry->data.cFileName;
|
||||
ptvdi->item.cchTextMax = lstrlen(entry->data.cFileName);
|
||||
// ptvdi->item.pszText = entry->data.cFileName;
|
||||
// ptvdi->item.cchTextMax = lstrlen(entry->data.cFileName);
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
void UpdateStatus(HWND hWnd, Entry* pEntry)
|
||||
{
|
||||
int file_count = 0;
|
||||
|
@ -388,7 +506,6 @@ void UpdateStatus(HWND hWnd, Entry* pEntry)
|
|||
}
|
||||
pEntry = pEntry->next;
|
||||
};
|
||||
|
||||
_tcscpy(suffix, _T(" bytes"));
|
||||
{
|
||||
NUMBERFMT numFmt;
|
||||
|
@ -410,9 +527,53 @@ void UpdateStatus(HWND hWnd, Entry* pEntry)
|
|||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
HWND CreateTreeView(HWND hwndParent, ChildWnd* pChildWnd, int id)
|
||||
{
|
||||
RECT rcClient;
|
||||
HWND hwndTV;
|
||||
|
||||
// Get the dimensions of the parent window's client area, and create the tree view control.
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"),
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_EX_CLIENTEDGE | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
// Initialize the image list, and add items to the control.
|
||||
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV, pChildWnd)) {
|
||||
DestroyWindow(hwndTV);
|
||||
return NULL;
|
||||
}
|
||||
SendMessage(hwndTV, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
||||
return hwndTV;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef _SUBWND_TREEVIEW
|
||||
|
||||
static WNDPROC g_orgTreeWndProc;
|
||||
|
||||
// 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 LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
|
||||
|
@ -468,50 +629,22 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
//TODO: SetFocus(Globals.hDriveBar)
|
||||
SetFocus(child->nFocusPanel ? child->left.hWnd: child->right.hWnd);
|
||||
SetFocus(child->nFocusPanel ? child->hTreeWnd: child->hListWnd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
static HWND CreateTreeView(HWND hwndParent, int id)
|
||||
{
|
||||
RECT rcClient;
|
||||
HWND hwndTV;
|
||||
|
||||
// Get the dimensions of the parent window's client area, and create the tree view control.
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"),
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_EX_CLIENTEDGE | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
// Initialize the image list, and add items to the control.
|
||||
if (!InitTreeViewImageLists(hwndTV) || !InitTreeViewItems(hwndTV)) {
|
||||
DestroyWindow(hwndTV);
|
||||
return NULL;
|
||||
}
|
||||
return hwndTV;
|
||||
}
|
||||
|
||||
//void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPTSTR lpszFileName)
|
||||
void CreateTreeWnd(HWND parent, Pane* pane, int id)
|
||||
{
|
||||
static int s_init = 0;
|
||||
Entry* entry = pane->root;
|
||||
|
||||
pane->treePane = 1;
|
||||
|
||||
pane->hWnd = CreateTreeView(parent, id);
|
||||
pane->hWnd = CreateTreeView(parent, NULL, id);
|
||||
SetWindowLong(pane->hWnd, GWL_USERDATA, (LPARAM)pane);
|
||||
g_orgTreeWndProc = SubclassWindow(pane->hWnd, TreeWndProc);
|
||||
SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
||||
|
||||
// insert entries into treectrl
|
||||
// insert entries into treectrl
|
||||
if (entry) {
|
||||
insert_tree_entries(pane->hWnd, entry, 0);
|
||||
}
|
||||
|
@ -521,8 +654,6 @@ void CreateTreeWnd(HWND parent, Pane* pane, int id)
|
|||
s_init = 1;
|
||||
init_output(pane->hWnd);
|
||||
}
|
||||
// calc_widths(pane, TRUE);
|
||||
//#ifndef _NO_EXTENSIONS
|
||||
// pane->hwndHeader = create_header(parent, pane, id_header);
|
||||
//#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,14 +27,21 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
//void CreateTreeWnd(HWND parent, Pane* pane, int id);
|
||||
//HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel);
|
||||
|
||||
void CreateTreeWnd(HWND parent, Pane* pane, int id);
|
||||
HWND CreateTreeView(HWND hwndParent, ChildWnd* pChildWnd, int id);
|
||||
void UpdateStatus(HWND hWnd, Entry* pEntry);
|
||||
|
||||
HTREEITEM AddItemToTree(HWND hwndTV, LPTSTR lpszItem, int nLevel);
|
||||
BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv);
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define NMTVDISPINFO TV_DISPINFO
|
||||
#define NMTVDISPINFO TV_DISPINFO
|
||||
#endif
|
||||
|
||||
void OnGetDispInfo(NMTVDISPINFO* ptvdi);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <ctype.h>
|
||||
|
@ -41,7 +37,7 @@
|
|||
#include "listview.h"
|
||||
#include "utils.h"
|
||||
#include "sort.h"
|
||||
#include "draw.h"
|
||||
|
||||
|
||||
#define FRM_CALC_CLIENT 0xBF83
|
||||
#define Frame_CalcFrameClient(hWnd, prt) ((BOOL)SNDMSG(hWnd, FRM_CALC_CLIENT, 0, (LPARAM)(PRECT)prt))
|
||||
|
@ -314,24 +310,24 @@ void set_curdir(ChildWnd* child, Entry* entry)
|
|||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
|
||||
child->left.cur = entry;
|
||||
child->right.root = entry;
|
||||
child->right.cur = entry;
|
||||
// child->left.cur = entry;
|
||||
// child->right.root = entry;
|
||||
// child->right.cur = entry;
|
||||
|
||||
if (!entry->scanned)
|
||||
scan_entry(child, entry);
|
||||
else {
|
||||
// ListBox_ResetContent(child->right.hWnd);
|
||||
// ListBox_ResetContent(child->hListWnd);
|
||||
// insert_entries(&child->right, entry->down, -1);
|
||||
|
||||
// RefreshList(child->right.hWnd, entry);
|
||||
// RefreshList(child->hListWnd, entry);
|
||||
|
||||
// calc_widths(&child->right, FALSE);
|
||||
//#ifndef _NO_EXTENSIONS
|
||||
// set_header(&child->right);
|
||||
//#endif
|
||||
}
|
||||
RefreshList(child->right.hWnd, entry->down);
|
||||
RefreshList(child->hListWnd, entry->down);
|
||||
|
||||
get_path(entry, path);
|
||||
lstrcpy(child->szPath, path);
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
|
||||
void display_error(HWND hWnd, DWORD error);
|
||||
void frame_get_clientspace(HWND hWnd, PRECT prect);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* 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>
|
||||
|
@ -32,7 +29,6 @@
|
|||
#include <tchar.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <process.h>
|
||||
|
|
Loading…
Reference in a new issue