Committing latest progress, still much TODO:
authorRobert Dickenson <robd@reactos.org>
Tue, 9 Jul 2002 19:46:14 +0000 (19:46 +0000)
committerRobert Dickenson <robd@reactos.org>
Tue, 9 Jul 2002 19:46:14 +0000 (19:46 +0000)
svn path=/trunk/; revision=3197

40 files changed:
rosapps/winfile/Makefile
rosapps/winfile/about.c
rosapps/winfile/childwnd.c [new file with mode: 0644]
rosapps/winfile/childwnd.h [new file with mode: 0644]
rosapps/winfile/debug.c
rosapps/winfile/dialogs.c
rosapps/winfile/dialogs.h
rosapps/winfile/draw.c
rosapps/winfile/draw.h
rosapps/winfile/entries.c
rosapps/winfile/entries.h
rosapps/winfile/format.h
rosapps/winfile/framewnd.c [new file with mode: 0644]
rosapps/winfile/framewnd.h [new file with mode: 0644]
rosapps/winfile/listview.c
rosapps/winfile/listview.h
rosapps/winfile/main.c
rosapps/winfile/main.h [new file with mode: 0644]
rosapps/winfile/res/drivebar.bmp [moved from rosapps/winfile/drivebar.bmp with 100% similarity]
rosapps/winfile/res/folder.bmp [moved from rosapps/winfile/folder1.bmp with 100% similarity]
rosapps/winfile/res/folder1.bmp [new file with mode: 0644]
rosapps/winfile/res/folder2.bmp [moved from rosapps/winfile/folder2.bmp with 100% similarity]
rosapps/winfile/res/folder3.bmp [moved from rosapps/winfile/folder3.bmp with 100% similarity]
rosapps/winfile/res/folder_open.bmp [new file with mode: 0644]
rosapps/winfile/res/images.bmp [moved from rosapps/winfile/images.bmp with 100% similarity]
rosapps/winfile/res/small.ico [moved from rosapps/winfile/small.ico with 100% similarity]
rosapps/winfile/res/toolbar.bmp [moved from rosapps/winfile/toolbar.bmp with 100% similarity]
rosapps/winfile/res/winfile.ico [moved from rosapps/winfile/winfile.ico with 100% similarity]
rosapps/winfile/resource.h
rosapps/winfile/run.c
rosapps/winfile/settings.c
rosapps/winfile/sort.c
rosapps/winfile/splitpath.c
rosapps/winfile/trace.c [new file with mode: 0644]
rosapps/winfile/trace.h [new file with mode: 0644]
rosapps/winfile/treeview.c
rosapps/winfile/treeview.h
rosapps/winfile/utils.c
rosapps/winfile/utils.h
rosapps/winfile/winfile.rc

index 49b5770..ffd93f5 100644 (file)
@@ -30,19 +30,20 @@ RCFLAGS = -DGCC -D_WIN32_IE=0x0400
 
 
 OBJS = about.o \
 
 
 OBJS = about.o \
-       debug.o \
+        framewnd.o \
+        childwnd.o \
+        debug.o \
         draw.o \
         entries.o \
         draw.o \
         entries.o \
-        main.o \
-        mdiclient.o \
         run.o \
         settings.o \
         splitpath.o \
         sort.o \
         utils.o \
         run.o \
         settings.o \
         splitpath.o \
         sort.o \
         utils.o \
-       treeview.o \
-       listview.o \
-       $(TARGET).o
+        treeview.o \
+        listview.o \
+        trace.o \
+        main.o
 
 LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
 
 
 LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
 
@@ -57,15 +58,19 @@ $(TARGET).exe:      $(OBJS) $(TARGET).coff
 
 about.o:       about.c about.h resource.h
 
 
 about.o:       about.c about.h resource.h
 
+main.o:                main.c main.h childwnd.h framewnd.h resource.h
+
+childwnd.o:    childwnd.c childwnd.h resource.h
+
+framewnd.o:    framewnd.c framewnd.h resource.h
+
 debug.o:       debug.c debug.h
 
 font.o:                font.c font.h
 
 debug.o:       debug.c debug.h
 
 font.o:                font.c font.h
 
-setttings.o:   setttings.c setttings.h resource.h
-
 run.o:         run.c run.h
 
 run.o:         run.c run.h
 
-mdiclient.o:   mdiclient.c mdiclient.h resource.h
+setttings.o:   setttings.c setttings.h resource.h
 
 $(TARGET).o:   $(TARGET).c $(TARGET).h resource.h
 
 
 $(TARGET).o:   $(TARGET).c $(TARGET).h resource.h
 
@@ -76,4 +81,4 @@ clean:
        - $(RM) $(TARGET).sym
        - $(RM) $(TARGET).coff
 
        - $(RM) $(TARGET).sym
        - $(RM) $(TARGET).coff
 
-include ../rules.mak
+include $(PATH_TO_TOP)/rules.mak
index afc38bc..9b42210 100644 (file)
@@ -34,7 +34,7 @@
 #include <stdio.h>
 #endif
     
 #include <stdio.h>
 #endif
     
-#include "winfile.h"
+#include "main.h"
 #include "about.h"
 
 
 #include "about.h"
 
 
diff --git a/rosapps/winfile/childwnd.c b/rosapps/winfile/childwnd.c
new file mode 100644 (file)
index 0000000..12a5401
--- /dev/null
@@ -0,0 +1,563 @@
+/*
+ *  ReactOS winfile
+ *
+ *  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 <windowsx.h>
+#include <ctype.h>
+#include <assert.h>
+#define ASSERT assert
+
+#include "main.h"
+#include "childwnd.h"
+#include "framewnd.h"
+#include "utils.h"
+#include "treeview.h"
+#include "listview.h"
+#include "debug.h"
+#include "draw.h"
+
+
+#ifdef _NO_EXTENSIONS
+//#define      COLOR_SPLITBAR          WHITE_BRUSH
+#define        COLOR_SPLITBAR          LTGRAY_BRUSH
+#else
+#define        COLOR_SPLITBAR          LTGRAY_BRUSH
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Global Variables:
+//
+
+HWND hSplitWnd;                  // Splitter Bar Control Window
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Local module support methods
+//
+
+#ifndef _NO_EXTENSIONS
+
+void set_header(Pane* pane)
+{
+       HD_ITEM item;
+       int scroll_pos = GetScrollPos(pane->hWnd, SB_HORZ);
+       int i=0, x=0;
+
+       item.mask = HDI_WIDTH;
+       item.cxy = 0;
+
+       for(; x+pane->widths[i]<scroll_pos && i<COLUMNS; i++) {
+               x += pane->widths[i];
+               Header_SetItem(pane->hwndHeader, i, &item);
+       }
+
+       if (i < COLUMNS) {
+               x += pane->widths[i];
+               item.cxy = x - scroll_pos;
+               Header_SetItem(pane->hwndHeader, i++, &item);
+
+               for(; i<COLUMNS; i++) {
+                       item.cxy = pane->widths[i];
+                       x += pane->widths[i];
+                       Header_SetItem(pane->hwndHeader, i, &item);
+               }
+       }
+}
+
+static LRESULT pane_notify(Pane* pane, NMHDR* pnmh)
+{
+       switch(pnmh->code) {
+       case HDN_TRACK:
+       case HDN_ENDTRACK:
+               {
+               HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
+               int idx = phdn->iItem;
+               int dx = phdn->pitem->cxy - pane->widths[idx];
+               int i;
+
+               RECT clnt;
+               GetClientRect(pane->hWnd, &clnt);
+                // move immediate to simulate HDS_FULLDRAG (for now [04/2000] not realy needed with WINELIB)
+               Header_SetItem(pane->hwndHeader, idx, phdn->pitem);
+               pane->widths[idx] += dx;
+               for (i = idx; ++i <= COLUMNS; )
+                       pane->positions[i] += dx;
+               {
+               int scroll_pos = GetScrollPos(pane->hWnd, SB_HORZ);
+               RECT rt_scr = {pane->positions[idx+1]-scroll_pos, 0, clnt.right, clnt.bottom};
+               RECT rt_clip = {pane->positions[idx]-scroll_pos, 0, clnt.right, clnt.bottom};
+               if (rt_scr.left < 0) rt_scr.left = 0;
+               if (rt_clip.left < 0) rt_clip.left = 0;
+               ScrollWindowEx(pane->hWnd, dx, 0, &rt_scr, &rt_clip, 0, 0, SW_INVALIDATE);
+               rt_clip.right = pane->positions[idx+1];
+               RedrawWindow(pane->hWnd, &rt_clip, 0, RDW_INVALIDATE|RDW_UPDATENOW);
+               if (pnmh->code == HDN_ENDTRACK) {
+                       ListBox_SetHorizontalExtent(pane->hWnd, pane->positions[COLUMNS]);
+                       if (GetScrollPos(pane->hWnd, SB_HORZ) != scroll_pos)
+                               set_header(pane);
+               }
+               }
+               }
+               return FALSE;
+       case HDN_DIVIDERDBLCLICK:
+               {
+               HD_NOTIFY* phdn = (HD_NOTIFY*) pnmh;
+               HD_ITEM item;
+               calc_single_width(pane, phdn->iItem);
+               item.mask = HDI_WIDTH;
+               item.cxy = pane->widths[phdn->iItem];
+               Header_SetItem(pane->hwndHeader, phdn->iItem, &item);
+               InvalidateRect(pane->hWnd, 0, TRUE);
+               break;
+               }
+       }
+       return 0;
+}
+
+#endif
+
+
+static BOOL pane_command(Pane* pane, UINT cmd)
+{
+       switch(cmd) {
+       case ID_VIEW_NAME:
+               if (pane->visible_cols) {
+                       pane->visible_cols = 0;
+                       calc_widths(pane, TRUE);
+#ifndef _NO_EXTENSIONS
+                       set_header(pane);
+#endif
+                       InvalidateRect(pane->hWnd, 0, TRUE);
+                       CheckMenuItem(Globals.hMenuView, ID_VIEW_NAME, MF_BYCOMMAND|MF_CHECKED);
+//                     CheckMenuItem(Globals.hMenuView, ID_VIEW_ALL_ATTRIBUTES, MF_BYCOMMAND);
+//                     CheckMenuItem(Globals.hMenuView, ID_VIEW_SELECTED_ATTRIBUTES, MF_BYCOMMAND);
+               }
+               break;
+#if 0
+       case ID_VIEW_ALL_ATTRIBUTES:
+               if (pane->visible_cols != COL_ALL) {
+                       pane->visible_cols = COL_ALL;
+                       calc_widths(pane, TRUE);
+#ifndef _NO_EXTENSIONS
+                       set_header(pane);
+#endif
+                       InvalidateRect(pane->hWnd, 0, TRUE);
+                       CheckMenuItem(Globals.hMenuView, ID_VIEW_NAME, MF_BYCOMMAND);
+//                     CheckMenuItem(Globals.hMenuView, ID_VIEW_ALL_ATTRIBUTES, MF_BYCOMMAND|MF_CHECKED);
+//                     CheckMenuItem(Globals.hMenuView, ID_VIEW_SELECTED_ATTRIBUTES, MF_BYCOMMAND);
+               }
+               break;
+#ifndef _NO_EXTENSIONS
+       case ID_PREFERED_SIZES: {
+               calc_widths(pane, TRUE);
+               set_header(pane);
+               InvalidateRect(pane->hWnd, 0, TRUE);
+               break;}
+#endif
+#endif
+               // TODO: more command ids...
+       default:
+               return FALSE;
+       }
+       return TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//    hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD,
+//                            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 
+//                            Globals.hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL);
+//    if (!hSplitWnd)
+//        return FALSE;
+//    hTreeWnd = CreateTreeView(Globals.hMDIClient, "c:\\foobar.txt");
+//    if (!hTreeWnd)
+//        return FALSE;
+//    hListWnd = CreateListView(Globals.hMDIClient, "");
+//    if (!hListWnd)
+//        return FALSE;
+//
+////////////////////////////////////////////////////////////////////////////////
+
+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);
+}
+
+#if 1
+static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
+{
+    HBRUSH lastBrush;
+       PAINTSTRUCT ps;
+       RECT rt;
+
+       BeginPaint(hWnd, &ps);
+       GetClientRect(hWnd, &rt);
+    lastBrush = SelectObject(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR));
+    Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
+    SelectObject(ps.hdc, lastBrush);
+//    rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
+//    FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
+       EndPaint(hWnd, &ps);
+}
+#else
+static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
+{
+    HBRUSH lastBrush;
+       PAINTSTRUCT ps;
+       RECT rt;
+
+       GetClientRect(hWnd, &rt);
+       BeginPaint(hWnd, &ps);
+
+    lastBrush = SelectObject(ps.hdc, (HBRUSH)GetStockObject(WHITE_BRUSH));
+    Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
+    SelectObject(ps.hdc, lastBrush);
+    rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
+    FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
+/*
+    rt.left = pChildWnd->nSplitPos-SPLIT_WIDTH/2;
+    rt.right = pChildWnd->nSplitPos+SPLIT_WIDTH/2+1;
+       lastBrush = SelectBrush(ps.hdc, (HBRUSH)GetStockObject(COLOR_SPLITBAR));
+       Rectangle(ps.hdc, rt.left, rt.top-1, rt.right, rt.bottom+1);
+       SelectObject(ps.hdc, lastBrush);
+#ifdef _NO_EXTENSIONS
+       rt.top = rt.bottom - GetSystemMetrics(SM_CYHSCROLL);
+       FillRect(ps.hdc, &rt, GetStockObject(BLACK_BRUSH));
+#endif
+ */
+       EndPaint(hWnd, &ps);
+}
+#endif
+
+//void ResizeWnd(ChildWnd* child, int cx, int cy);
+static void ResizeWnd(ChildWnd* child, int cx, int cy)
+{
+       HDWP hdwp = BeginDeferWindowPos(4);
+       RECT rt = {0, 0, cx, cy};
+
+       cx = child->nSplitPos + SPLIT_WIDTH/2;
+#ifndef _NO_EXTENSIONS
+       {
+               WINDOWPOS wp;
+               HD_LAYOUT hdl = {&rt, &wp};
+               Header_Layout(child->left.hwndHeader, &hdl);
+               DeferWindowPos(hdwp, child->left.hwndHeader, wp.hwndInsertAfter,
+                                               wp.x-1, wp.y, child->nSplitPos-SPLIT_WIDTH/2+1, wp.cy, wp.flags);
+               DeferWindowPos(hdwp, child->right.hwndHeader, wp.hwndInsertAfter,
+                                               rt.left+cx+1, wp.y, wp.cx-cx+2, wp.cy, wp.flags);
+       }
+#endif
+       DeferWindowPos(hdwp, child->left.hWnd, 0, rt.left, rt.top, child->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
+       DeferWindowPos(hdwp, child->right.hWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
+       EndDeferWindowPos(hdwp);
+}
+
+static void OnSize(ChildWnd* pChildWnd, WPARAM wParam, LPARAM lParam)
+{
+    if (wParam != SIZE_MINIMIZED) {
+               ResizeWnd(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_CREATE:
+               CreateTreeWnd(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT, 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_list_window(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT);
+            return 0;
+                       break;
+
+               case WM_PAINT:
+            OnPaint(hWnd, pChildWnd);
+                       break;
+
+               case WM_NCDESTROY:
+//                     free_child_window(pChildWnd);
+                       SetWindowLong(hWnd, GWL_USERDATA, 0);
+                       break;
+
+               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;
+
+               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;
+                               ResizeWnd(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);
+                                       ResizeWnd(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;
+                                       ResizeWnd(pChildWnd, rt.right, rt.bottom);
+                                       rt.left = x-SPLIT_WIDTH/2;
+                                       rt.right = x+SPLIT_WIDTH/2+1;
+                                       InvalidateRect(hWnd, &rt, FALSE);
+                                       UpdateWindow(pChildWnd->left.hWnd);
+                                       UpdateWindow(hWnd);
+                                       UpdateWindow(pChildWnd->right.hWnd);
+                               }
+#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->right.hWnd: pChildWnd->left.hWnd);
+                       break;
+
+               case WM_COMMAND:
+            {
+                       Pane* pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right;
+
+                       switch(HIWORD(wParam)) {
+                               case LBN_SELCHANGE: {
+                                       int idx = ListBox_GetCurSel(pane->hWnd);
+                                       Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, idx);
+
+                                       if (pane == &pChildWnd->left)
+                                               set_curdir(pChildWnd, entry);
+                                       else
+                                               pane->cur = entry;
+                                       break;}
+
+                               case LBN_DBLCLK:
+                                       activate_entry(pChildWnd, pane);
+                                       break;
+                       }
+                       }
+                       break;
+
+               case WM_DISPATCH_COMMAND: {
+                       Pane* pane = GetFocus()==pChildWnd->left.hWnd? &pChildWnd->left: &pChildWnd->right;
+
+                       switch(LOWORD(wParam)) {
+                               case ID_WINDOW_NEW_WINDOW:
+                    //CreateChildWindow(pChildWnd->szPath);
+                    CreateChildWindow(-1);
+//                    {
+//                                     ChildWnd* new_child = alloc_child_window(pChildWnd->szPath);
+//                                     if (!create_child_window(new_child))
+//                                             free(new_child);
+//                    }
+                                       break;
+#if 0
+                               case ID_REFRESH:
+                                       scan_entry(pChildWnd, pane->cur);
+                                       break;
+                               case ID_ACTIVATE:
+                                       activate_entry(pChildWnd, pane);
+                                       break;
+#endif
+                               case ID_WINDOW_CASCADE:
+                                       SendMessage(Globals.hMDIClient, WM_MDICASCADE, 0, 0);
+                                       break;
+                               case ID_WINDOW_TILE_HORZ:
+                                       SendMessage(Globals.hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
+                                       break;
+                               case ID_WINDOW_TILE_VERT:
+                                       SendMessage(Globals.hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
+                                       break;
+                               case ID_WINDOW_ARRANGE_ICONS:
+                                       SendMessage(Globals.hMDIClient, WM_MDIICONARRANGE, 0, 0);
+                                       break;
+                               default:
+                                       return pane_command(pane, LOWORD(wParam));
+                       }
+
+                       return TRUE;}
+
+//#ifndef _NO_EXTENSIONS
+               case WM_NOTIFY: {
+            int idCtrl = (int)wParam; 
+                       NMHDR* pnmh = (NMHDR*)lParam;
+
+                       //return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &pChildWnd->left: &pChildWnd->right, pnmh);
+            if (idCtrl == IDW_TREE_LEFT) {
+                SendMessage(pChildWnd->left.hWnd, message, wParam, lParam);
+            }
+            if (idCtrl == IDW_TREE_RIGHT) {
+                SendMessage(pChildWnd->right.hWnd, message, wParam, lParam);
+            }
+                        }
+//#endif
+            break;
+
+               case WM_SIZE:
+            if (wParam != SIZE_MINIMIZED) {
+                OnSize(pChildWnd, wParam, lParam);
+            }
+            // fall through
+               default: def:
+                       return DefMDIChildProc(hWnd, message, wParam, lParam);
+       }
+       return 0;
+}
+
+/*
+RegenerateUserEnvironment
+ */
+ATOM RegisterChildWnd(HINSTANCE hInstance, int res_id)
+{
+       WNDCLASSEX wcFrame = {
+               sizeof(WNDCLASSEX),
+               CS_HREDRAW | CS_VREDRAW/*style*/,
+               FrameWndProc,
+               0/*cbClsExtra*/,
+               0/*cbWndExtra*/,
+               hInstance,
+               LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINFILE)),
+               LoadCursor(0, IDC_ARROW),
+               0/*hbrBackground*/,
+               0/*lpszMenuName*/,
+               szFrameClass,
+               (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_WINFILE), IMAGE_ICON,
+                       GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
+       };
+       ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
+    return hFrameWndClass;
+}
diff --git a/rosapps/winfile/childwnd.h b/rosapps/winfile/childwnd.h
new file mode 100644 (file)
index 0000000..0c7c8cc
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ *  ReactOS winfile
+ *
+ *  childwnd.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 __CHILD_WND_H__
+#define __CHILD_WND_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // __CHILD_WND_H__
index 590160a..a4e47a9 100644 (file)
@@ -34,6 +34,6 @@
 #include <stdio.h>
 #endif
     
 #include <stdio.h>
 #endif
     
-#include "winfile.h"
+#include "main.h"
 #include "debug.h"
 
 #include "debug.h"
 
index 889d5c1..5036b55 100644 (file)
@@ -42,7 +42,7 @@
 #include <assert.h>
 #define ASSERT assert
 
 #include <assert.h>
 #define ASSERT assert
 
-#include "winfile.h"
+#include "main.h"
 #include "about.h"
 #include "dialogs.h"
 #include "utils.h"
 #include "about.h"
 #include "dialogs.h"
 #include "utils.h"
@@ -55,25 +55,25 @@ struct ExecuteDialog {
 };
 
 
 };
 
 
-BOOL CALLBACK ExecuteDialogWndProg(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
+BOOL CALLBACK ExecuteDialogWndProg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
        static struct ExecuteDialog* dlg;
 
 {
        static struct ExecuteDialog* dlg;
 
-       switch(nmsg) {
+       switch(message) {
                case WM_INITDIALOG:
                case WM_INITDIALOG:
-                       dlg = (struct ExecuteDialog*) lparam;
+                       dlg = (struct ExecuteDialog*) lParam;
                        return 1;
 
                case WM_COMMAND: {
                        return 1;
 
                case WM_COMMAND: {
-                       int id = (int)wparam;
+                       int id = (int)wParam;
 
                        if (id == IDOK) {
 
                        if (id == IDOK) {
-                               GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH);
-                               dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED?
+                               GetWindowText(GetDlgItem(hDlg, 201), dlg->cmd, MAX_PATH);
+                               dlg->cmdshow = Button_GetState(GetDlgItem(hDlg,214))&BST_CHECKED?
                                                                                                SW_SHOWMINIMIZED: SW_SHOWNORMAL;
                                                                                                SW_SHOWMINIMIZED: SW_SHOWNORMAL;
-                               EndDialog(hwnd, id);
+                               EndDialog(hDlg, id);
                        } else if (id == IDCANCEL)
                        } else if (id == IDCANCEL)
-                               EndDialog(hwnd, id);
+                               EndDialog(hDlg, id);
 
                        return 1;}
        }
 
                        return 1;}
        }
index 37a5bd2..59844fb 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
 #include "resource.h"
 
 
 #include "resource.h"
 
 
-BOOL CALLBACK ExecuteDialogWndProg(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
+BOOL CALLBACK ExecuteDialogWndProg(HWND, UINT, WPARAM, LPARAM);
 
 
 
 
 
 
index a290ad4..fc9aeb9 100644 (file)
@@ -34,7 +34,7 @@
 #include <stdio.h>
 #endif
     
 #include <stdio.h>
 #endif
     
-#include "winfile.h"
+#include "main.h"
 #include "utils.h"
 #include "draw.h"
 
 #include "utils.h"
 #include "draw.h"
 
@@ -515,21 +515,3 @@ void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
 #endif
 }
 
 #endif
 }
 
-
-
-#ifdef _NO_EXTENSIONS
-
-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);
-}
-
-#endif
-
index 2708773..b92481e 100644 (file)
@@ -28,10 +28,7 @@ extern "C" {
 #endif
 
 
 #endif
 
 
-
 void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol);
 void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol);
-void draw_splitbar(HWND hwnd, int x);
-
 
 
 #ifdef __cplusplus
 
 
 #ifdef __cplusplus
index 276c0b6..322d328 100644 (file)
@@ -36,7 +36,7 @@
     
 #include <windowsx.h>
 
     
 #include <windowsx.h>
 
-#include "winfile.h"
+#include "main.h"
 #include "entries.h"
 #include "utils.h"
 
 #include "entries.h"
 #include "utils.h"
 
@@ -177,8 +177,6 @@ void free_entries(Entry* parent)
        }
 }
 
        }
 }
 
-
-
 // insert listbox entries after index idx
 void insert_entries(Pane* pane, Entry* parent, int idx)
 {
 // insert listbox entries after index idx
 void insert_entries(Pane* pane, Entry* parent, int idx)
 {
@@ -186,15 +184,12 @@ void insert_entries(Pane* pane, Entry* parent, int idx)
 
        if (!entry)
                return;
 
        if (!entry)
                return;
-
-       ShowWindow(pane->hwnd, SW_HIDE);
-       
+       ShowWindow(pane->hWnd, SW_HIDE);
        for(; entry; entry=entry->next) {
 #ifndef _LEFT_FILES
                if (pane->treePane && !(entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
                        continue;
 #endif
        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('.'))
                 // don't display entries "." and ".." in the left pane
                if (pane->treePane && (entry->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
                                && entry->data.cFileName[0]==_T('.'))
@@ -204,39 +199,35 @@ void insert_entries(Pane* pane, Entry* parent, int idx)
 #endif
                                (entry->data.cFileName[1]==_T('.') && entry->data.cFileName[2]==_T('\0')))
                                continue;
 #endif
                                (entry->data.cFileName[1]==_T('.') && entry->data.cFileName[2]==_T('\0')))
                                continue;
-
                if (idx != -1)
                        idx++;
                if (idx != -1)
                        idx++;
-
-               ListBox_InsertItemData(pane->hwnd, idx, entry);
-
+               ListBox_InsertItemData(pane->hWnd, idx, entry);
                if (pane->treePane && entry->expanded)
                        insert_entries(pane, entry->down, idx);
        }
                if (pane->treePane && entry->expanded)
                        insert_entries(pane, entry->down, idx);
        }
-
-       ShowWindow(pane->hwnd, SW_SHOW);
+       ShowWindow(pane->hWnd, SW_SHOW);
 }
 
 
 void scan_entry(ChildWnd* child, Entry* entry)
 {
        TCHAR path[MAX_PATH];
 }
 
 
 void scan_entry(ChildWnd* child, Entry* entry)
 {
        TCHAR path[MAX_PATH];
-       int idx = ListBox_GetCurSel(child->left.hwnd);
+       int idx = ListBox_GetCurSel(child->left.hWnd);
        HCURSOR crsrOld = SetCursor(LoadCursor(0, IDC_WAIT));
 
         // delete sub entries in left pane
        for(;;) {
        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->left.hWnd, idx+1);
                Entry* sub = (Entry*) res;
 
                if (res==LB_ERR || !sub || sub->level<=entry->level)
                        break;
 
                Entry* sub = (Entry*) res;
 
                if (res==LB_ERR || !sub || sub->level<=entry->level)
                        break;
 
-               ListBox_DeleteString(child->left.hwnd, idx+1);
+               ListBox_DeleteString(child->left.hWnd, idx+1);
        }
 
         // empty right pane
        }
 
         // empty right pane
-       ListBox_ResetContent(child->right.hwnd);
+       ListBox_ResetContent(child->right.hWnd);
 
         // release memory
        free_entries(entry);
 
         // release memory
        free_entries(entry);
@@ -281,7 +272,7 @@ BOOL expand_entry(ChildWnd* child, Entry* dir)
        if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
                return FALSE;
 
        if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
                return FALSE;
 
-       idx = ListBox_FindItemData(child->left.hwnd, 0, dir);
+       idx = ListBox_FindItemData(child->left.hWnd, 0, dir);
 
        dir->expanded = TRUE;
 
 
        dir->expanded = TRUE;
 
@@ -304,24 +295,24 @@ BOOL expand_entry(ChildWnd* child, Entry* dir)
 
 void collapse_entry(Pane* pane, Entry* dir)
 {
 
 void collapse_entry(Pane* pane, Entry* dir)
 {
-       int idx = ListBox_FindItemData(pane->hwnd, 0, dir);
+       int idx = ListBox_FindItemData(pane->hWnd, 0, dir);
 
 
-       ShowWindow(pane->hwnd, SW_HIDE);
+       ShowWindow(pane->hWnd, SW_HIDE);
 
         // hide sub entries
        for(;;) {
 
         // hide sub entries
        for(;;) {
-               LRESULT res = ListBox_GetItemData(pane->hwnd, idx+1);
+               LRESULT res = ListBox_GetItemData(pane->hWnd, idx+1);
                Entry* sub = (Entry*) res;
 
                if (res==LB_ERR || !sub || sub->level<=dir->level)
                        break;
 
                Entry* sub = (Entry*) res;
 
                if (res==LB_ERR || !sub || sub->level<=dir->level)
                        break;
 
-               ListBox_DeleteString(pane->hwnd, idx+1);
+               ListBox_DeleteString(pane->hWnd, idx+1);
        }
 
        dir->expanded = FALSE;
 
        }
 
        dir->expanded = FALSE;
 
-       ShowWindow(pane->hwnd, SW_SHOW);
+       ShowWindow(pane->hWnd, SW_SHOW);
 }
 
 
 }
 
 
@@ -353,8 +344,8 @@ void activate_entry(ChildWnd* child, Pane* pane)
                        expand_entry(child, child->left.cur);
 
                        if (!pane->treePane) focus_entry: {
                        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->left.hWnd, ListBox_GetCurSel(child->left.hWnd), entry);
+                               ListBox_SetCurSel(child->left.hWnd, idx);
                                set_curdir(child, entry);
                        }
                }
                                set_curdir(child, entry);
                        }
                }
index 4b40a96..18d0e2b 100644 (file)
@@ -43,6 +43,7 @@ typedef struct _Entry {
        int             level;
 
        WIN32_FIND_DATA data;
        int             level;
 
        WIN32_FIND_DATA data;
+    HTREEITEM hTreeItem;
 
 #ifndef _NO_EXTENSIONS
        BY_HANDLE_FILE_INFORMATION bhfi;
 
 #ifndef _NO_EXTENSIONS
        BY_HANDLE_FILE_INFORMATION bhfi;
@@ -72,7 +73,7 @@ typedef struct {
 
 
 typedef struct {
 
 
 typedef struct {
-       HWND    hwnd;
+       HWND    hWnd;
 #ifndef _NO_EXTENSIONS
        HWND    hwndHeader;
 #endif
 #ifndef _NO_EXTENSIONS
        HWND    hwndHeader;
 #endif
@@ -92,15 +93,15 @@ typedef struct {
 } Pane;
 
 typedef struct {
 } Pane;
 
 typedef struct {
-       HWND    hwnd;
+       HWND    hWnd;
        Pane    left;
        Pane    right;
        Pane    left;
        Pane    right;
-       int             focus_pane;             // 0: left  1: right
+    int     nFocusPanel;      // 0: left  1: right
        WINDOWPLACEMENT pos;
        WINDOWPLACEMENT pos;
-       int             split_pos;
+       int             nSplitPos;
        BOOL    header_wdths_ok;
 
        BOOL    header_wdths_ok;
 
-       TCHAR   path[MAX_PATH];
+       TCHAR   szPath[MAX_PATH];
        Root    root;
 
        SORT_ORDER sortOrder;
        Root    root;
 
        SORT_ORDER sortOrder;
index 4539d3b..2ea3ca7 100644 (file)
@@ -10,8 +10,8 @@
    up the same dialog box that the Shell uses for disk formatting.
 
    PARAMETERS
    up the same dialog box that the Shell uses for disk formatting.
 
    PARAMETERS
-      hwnd    = The window handle of the window that will own the
-                dialog. NOTE that hwnd == NULL does not cause this
+      hWnd    = The window handle of the window that will own the
+                dialog. NOTE that hWnd == NULL does not cause this
                 dialog to come up as a "top level application"
                 window. This parameter should always be non-null,
                 this dialog box is only designed to be the child of
                 dialog to come up as a "top level application"
                 window. This parameter should always be non-null,
                 this dialog box is only designed to be the child of
@@ -59,7 +59,7 @@
          "format the same type you did last time".
 
    *****************************************************************/ 
          "format the same type you did last time".
 
    *****************************************************************/ 
-   DWORD WINAPI SHFormatDrive(HWND hwnd,
+   DWORD WINAPI SHFormatDrive(HWND hWnd,
                               UINT drive,
                               UINT fmtID,
                               UINT options);
                               UINT drive,
                               UINT fmtID,
                               UINT options);
diff --git a/rosapps/winfile/framewnd.c b/rosapps/winfile/framewnd.c
new file mode 100644 (file)
index 0000000..142a7f5
--- /dev/null
@@ -0,0 +1,549 @@
+/*
+ *  ReactOS winfile
+ *
+ *  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 <windowsx.h>
+#include <assert.h>
+#define ASSERT assert
+
+#include "main.h"
+#include "about.h"
+#include "framewnd.h"
+#include "childwnd.h"
+#include "utils.h"
+#include "run.h"
+#include "format.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Global Variables:
+//
+
+BOOL bInMenuLoop = FALSE;        // Tells us if we are in the menu loop
+int  nOldWidth;                  // Holds the previous client area width
+int  nOldHeight;                 // Holds the previous client area height
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Local module support methods
+//
+
+static void resize_frame_rect(HWND hWnd, PRECT prect)
+{
+       int new_top;
+       RECT rt;
+
+       if (IsWindowVisible(Globals.hToolBar)) {
+               SendMessage(Globals.hToolBar, WM_SIZE, 0, 0);
+               GetClientRect(Globals.hToolBar, &rt);
+               prect->top = rt.bottom+3;
+               prect->bottom -= rt.bottom+3;
+       }
+       if (IsWindowVisible(Globals.hDriveBar)) {
+               SendMessage(Globals.hDriveBar, WM_SIZE, 0, 0);
+               GetClientRect(Globals.hDriveBar, &rt);
+               new_top = --prect->top + rt.bottom+3;
+               MoveWindow(Globals.hDriveBar, 0, prect->top, rt.right, new_top, TRUE);
+               prect->top = new_top;
+               prect->bottom -= rt.bottom+2;
+       }
+       if (IsWindowVisible(Globals.hStatusBar)) {
+               SetupStatusBar(TRUE);
+//             int parts[] = {300, 500};
+//             SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
+//             SendMessage(Globals.hStatusBar, SB_SETPARTS, 2, (LPARAM)&parts);
+               GetClientRect(Globals.hStatusBar, &rt);
+               prect->bottom -= rt.bottom;
+       }
+       MoveWindow(Globals.hMDIClient, prect->left-1,prect->top-1,prect->right+2,prect->bottom+1, TRUE);
+}
+
+static void resize_frame(HWND hWnd, int cx, int cy)
+{
+       RECT rect = {0, 0, cx, cy};
+
+       resize_frame_rect(hWnd, &rect);
+}
+
+void resize_frame_client(HWND hWnd)
+{
+       RECT rect;
+
+       GetClientRect(hWnd, &rect);
+       resize_frame_rect(hWnd, &rect);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+static HHOOK hcbthook;
+static ChildWnd* newchild = NULL;
+
+static 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);
+}
+
+
+/*
+BOOL FindChildWindow(int cmd)
+{
+       TCHAR drv[_MAX_DRIVE];
+       LPCTSTR root = Globals.drives;
+       int i;
+       for(i = cmd - ID_DRIVE_FIRST; i--; root++)
+               while(*root)
+                       root++;
+       if (activate_drive_window(root))
+               return TRUE;
+       _tsplitpath(root, drv, 0, 0, 0);
+       if (!SetCurrentDirectory(drv)) {
+               display_error(hWnd, GetLastError());
+               //return TRUE;
+       }
+       return FALSE;
+}
+ */
+
+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;
+
+       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
+       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;
+       pChildWnd->sortOrder = SORT_NAME;
+       pChildWnd->header_wdths_ok = FALSE;
+       lstrcpy(pChildWnd->szPath, path);
+       _tsplitpath(path, drv, dir, name, ext);
+#if !defined(_NO_EXTENSIONS) && defined(__linux__)
+       if (*path == '/') {
+               root->drive_type = GetDriveType(path);
+               lstrcat(drv, _T("/"));
+               lstrcpy(root->volname, _T("root fs"));
+               root->fs_flags = 0;
+               lstrcpy(root->fs, _T("unixfs"));
+               lstrcpy(root->path, _T("/"));
+               entry = read_tree_unix(root, path, pChildWnd->sortOrder);
+    } else
+#endif
+       {
+               root->drive_type = GetDriveType(path);
+               lstrcat(drv, _T("\\"));
+               GetVolumeInformation(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR);
+               lstrcpy(root->path, drv);
+               entry = read_tree_win(root, path, pChildWnd->sortOrder);
+       }
+//@@lstrcpy(root->entry.data.cFileName, drv);
+       wsprintf(root->entry.data.cFileName, _T("%s - %s"), drv, root->fs);
+       root->entry.data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
+       pChildWnd->left.root = &root->entry;
+       set_curdir(pChildWnd, entry);
+       return pChildWnd;
+}
+
+HWND CreateChildWindow(int drv_id)
+{
+       //TCHAR drv[_MAX_DRIVE];
+       TCHAR path[MAX_PATH];
+       ChildWnd* pChildWnd = NULL;
+/*
+       LPCTSTR root = Globals.drives;
+       int i;
+       for(i = cmd - ID_DRIVE_FIRST; i--; root++)
+               while(*root)
+                       root++;
+       if (activate_drive_window(root))
+               return 0;
+       _tsplitpath(root, drv, 0, 0, 0);
+       if (!SetCurrentDirectory(drv)) {
+               display_error(hWnd, GetLastError());
+               return 0;
+       }
+ */
+       GetCurrentDirectory(MAX_PATH, path);
+//     pChildWnd = (ChildWnd*)malloc(sizeof(ChildWnd));
+       pChildWnd = alloc_child_window(path);
+//     if (!create_child_window(pChildWnd))
+//             free(pChildWnd);
+
+       if (pChildWnd != NULL) {
+        MDICREATESTRUCT mcs = {
+            szChildClass, path, hInst,
+            CW_USEDEFAULT, CW_USEDEFAULT,
+            CW_USEDEFAULT, CW_USEDEFAULT,
+            0/*style*/, 0/*lParam*/
+               };
+        hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
+       newchild = pChildWnd;
+        pChildWnd->hWnd = (HWND)SendMessage(Globals.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;
+}
+
+void OnEnterMenuLoop(HWND hWnd)
+{
+    int nParts;
+
+    // Update the status bar pane sizes
+    nParts = -1;
+    SendMessage(Globals.hStatusBar, SB_SETPARTS, 1, (long)&nParts);
+    bInMenuLoop = TRUE;
+    SendMessage(Globals.hStatusBar, SB_SETTEXT, (WPARAM)0, (LPARAM)_T(""));
+}
+
+void OnExitMenuLoop(HWND hWnd)
+{
+    RECT  rc;
+    int   nParts[3];
+
+    bInMenuLoop = FALSE;
+    // Update the status bar pane sizes
+    GetClientRect(hWnd, &rc);
+    nParts[0] = 100;
+    nParts[1] = 210;
+    nParts[2] = rc.right;
+    SendMessage(Globals.hStatusBar, SB_SETPARTS, 3, (long)nParts);
+    SendMessage(Globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
+       SetupStatusBar(TRUE);
+       UpdateStatusBar();
+}
+
+void OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
+{
+    TCHAR str[100];
+
+    strcpy(str, TEXT(""));
+    if (nFlags & MF_POPUP) {
+        if (hSysMenu != GetMenu(hWnd)) {
+            if (nItemID == 2) nItemID = 5;
+        }
+    }
+    if (LoadString(Globals.hInstance, nItemID, str, 100)) {
+        // load appropriate string
+        LPTSTR lpsz = str;
+        // first newline terminates actual string
+        lpsz = _tcschr(lpsz, '\n');
+        if (lpsz != NULL)
+            *lpsz = '\0';
+    }
+    SendMessage(Globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)str);
+}
+
+
+static BOOL activate_drive_window(LPCTSTR path)
+{
+       TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
+       HWND child_wnd;
+
+       _tsplitpath(path, drv1, 0, 0, 0);
+
+        // search for a already open window for the same drive
+       for (child_wnd = GetNextWindow(Globals.hMDIClient,GW_CHILD); 
+            child_wnd; 
+                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);
+                       if (!lstrcmpi(drv2, drv1)) {
+                               SendMessage(Globals.hMDIClient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);
+                               if (IsMinimized(child_wnd))
+                                       ShowWindow(child_wnd, SW_SHOWNORMAL);
+                               return TRUE;
+                       }
+               }
+       }
+       return FALSE;
+}
+
+static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
+{
+       BOOL vis = IsWindowVisible(hchild);
+
+       CheckMenuItem(Globals.hMenuOptions, cmd, vis?MF_BYCOMMAND:MF_BYCOMMAND|MF_CHECKED);
+       ShowWindow(hchild, vis?SW_HIDE:SW_SHOW);
+#ifndef _NO_EXTENSIONS
+       if (g_fullscreen.mode)
+               fullscreen_move(hWnd);
+#endif
+       resize_frame_client(hWnd);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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)
+{
+       UINT cmd = LOWORD(wParam);
+       HWND hChildWnd;
+//     HWND hwndClient = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
+//     if (hwndClient) 
+//         if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wParam, lParam))
+//                     return 0;
+
+       if (cmd >= ID_DRIVE_FIRST && cmd <= (ID_DRIVE_FIRST + 0xFF)) {
+               TCHAR drv[_MAX_DRIVE];
+               //TCHAR path[MAX_PATH];
+               //ChildWnd* pChildWnd;
+               LPCTSTR root = Globals.drives;
+               int i;
+               for (i = cmd - ID_DRIVE_FIRST; i--; root++)
+                       while (*root)
+                               root++;
+               if (activate_drive_window(root))
+                       return 0;
+               _tsplitpath(root, drv, 0, 0, 0);
+               if (!SetCurrentDirectory(drv)) {
+                       display_error(hWnd, GetLastError());
+                       return 0;
+               }
+               //GetCurrentDirectory(MAX_PATH, path); //@@ letztes Verzeichnis pro Laufwerk speichern
+        //CreateChildWindow(path);
+        CreateChildWindow(cmd - ID_DRIVE_FIRST);
+
+//             pChildWnd = alloc_child_window(path);
+//             if (!create_child_window(pChildWnd))
+//                     free(pChildWnd);
+       } else {
+               switch (cmd) {
+        case ID_WINDOW_CLOSEALL:
+            EnumChildWindows(Globals.hMDIClient, &CloseEnumProc, 0);
+            break;
+        case ID_WINDOW_CLOSE:
+            hChildWnd = (HWND) SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
+            if (!SendMessage(hChildWnd, WM_QUERYENDSESSION, 0, 0))
+                SendMessage(Globals.hMDIClient, WM_MDIDESTROY, (WPARAM)hChildWnd, 0);
+            break;
+        case ID_FILE_EXIT:
+            SendMessage(hWnd, WM_CLOSE, 0, 0);
+            break;
+        case ID_FILE_RUN:
+            OnFileRun();
+            break;
+               case ID_DISK_FORMAT_DISK:
+//                     SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
+                       {
+                               UINT OldMode = SetErrorMode(0); // Get the current Error Mode settings.
+                               SetErrorMode(OldMode & ~SEM_FAILCRITICALERRORS); // Force O/S to handle
+                               // Call SHFormatDrive here.
+                               SHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
+                               SetErrorMode(OldMode); // Put it back the way it was.                   
+                       }
+                       break;
+               case ID_OPTIONS_CONFIRMATION:
+                       {
+//                     struct ExecuteDialog dlg = {{0}};
+//                     if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_EXECUTE), hWnd, ExecuteDialogWndProg, (LPARAM)&dlg) == IDOK)
+//                             ShellExecute(hWnd, _T("open")/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
+                       }
+            break;
+               case ID_OPTIONS_FONT:
+            break;
+               case ID_OPTIONS_CUSTOMISE_TOOLBAR:
+            break;
+               case ID_OPTIONS_TOOLBAR:
+                       toggle_child(hWnd, cmd, Globals.hToolBar);
+            break;
+               case ID_OPTIONS_DRIVEBAR:
+                       toggle_child(hWnd, cmd, Globals.hDriveBar);
+            break;
+               case ID_OPTIONS_STATUSBAR:
+                       toggle_child(hWnd, cmd, Globals.hStatusBar);
+            break;
+               case ID_OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT:
+            break;
+               case ID_OPTIONS_MINIMISE_ON_USE:
+            break;
+        case ID_OPTIONS_SAVE_ON_EXIT:
+            break;
+
+               case ID_WINDOW_NEW_WINDOW:
+            CreateChildWindow(-1);
+//                     {
+//                     ChildWnd* pChildWnd = alloc_child_window(path);
+//                     if (!create_child_window(pChildWnd))
+//                             free(pChildWnd);
+//                     }
+                       break;
+               case ID_WINDOW_CASCADE:
+                       SendMessage(Globals.hMDIClient, WM_MDICASCADE, 0, 0);
+            break;
+               case ID_WINDOW_TILE_HORZ:
+                       SendMessage(Globals.hMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
+            break;
+               case ID_WINDOW_TILE_VERT:
+                       SendMessage(Globals.hMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
+            break;
+               case ID_WINDOW_ARRANGE_ICONS:
+                       SendMessage(Globals.hMDIClient, WM_MDIICONARRANGE, 0, 0);
+            break;
+               case ID_HELP_CONTENTS:
+                       WinHelp(hWnd, _T("winfile"), HELP_INDEX, 0);
+            break;
+               case ID_HELP_SEARCH_HELP:
+            break;
+               case ID_HELP_HOW_TO_USE_HELP:
+#ifdef WINSHELLAPI
+            ShellAbout(hWnd, szTitle, "", LoadIcon(Globals.hInstance, (LPCTSTR)IDI_WINFILE));
+#endif
+            break;
+        case ID_HELP_ABOUT:
+            ShowAboutBox(hWnd);
+            break;
+               default:
+/*
+                       if ((cmd<IDW_FIRST_CHILD || cmd>=IDW_FIRST_CHILD+0x100) &&
+                               (cmd<SC_SIZE || cmd>SC_RESTORE)) {
+                               MessageBox(hWnd, _T("Not yet implemented"), _T("Winefile"), MB_OK);
+                       }
+                       return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
+ */
+            hChildWnd = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0);
+            if (IsWindow(hChildWnd))
+                SendMessage(hChildWnd, WM_COMMAND, wParam, lParam);
+            else
+                           return DefFrameProc(hWnd, Globals.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(Globals.hMenuFrame, GetMenuItemCount(Globals.hMenuFrame)-2);
+        CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
+#if 0
+        hMDIClient = CreateWindow(_T("MDICLIENT"), NULL,
+                    WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
+                    0, 0, 0, 0,
+                    hWnd, (HMENU)1, hInst, &ccs);
+#else
+        Globals.hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
+                //WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
+                WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
+                0, 0, 0, 0,
+                hWnd, (HMENU)0, hInst, &ccs);
+#endif
+        }
+               break;
+       case WM_COMMAND:
+               return _CmdWndProc(hWnd, message, wParam, lParam);
+               break;
+       case WM_SIZE:
+        resize_frame_client(hWnd);
+               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;
+       case WM_DESTROY:
+               PostQuitMessage(0);
+               break;
+    case WM_QUERYENDSESSION:
+    case WM_CLOSE:
+        SendMessage(hWnd, WM_COMMAND, ID_WINDOW_CLOSEALL, 0);
+        if (GetWindow(Globals.hMDIClient, GW_CHILD) != NULL)
+            return 0;
+        // else fall thru...
+    default:
+        return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
+       }
+       return 0;
+}
diff --git a/rosapps/winfile/framewnd.h b/rosapps/winfile/framewnd.h
new file mode 100644 (file)
index 0000000..5b3cf95
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ *  ReactOS winfile
+ *
+ *  framewnd.h
+ *
+ *  Copyright (C) 2002  Robert Dickenson <robd@reactos.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __FRAME_WND_H__
+#define __FRAME_WND_H__
+
+#ifdef __cplusplus
+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);
+
+void resize_frame_client(HWND hWnd);
+//BOOL activate_drive_window(LPCTSTR path);
+//void toggle_child(HWND hWnd, UINT cmd, HWND hchild);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // __FRAME_WND_H__
index f437e75..04f0f14 100644 (file)
 #include <assert.h>
 #define ASSERT assert
 
 #include <assert.h>
 #define ASSERT assert
 
-#include "winfile.h"
+#include "main.h"
 #include "listview.h"
 //#include "entries.h"
 #include "utils.h"
 
 #include "listview.h"
 //#include "entries.h"
 #include "utils.h"
 
+#include "trace.h"
 
 // Global Variables:
 extern HINSTANCE hInst;
 
 
 
 // Global Variables:
 extern HINSTANCE hInst;
 
 
-HWND CreateListView(HWND hwndParent, LPSTR lpszFileName) 
+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);
+}
+
+static void AddEntryToList(HWND hwndLV, int idx, Entry* entry)
+{ 
+    LVITEM item;
+
+    item.mask = LVIF_TEXT | LVIF_PARAM; 
+    item.iItem = 0;//idx; 
+    item.iSubItem = 0; 
+    item.state = 0; 
+    item.stateMask = 0; 
+//    item.pszText = entry->data.cFileName; 
+    item.pszText = LPSTR_TEXTCALLBACK; 
+    item.cchTextMax = strlen(entry->data.cFileName); 
+    item.iImage = 0; 
+//    item.iImage = I_IMAGECALLBACK; 
+    item.lParam = (LPARAM)entry;
+#if (_WIN32_IE >= 0x0300)
+    item.iIndent = 0;
+#endif
+    ListView_InsertItem(hwndLV, &item);
+}
+
+// insert listctrl entries after index idx
+static void InsertListEntries(Pane* pane, Entry* parent, int idx)
+{
+       Entry* entry = parent;
+
+       if (!entry)
+               return;
+       ShowWindow(pane->hWnd, SW_HIDE);
+
+    if (idx == -1) {
+    }
+    idx = 0;
+
+       for(; entry; entry=entry->next) {
+#ifndef _LEFT_FILES
+               if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+                       continue;
+#endif
+        //ListBox_InsertItemData(pane->hWnd, idx, entry);
+        AddEntryToList(pane->hWnd, idx, entry); 
+        ++idx;
+       }
+       ShowWindow(pane->hWnd, SW_SHOW);
+}
+
+static void CreateListColumns(HWND hWndListView)
+{
+    char szText[50];
+    int index;
+    LV_COLUMN lvC;
+    // Create columns.
+    lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+    lvC.fmt = LVCFMT_LEFT;
+    lvC.cx = 175;
+    lvC.pszText = szText;
+
+    // Load the column labels from the resource file.
+    for (index = 0; index < 4; index++) {
+        lvC.iSubItem = index;
+        LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, sizeof(szText));
+        if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) {
+            // TODO: handle failure condition...
+            break;
+        }
+    }
+}
+
+static HWND CreateListView(HWND hwndParent, int id) 
 { 
     RECT rcClient;  // dimensions of client area 
     HWND hwndLV;    // handle to list view control 
 { 
     RECT rcClient;  // dimensions of client area 
     HWND hwndLV;    // handle to list view control 
+
     // Get the dimensions of the parent window's client area, and create the list view control. 
     GetClientRect(hwndParent, &rcClient); 
     hwndLV = CreateWindowEx(0, WC_LISTVIEW, "List View", 
     // Get the dimensions of the parent window's client area, and create the list view control. 
     GetClientRect(hwndParent, &rcClient); 
     hwndLV = CreateWindowEx(0, WC_LISTVIEW, "List View", 
-        WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES, 
+//        WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT | LVS_NOCOLUMNHEADER, 
+        WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT, 
+//        WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_LIST | LVS_NOCOLUMNHEADER,
         0, 0, rcClient.right, rcClient.bottom, 
         0, 0, rcClient.right, rcClient.bottom, 
-        hwndParent, (HMENU)LIST_WINDOW, hInst, NULL); 
+        hwndParent, (HMENU)id, hInst, NULL); 
+
     // Initialize the image list, and add items to the control. 
 /*
     if (!InitListViewImageLists(hwndLV) || 
     // Initialize the image list, and add items to the control. 
 /*
     if (!InitListViewImageLists(hwndLV) || 
-            !InitListViewItems(hwndLV, lpszFileName)) { 
+            !InitListViewItems(hwndLV, lpszPathName)) { 
         DestroyWindow(hwndLV); 
         return FALSE; 
     } 
  */
         DestroyWindow(hwndLV); 
         return FALSE; 
     } 
  */
+    ListView_SetExtendedListViewStyle(hwndLV,  LVS_EX_FULLROWSELECT);
+    CreateListColumns(hwndLV);
+
     return hwndLV;
 } 
 
     return hwndLV;
 } 
 
-const static LPTSTR g_pos_names[COLUMNS] = {
-       _T(""),                 // symbol
-       _T("Name"),
-       _T("Size"),
-       _T("CDate"),
-#ifndef _NO_EXTENSIONS
-       _T("ADate"),
-       _T("MDate"),
-       _T("Index/Inode"),
-       _T("Links"),
-#endif
-       _T("Attributes"),
-#ifndef _NO_EXTENSIONS
-       _T("Security")
-#endif
-};
-
-const static int g_pos_align[] = {
-       0,
-       HDF_LEFT,       // Name
-       HDF_RIGHT,      // Size
-       HDF_LEFT,       // CDate
-#ifndef _NO_EXTENSIONS
-       HDF_LEFT,       // ADate
-       HDF_LEFT,       // MDate
-       HDF_LEFT,       // Index
-       HDF_CENTER,     // Links
-#endif
-       HDF_CENTER,     // Attributes
-#ifndef _NO_EXTENSIONS
-       HDF_LEFT        // Security
-#endif
-};
-
-void resize_tree(ChildWnd* child, int cx, int cy)
-{
-       HDWP hdwp = BeginDeferWindowPos(4);
-       RECT rt = {0, 0, cx, cy};
-
-       cx = child->split_pos + SPLIT_WIDTH/2;
-
-#ifndef _NO_EXTENSIONS
-       {
-               WINDOWPOS wp;
-               HD_LAYOUT hdl = {&rt, &wp};
-
-               Header_Layout(child->left.hwndHeader, &hdl);
-
-               DeferWindowPos(hdwp, child->left.hwndHeader, wp.hwndInsertAfter,
-                                               wp.x-1, wp.y, child->split_pos-SPLIT_WIDTH/2+1, wp.cy, wp.flags);
-               DeferWindowPos(hdwp, child->right.hwndHeader, wp.hwndInsertAfter,
-                                               rt.left+cx+1, wp.y, wp.cx-cx+2, wp.cy, wp.flags);
-       }
-#endif
-
-       DeferWindowPos(hdwp, child->left.hwnd, 0, rt.left, rt.top, child->split_pos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
-       DeferWindowPos(hdwp, child->right.hwnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
-
-       EndDeferWindowPos(hdwp);
-}
-
-
-#ifndef _NO_EXTENSIONS
-
-HWND create_header(HWND parent, Pane* pane, int id)
+// OnGetDispInfo - processes the LVN_GETDISPINFO 
+// notification message. 
+void OnGetDispInfo(NMLVDISPINFO* plvdi)
 {
 {
-       HD_ITEM hdi = {HDI_TEXT|HDI_WIDTH|HDI_FORMAT};
-       int idx;
-
-       HWND hwnd = CreateWindow(WC_HEADER, 0, WS_CHILD|WS_VISIBLE|HDS_HORZ/*TODO: |HDS_BUTTONS + sort orders*/,
-                                                               0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
-       if (!hwnd)
-               return 0;
-
-       SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), FALSE);
-
-       for(idx=0; idx<COLUMNS; idx++) {
-               hdi.pszText = g_pos_names[idx];
-               hdi.fmt = HDF_STRING | g_pos_align[idx];
-               hdi.cxy = pane->widths[idx];
-               Header_InsertItem(hwnd, idx, &hdi);
-       }
-
-       return hwnd;
-}
-
-#endif
+    static buffer[200];
+
+//    LVITEM* pItem = &(plvdi->item);
+//    Entry* entry = (Entry*)pItem->lParam;
+    Entry* entry = (Entry*)plvdi->item.lParam;
+    ASSERT(entry);
+
+    switch (plvdi->item.iSubItem) {
+    case 0:
+        plvdi->item.pszText = entry->data.cFileName; 
+//    item.cchTextMax = strlen(entry->data.cFileName); 
+//        plvdi->item.pszText = rgPetInfo[plvdi->item.iItem].szKind;
+        break;
+    case 1:
+        if (entry->bhfi_valid) {
+            //entry->bhfi.nFileSizeLow;
+            //entry->bhfi.nFileSizeHigh;
+
+            //entry->bhfi.ftCreationTime
+
+            sprintf(buffer, "%u", entry->bhfi.nFileSizeLow);
+            plvdi->item.pszText = buffer;
+        } else {
+            plvdi->item.pszText = "unknown";
+        }
+        break;
+    case 2:
+        plvdi->item.pszText = "TODO:";
+        break;
+    case 3:
+            //entry->bhfi.dwFileAttributes
+//        plvdi->item.pszText = "rhsa";
+        strcpy(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) strcat(buffer, "a"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) strcat(buffer, "c"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) strcat(buffer, "d"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) strcat(buffer, "e"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) strcat(buffer, "h"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) strcat(buffer, "n"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) strcat(buffer, "o"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) strcat(buffer, "r"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) strcat(buffer, "p"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) strcat(buffer, "f"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) strcat(buffer, "s"); else strcat(buffer, " ");
+        if (entry->bhfi.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY) strcat(buffer, "t"); else strcat(buffer, " ");
+        plvdi->item.pszText = buffer;
+/*
+FILE_ATTRIBUTE_ARCHIVE The file or directory is an archive file. Applications use this attribute to mark files for backup or removal. 
+FILE_ATTRIBUTE_COMPRESSED The file or directory is compressed. For a file, this means that all of the data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories. 
+FILE_ATTRIBUTE_DIRECTORY The handle identifies a directory. 
+FILE_ATTRIBUTE_ENCRYPTED The file or directory is encrypted. For a file, this means that all data in the file is encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories. 
+FILE_ATTRIBUTE_HIDDEN The file or directory is hidden. It is not included in an ordinary directory listing. 
+FILE_ATTRIBUTE_NORMAL The file has no other attributes. This attribute is valid only if used alone. 
+FILE_ATTRIBUTE_OFFLINE The file data is not immediately available. This attribute indicates that the file data has been physically moved to offline storage. This attribute is used by Remote Storage, the hierarchical storage management software in Windows 2000. Applications should not arbitrarily change this attribute. 
+FILE_ATTRIBUTE_READONLY The file or directory is read-only. Applications can read the file but cannot write to it or delete it. In the case of a directory, applications cannot delete it. 
+FILE_ATTRIBUTE_REPARSE_POINT The file has an associated reparse point. 
+FILE_ATTRIBUTE_SPARSE_FILE The file is a sparse file. 
+FILE_ATTRIBUTE_SYSTEM The file or directory is part of the operating system or is used exclusively by the operating system. 
+FILE_ATTRIBUTE_TEMPORARY The file is being used for temporary storage. File systems attempt to keep all the data in memory for quicker access, rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
+ */
+        break;
+    default:
+        break;
+    }
+} 
+/*
+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. 
+
+BOOL OnEndLabelEdit(NMLVDISPINFO* plvdi)
+{ 
+    if (plvdi->item.iItem == -1) 
+        return FALSE; 
+    // Copy the new label text to the application-defined structure. 
+//    lstrcpyn(rgPetInfo[plvdi->item.iItem].szKind, plvdi->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 WNDPROC g_orgListWndProc;
 
 
 
 ////////////////////////////////////////////////////////////////////////////////
 static WNDPROC g_orgListWndProc;
 
-LRESULT CALLBACK ListWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
+static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 {
-       ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hwnd), GWL_USERDATA);
-       Pane* pane = (Pane*)GetWindowLong(hwnd, GWL_USERDATA);
+       ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
+       Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
        ASSERT(child);
 
        ASSERT(child);
 
-       switch(nmsg) {
-#ifndef _NO_EXTENSIONS
-               case WM_HSCROLL:
-                       set_header(pane);
+       switch (message) {
+/*
+        case WM_CREATE:
+            //CreateListView(hWnd);
+            return 0;
+ */
+        case WM_NOTIFY:
+            switch (((LPNMHDR)lParam)->code) { 
+            case LVN_GETDISPINFO: 
+                OnGetDispInfo((NMLVDISPINFO*)lParam); 
+                break; 
+            case LVN_ENDLABELEDIT: 
+                return OnEndLabelEdit((NMLVDISPINFO*)lParam);
+                break;
+            }
                        break;
                        break;
-#endif
+//            return 0;
 
                case WM_SETFOCUS:
 
                case WM_SETFOCUS:
-                       child->focus_pane = pane==&child->right? 1: 0;
-                       ListBox_SetSel(hwnd, TRUE, 1);
+                       child->nFocusPanel = pane==&child->right? 1: 0;
+                       ListBox_SetSel(hWnd, TRUE, 1);
                        //TODO: check menu items
                        break;
 
                case WM_KEYDOWN:
                        //TODO: check menu items
                        break;
 
                case WM_KEYDOWN:
-                       if (wparam == VK_TAB) {
+                       if (wParam == VK_TAB) {
                                //TODO: SetFocus(Globals.hDriveBar)
                                //TODO: SetFocus(Globals.hDriveBar)
-                               SetFocus(child->focus_pane? child->left.hwnd: child->right.hwnd);
+                               SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
                        }
        }
                        }
        }
-
-       return CallWindowProc(g_orgListWndProc, hwnd, nmsg, wparam, lparam);
+       return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
 }
 
 
 }
 
 
-static void init_output(HWND hwnd)
+void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName)
 {
 {
-       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);
-}
-
-
-void create_list_window(HWND parent, Pane* pane, int id, int id_header)
-{
-       static int s_init = 0;
+//     static int s_init = 0;
        Entry* entry = pane->root;
 
        Entry* entry = pane->root;
 
-       pane->hwnd = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
+       pane->treePane = 0;
+#if 1
+    pane->hWnd = CreateListView(parent, id);
+#else
+       pane->hWnd = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
                                                                LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
                                                                0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
                                                                LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
                                                                0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
-
-       SetWindowLong(pane->hwnd, GWL_USERDATA, (LPARAM)pane);
-       g_orgListWndProc = SubclassWindow(pane->hwnd, ListWndProc);
-
-       SendMessage(pane->hwnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
+#endif
+       SetWindowLong(pane->hWnd, GWL_USERDATA, (LPARAM)pane);
+       g_orgListWndProc = SubclassWindow(pane->hWnd, ListWndProc);
+       SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
 
         // insert entries into listbox
        if (entry)
 
         // insert entries into listbox
        if (entry)
-               insert_entries(pane, entry, -1);
+               InsertListEntries(pane, entry, -1);
 
         // calculate column widths
 
         // calculate column widths
-       if (!s_init) {
-               s_init = 1;
-               init_output(pane->hwnd);
-       }
-
-       calc_widths(pane, TRUE);
-
-#ifndef _NO_EXTENSIONS
-       pane->hwndHeader = create_header(parent, pane, id_header);
-#endif
+//     if (!s_init) {
+//             s_init = 1;
+//             init_output(pane->hWnd);
+//     }
+//     calc_widths(pane, TRUE);
 }
 
 }
 
-
-
index 467d850..35582a4 100644 (file)
@@ -34,12 +34,7 @@ extern "C" {
 #include "resource.h"
 
 
 #include "resource.h"
 
 
-HWND CreateListView(HWND hwndParent, LPSTR lpszFileName);
-HWND create_header(HWND parent, Pane* pane, int id);
-void resize_tree(ChildWnd* child, int cx, int cy);
-
-void create_list_window(HWND parent, Pane* pane, int id, int id_header);
-LRESULT CALLBACK ListWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
+void CreateListWnd(HWND parent, Pane* pane, int id, LPSTR lpszPathName);
 
 
 #ifdef __cplusplus
 
 
 #ifdef __cplusplus
index 9b7b36e..f1bf927 100644 (file)
 #include <stdio.h>
 #endif
     
 #include <stdio.h>
 #endif
     
-#include <shellapi.h>
-
-#include "winfile.h"
-#include "about.h"
-#include "mdiclient.h"
+#include "main.h"
+#include "framewnd.h"
+#include "childwnd.h"
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Global Variables:
 //
 
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Global Variables:
 //
 
+HINSTANCE hInst;
+#ifdef USE_GLOBAL_STRUCT
 WINFILE_GLOBALS Globals;
 WINFILE_GLOBALS Globals;
+#else
+HINSTANCE   hInstance;
+HACCEL     hAccel;
+HWND           hMainWnd;
+HMENU          hMenuFrame;
+HMENU          hWindowsMenu;
+HMENU          hLanguageMenu;
+HMENU          hMenuView;
+HMENU          hMenuOptions;
+HWND           hMDIClient;
+HWND           hStatusBar;
+HWND           hToolBar;
+HWND           hDriveBar;
+HFONT          hFont;
+
+TCHAR          num_sep;
+SIZE           spaceSize;
+HIMAGELIST  himl;
+
+TCHAR          drives[BUFFER_LEN];
+BOOL           prescan_node;   //TODO
+
+LPCSTR     lpszLanguage;
+UINT           wStringTableOffset;
+#endif
 
 
-HINSTANCE hInst;                            // current instance
-
-TCHAR szTitle[MAX_LOADSTRING];              // The title bar text
-TCHAR szWindowClass[MAX_LOADSTRING];
+TCHAR szTitle[MAX_LOADSTRING];
 TCHAR szFrameClass[MAX_LOADSTRING];
 TCHAR szFrameClass[MAX_LOADSTRING];
-//TCHAR szChildClass[MAX_LOADSTRING];
+TCHAR szChildClass[MAX_LOADSTRING];
 
 
 ////////////////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -69,14 +91,14 @@ TCHAR szFrameClass[MAX_LOADSTRING];
 //
 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
 {
 //
 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
 {
-       char path[MAX_PATH];
-    int nParts[3];
-       ChildWnd* child;
+//    char path[MAX_PATH];
+//    int nParts[4];
+//    ChildWnd* child;
 
        WNDCLASSEX wcFrame = {
                sizeof(WNDCLASSEX),
 
        WNDCLASSEX wcFrame = {
                sizeof(WNDCLASSEX),
-               0/*style*/,
-               WndProc,
+               CS_HREDRAW | CS_VREDRAW/*style*/,
+               FrameWndProc,
                0/*cbClsExtra*/,
                0/*cbWndExtra*/,
                hInstance,
                0/*cbClsExtra*/,
                0/*cbWndExtra*/,
                hInstance,
@@ -84,11 +106,11 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
                LoadCursor(0, IDC_ARROW),
                0/*hbrBackground*/,
                0/*lpszMenuName*/,
                LoadCursor(0, IDC_ARROW),
                0/*hbrBackground*/,
                0/*lpszMenuName*/,
-               szWindowClass,
+               szFrameClass,
                (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_WINFILE), IMAGE_ICON,
                        GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
        };
                (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_WINFILE), IMAGE_ICON,
                        GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED)
        };
-       ATOM hWndClass = RegisterClassEx(&wcFrame); // register frame window class
+       ATOM hFrameWndClass = RegisterClassEx(&wcFrame); // register frame window class
 
        WNDCLASS wcChild = {
                CS_CLASSDC|CS_DBLCLKS|CS_VREDRAW,
 
        WNDCLASS wcChild = {
                CS_CLASSDC|CS_DBLCLKS|CS_VREDRAW,
@@ -100,7 +122,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
                LoadCursor(0, IDC_ARROW),
                0/*hbrBackground*/,
                0/*lpszMenuName*/,
                LoadCursor(0, IDC_ARROW),
                0/*hbrBackground*/,
                0/*lpszMenuName*/,
-               szFrameClass
+               szChildClass
        };
 
        ATOM hChildClass = RegisterClass(&wcChild); // register child windows class
        };
 
        ATOM hChildClass = RegisterClass(&wcChild); // register child windows class
@@ -128,34 +150,26 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
        Globals.hFont = CreateFont(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("MS Sans Serif"));
        ReleaseDC(0, hdc);
 
        Globals.hFont = CreateFont(-MulDiv(8,GetDeviceCaps(hdc,LOGPIXELSY),72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("MS Sans Serif"));
        ReleaseDC(0, hdc);
 
-       Globals.hMainWnd = CreateWindowEx(0, (LPCTSTR)(int)hWndClass, szTitle,
-                           WS_OVERLAPPEDWINDOW,
+       Globals.hMainWnd = CreateWindowEx(0, (LPCTSTR)(int)hFrameWndClass, szTitle,
+                           WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
                                        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                        0/*hWndParent*/, hMenuFrame, hInstance, 0/*lpParam*/);
     if (!Globals.hMainWnd) {
         return FALSE;
     }
 
                                        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                        0/*hWndParent*/, hMenuFrame, hInstance, 0/*lpParam*/);
     if (!Globals.hMainWnd) {
         return FALSE;
     }
 
-       Globals.hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
-//     Globals.hMDIClient = CreateWindowEx(0, (LPCTSTR)(int)hChildClass, NULL,
-                                       WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
-                                       0, 0, 0, 0,
-                                       Globals.hMainWnd, 0, hInstance, &ccs);
-    if (!Globals.hMDIClient) {
-        return FALSE;
-    }
-
-       InitCommonControlsEx(&icc);
-
+    if (InitCommonControlsEx(&icc))
        {
                TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
                int btn = 1;
                PTSTR p;
 
        {
                TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
                int btn = 1;
                PTSTR p;
 
-               Globals.hDriveBar = CreateToolbarEx(Globals.hMainWnd, WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
-                                       IDW_DRIVEBAR, 2, hInstance, IDB_DRIVEBAR, &drivebarBtn,
-                                       1, 16, 13, 16, 13, sizeof(TBBUTTON));
-//             CheckMenuItem(hMenuFrame, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED);
+               Globals.hDriveBar = CreateToolbarEx(Globals.hMainWnd, 
+                               WS_CHILD|WS_VISIBLE|CCS_NOMOVEY|TBSTYLE_LIST,
+                                       IDW_DRIVEBAR, 2, hInstance, IDB_DRIVEBAR, 
+                                       &drivebarBtn, 1/*iNumButtons*/, 
+                                       16/*dxButton*/, 13/*dyButton*/, 
+                                       16/*dxBitmap*/, 13/*dyBitmap*/, sizeof(TBBUTTON));
                CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED);
                GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
                drivebarBtn.fsStyle = TBSTYLE_BUTTON;
                CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_DRIVEBAR, MF_BYCOMMAND|MF_CHECKED);
                GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
                drivebarBtn.fsStyle = TBSTYLE_BUTTON;
@@ -164,7 +178,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
                SendMessage(Globals.hDriveBar, TB_ADDSTRING, 0, (LPARAM)Globals.drives);
 #endif
                drivebarBtn.idCommand = ID_DRIVE_FIRST;
                SendMessage(Globals.hDriveBar, TB_ADDSTRING, 0, (LPARAM)Globals.drives);
 #endif
                drivebarBtn.idCommand = ID_DRIVE_FIRST;
-               for( p = Globals.drives; *p; ) {
+               for (p = Globals.drives; *p;) {
 #ifdef _NO_EXTENSIONS
                         // insert drive letter
                        TCHAR b[3] = { tolower(*p) };
 #ifdef _NO_EXTENSIONS
                         // insert drive letter
                        TCHAR b[3] = { tolower(*p) };
@@ -182,8 +196,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
                        drivebarBtn.iString++;
                        while(*p++);
                }
                        drivebarBtn.iString++;
                        while(*p++);
                }
-       }
-       {
+               {
                TBBUTTON toolbarBtns[] = {
                        {0, 0, 0, TBSTYLE_SEP},
                        {0, ID_WINDOW_NEW_WINDOW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
                TBBUTTON toolbarBtns[] = {
                        {0, 0, 0, TBSTYLE_SEP},
                        {0, ID_WINDOW_NEW_WINDOW, TBSTATE_ENABLED, TBSTYLE_BUTTON},
@@ -198,82 +211,103 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
                        IDW_TOOLBAR, 2, hInstance, IDB_TOOLBAR, toolbarBtns,
                        sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON));
                CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
                        IDW_TOOLBAR, 2, hInstance, IDB_TOOLBAR, toolbarBtns,
                        sizeof(toolbarBtns)/sizeof(TBBUTTON), 16, 15, 16, 15, sizeof(TBBUTTON));
                CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_TOOLBAR, MF_BYCOMMAND|MF_CHECKED);
+               }
        }
 
     // Create the status bar
     Globals.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, 
        }
 
     // Create the status bar
     Globals.hStatusBar = CreateStatusWindow(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, 
-                                    "", Globals.hMainWnd, STATUS_WINDOW);
+                                    "", Globals.hMainWnd, IDW_STATUS_WINDOW);
     if (!Globals.hStatusBar)
         return FALSE;
        CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
 
     // Create the status bar panes
     if (!Globals.hStatusBar)
         return FALSE;
        CheckMenuItem(Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
 
     // Create the status bar panes
-    nParts[0] = 100;
-    nParts[1] = 210;
-    nParts[2] = 400;
-    SendMessage(Globals.hStatusBar, SB_SETPARTS, 3, (long)nParts);
-
-#if 1
+       SetupStatusBar(FALSE);
+/*
+    nParts[0] = 250;
+    nParts[1] = 220;
+    nParts[2] = 100;
+    nParts[3] = 100;
+    SendMessage(Globals.hStatusBar, SB_SETPARTS, 4, (long)nParts);
+ */
+#if 0
        //Globals.hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, Globals.Globals.hMainWnd, IDW_STATUSBAR);
        //CheckMenuItem(Globals.Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
        //Globals.hstatusbar = CreateStatusWindow(WS_CHILD|WS_VISIBLE, 0, Globals.Globals.hMainWnd, IDW_STATUSBAR);
        //CheckMenuItem(Globals.Globals.hMenuOptions, ID_OPTIONS_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
-
-/* CreateStatusWindow does not accept WS_BORDER
-/*
-       Globals.hstatusbar = CreateWindowEx(WS_EX_NOPARENTNOTIFY, STATUSCLASSNAME, 0,
+/* CreateStatusWindow does not accept WS_BORDER */
+/* Globals.hstatusbar = CreateWindowEx(WS_EX_NOPARENTNOTIFY, STATUSCLASSNAME, 0,
                                        WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0,
                                        Globals.Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/
                                        WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0,
                                        Globals.Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/
-
-        //TODO: read paths and window placements from registry
-
+    //TODO: read paths and window placements from registry
        GetCurrentDirectory(MAX_PATH, path);
        child = alloc_child_window(path);
        GetCurrentDirectory(MAX_PATH, path);
        child = alloc_child_window(path);
-
        child->pos.showCmd = SW_SHOWMAXIMIZED;
        child->pos.rcNormalPosition.left = 0;
        child->pos.rcNormalPosition.top = 0;
        child->pos.rcNormalPosition.right = 320;
        child->pos.rcNormalPosition.bottom = 280;
        child->pos.showCmd = SW_SHOWMAXIMIZED;
        child->pos.rcNormalPosition.left = 0;
        child->pos.rcNormalPosition.top = 0;
        child->pos.rcNormalPosition.right = 320;
        child->pos.rcNormalPosition.bottom = 280;
-
        if (!create_child_window(child))
                free(child);
        if (!create_child_window(child))
                free(child);
-
-       SetWindowPlacement(child->hwnd, &child->pos);
+       SetWindowPlacement(child->hWnd, &child->pos);
        Globals.himl = ImageList_LoadBitmap(Globals.hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0));
        Globals.prescan_node = FALSE;
 #endif
        Globals.himl = ImageList_LoadBitmap(Globals.hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0));
        Globals.prescan_node = FALSE;
 #endif
-        
-/*
-    hSplitWnd = CreateWindow(szFrameClass, "splitter window", WS_VISIBLE|WS_CHILD,
-                            CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 
-                            Globals.hMainWnd, (HMENU)SPLIT_WINDOW, hInstance, NULL);
-    if (!hSplitWnd)
-        return FALSE;
-    hTreeWnd = CreateTreeView(Globals.hMDIClient, "c:\\foobar.txt");
-    if (!hTreeWnd)
-        return FALSE;
 
 
-    hListWnd = CreateListView(Globals.hMDIClient, "");
-    if (!hListWnd)
-        return FALSE;
- */
     ShowWindow(Globals.hMainWnd, nCmdShow);
     UpdateWindow(Globals.hMainWnd);
     ShowWindow(Globals.hMainWnd, nCmdShow);
     UpdateWindow(Globals.hMainWnd);
+       UpdateStatusBar();
     return TRUE;
 }
     return TRUE;
 }
+        
+/*
+       Globals.hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
+//     Globals.hMDIClient = CreateWindowEx(0, (LPCTSTR)(int)hChildClass, NULL,
+                                       WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
+                                       0, 0, 0, 0,
+                                       Globals.hMainWnd, 0, hInstance, &ccs);
+    if (!Globals.hMDIClient) {
+        return FALSE;
+    }
+ */
 
 
+void SetupStatusBar(BOOL bResize)
+{
+    int nParts[4];
+//             int parts[] = {300, 500};
+//             SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
+//             SendMessage(Globals.hStatusBar, SB_SETPARTS, 2, (LPARAM)&parts);
 
 
+    // Create the status bar panes
+    nParts[0] = 150;
+    nParts[1] = 220;
+    nParts[2] = 100;
+    nParts[3] = 100;
+       if (bResize)
+               SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0);
+    SendMessage(Globals.hStatusBar, SB_SETPARTS, 4, (long)nParts);
+}
 
 
+void UpdateStatusBar(void)
+{
+    TCHAR text[260];
+       DWORD size;
+
+       size = sizeof(text)/sizeof(TCHAR);
+       GetUserName(text, &size);
+    SendMessage(Globals.hStatusBar, SB_SETTEXT, 2, (LPARAM)text);
+       size = sizeof(text)/sizeof(TCHAR);
+       GetComputerName(text, &size);
+    SendMessage(Globals.hStatusBar, SB_SETTEXT, 3, (LPARAM)text);
+}
 
 
-#ifdef _NO_EXTENSIONS
 
 static int g_foundPrevInstance = 0;
 
 
 static int g_foundPrevInstance = 0;
 
-// search for already running win[e]files
-static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam)
+// search for already running instances
+static BOOL CALLBACK EnumWndProc(HWND hWnd, LPARAM lparam)
 {
        TCHAR cls[128];
 
 {
        TCHAR cls[128];
 
-       GetClassName(hwnd, cls, 128);
+       GetClassName(hWnd, cls, 128);
        if (!lstrcmp(cls, (LPCTSTR)lparam)) {
                g_foundPrevInstance++;
                return FALSE;
        if (!lstrcmp(cls, (LPCTSTR)lparam)) {
                g_foundPrevInstance++;
                return FALSE;
@@ -281,9 +315,8 @@ static BOOL CALLBACK EnumWndProc(HWND hwnd, LPARAM lparam)
        return TRUE;
 }
 
        return TRUE;
 }
 
-#endif
 
 
-void ExitInstance()
+void ExitInstance(void)
 {
     if (Globals.himl)
            ImageList_Destroy(Globals.himl);
 {
     if (Globals.himl)
            ImageList_Destroy(Globals.himl);
@@ -297,20 +330,20 @@ int APIENTRY WinMain(HINSTANCE hInstance,
 {
     MSG msg;
     HACCEL hAccel;
 {
     MSG msg;
     HACCEL hAccel;
-
-    hInst = hInstance; // Store instance handle in our global variable
+    HWND hMDIClient;
 
     // Initialize global strings
     LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
 
     // Initialize global strings
     LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
-    LoadString(hInstance, IDC_WINFILE, szWindowClass, MAX_LOADSTRING);
-    LoadString(hInstance, IDC_WINFILE_FRAME, szFrameClass, MAX_LOADSTRING);
-    
-#ifdef _NO_EXTENSIONS
-       // allow only one running instance
-       EnumWindows(EnumWndProc, (LPARAM)szWindowClass);
+    LoadString(hInstance, IDC_WINFILE, szFrameClass, MAX_LOADSTRING);
+    LoadString(hInstance, IDC_WINFILE_CHILD, szChildClass, MAX_LOADSTRING);
+
+       // Allow only one running instance
+    EnumWindows(EnumWndProc, (LPARAM)szFrameClass);
        if (g_foundPrevInstance)
                return 1;
        if (g_foundPrevInstance)
                return 1;
-#endif
+
+    // Store instance handle in our global variable
+    hInst = hInstance;
 
     // Perform application initialization:
     if (!InitInstance(hInstance, nCmdShow)) {
 
     // Perform application initialization:
     if (!InitInstance(hInstance, nCmdShow)) {
@@ -318,24 +351,16 @@ int APIENTRY WinMain(HINSTANCE hInstance,
     }
 
     hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINFILE);
     }
 
     hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINFILE);
+    hMDIClient = GetWindow(Globals.hMainWnd, GW_CHILD);
 
     // Main message loop:
 
     // Main message loop:
-#if 0
-    while (GetMessage(&msg, NULL, 0, 0)) {
-        if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
-            TranslateMessage(&msg);
-            DispatchMessage(&msg);
-        }
-    }
-#else
        while (GetMessage(&msg, (HWND)NULL, 0, 0)) { 
        while (GetMessage(&msg, (HWND)NULL, 0, 0)) { 
-        if (!TranslateMDISysAccel(Globals.hMDIClient, &msg) && 
+        if (!TranslateMDISysAccel(hMDIClient, &msg) && 
             !TranslateAccelerator(Globals.hMainWnd/*hwndFrame*/, hAccel, &msg)) { 
             TranslateMessage(&msg); 
             DispatchMessage(&msg); 
                } 
        } 
             !TranslateAccelerator(Globals.hMainWnd/*hwndFrame*/, hAccel, &msg)) { 
             TranslateMessage(&msg); 
             DispatchMessage(&msg); 
                } 
        } 
-#endif
        ExitInstance();
     return msg.wParam;
 }
        ExitInstance();
     return msg.wParam;
 }
diff --git a/rosapps/winfile/main.h b/rosapps/winfile/main.h
new file mode 100644 (file)
index 0000000..39056d8
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ *  ReactOS winfile
+ *
+ *  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.
+ */
+/*
+ * Based on Winefile, Copyright 2000 martin Fuchs <martin-fuchs@gmx.net>
+ */
+
+#ifndef __MAIN_H__
+#define __MAIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"
+#include "entries.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+#define MAX_LOADSTRING 100
+#define        BUFFER_LEN      1024
+
+#define        WM_DISPATCH_COMMAND     0xBF80
+
+////////////////////////////////////////////////////////////////////////////////
+ // range for drive bar command ids: 0x9000..0x90FF
+#define        ID_DRIVE_FIRST                                  0x9001
+
+
+#define _NO_EXTENSIONS
+
+enum IMAGE {
+       IMG_NONE=-1,    IMG_FILE=0,                     IMG_DOCUMENT,   IMG_EXECUTABLE,
+       IMG_FOLDER,             IMG_OPEN_FOLDER,        IMG_FOLDER_PLUS,IMG_OPEN_PLUS,  IMG_OPEN_MINUS,
+       IMG_FOLDER_UP,  IMG_FOLDER_CUR
+};
+
+#define        IMAGE_WIDTH                     16
+#define        IMAGE_HEIGHT            13
+#define        SPLIT_WIDTH                     3
+
+#define IDW_STATUSBAR          0x100
+#define IDW_TOOLBAR                    0x101
+#define IDW_DRIVEBAR           0x102
+#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_STATUS_WINDOW   7
+
+////////////////////////////////////////////////////////////////////////////////
+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);
+
+#ifdef UNICODE
+#define _tsplitpath _wsplitpath
+#else
+#define _tsplitpath _splitpath
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+
+enum COLUMN_FLAGS {
+       COL_SIZE                = 0x01,
+       COL_DATE                = 0x02,
+       COL_TIME                = 0x04,
+       COL_ATTRIBUTES  = 0x08,
+       COL_DOSNAMES    = 0x10,
+#ifdef _NO_EXTENSIONS
+       COL_ALL = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES
+#else
+       COL_INDEX               = 0x20,
+       COL_LINKS               = 0x40,
+       COL_ALL = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_DOSNAMES|COL_INDEX|COL_LINKS
+#endif
+};
+
+#define USE_GLOBAL_STRUCT
+#ifdef USE_GLOBAL_STRUCT
+typedef struct
+{
+  HINSTANCE hInstance;
+  HACCEL       hAccel;
+  HWND         hMainWnd;
+  HMENU                hMenuFrame;
+  HMENU                hWindowsMenu;
+  HMENU                hLanguageMenu;
+  HMENU                hMenuView;
+  HMENU                hMenuOptions;
+  HWND         hMDIClient;
+  HWND         hStatusBar;
+  HWND         hToolBar;
+  HWND         hDriveBar;
+  HFONT                hFont;
+
+  TCHAR                num_sep;
+  SIZE         spaceSize;
+  HIMAGELIST himl;
+
+  TCHAR                drives[BUFFER_LEN];
+  BOOL         prescan_node;   //TODO
+
+  LPCSTR       lpszLanguage;
+  UINT         wStringTableOffset;
+
+} WINFILE_GLOBALS;
+
+extern WINFILE_GLOBALS Globals;
+
+#define STRINGID(id) (Globals.wStringTableOffset + 0x##id)
+
+#else
+
+extern HINSTANCE hInstance;
+extern HACCEL  hAccel;
+extern HWND            hMainWnd;
+extern HMENU   hMenuFrame;
+extern HMENU   hWindowsMenu;
+extern HMENU   hLanguageMenu;
+extern HMENU   hMenuView;
+extern HMENU   hMenuOptions;
+extern HWND            hMDIClient;
+extern HWND            hStatusBar;
+extern HWND            hToolBar;
+extern HWND            hDriveBar;
+extern HFONT   hFont;
+
+extern TCHAR   num_sep;
+extern SIZE            spaceSize;
+extern HIMAGELIST himl;
+
+extern TCHAR   drives[BUFFER_LEN];
+extern BOOL            prescan_node;   //TODO
+
+extern LPCSTR  lpszLanguage;
+extern UINT            wStringTableOffset;
+
+#define Globals.
+
+#endif
+
+extern HINSTANCE hInst;
+extern TCHAR szTitle[];
+extern TCHAR szFrameClass[];
+extern TCHAR szChildClass[];
+
+
+void SetupStatusBar(BOOL bResize);
+void UpdateStatusBar(void);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // __MAIN_H__
diff --git a/rosapps/winfile/res/folder1.bmp b/rosapps/winfile/res/folder1.bmp
new file mode 100644 (file)
index 0000000..dada286
Binary files /dev/null and b/rosapps/winfile/res/folder1.bmp differ
diff --git a/rosapps/winfile/res/folder_open.bmp b/rosapps/winfile/res/folder_open.bmp
new file mode 100644 (file)
index 0000000..7932eb3
Binary files /dev/null and b/rosapps/winfile/res/folder_open.bmp differ
index d6d23fe..624fe2c 100644 (file)
 #define ID_WINDOW_MENU                  6
 #define ID_HELP_MENU                    7
 
 #define ID_WINDOW_MENU                  6
 #define ID_HELP_MENU                    7
 
+
+#define IDS_LIST_COLUMN_FIRST   91
+#define IDS_LIST_COLUMN_NAME    91
+#define IDS_LIST_COLUMN_SIZE    92
+#define IDS_LIST_COLUMN_DATE    93
+#define IDS_LIST_COLUMN_ATTRIB  94
+#define IDS_LIST_COLUMN_DOSNAME 95
+#define IDS_LIST_COLUMN_LAST    95
+
 #define IDD_ABOUTBOX                    104
 #define IDS_APP_TITLE                   105
 #define IDD_ABOUTBOX                    104
 #define IDS_APP_TITLE                   105
-#define IDS_HELLO                       106
 #define IDI_WINFILE                     107
 #define IDI_SMALL                       108
 #define IDC_WINFILE                     109
 #define IDI_WINFILE                     107
 #define IDI_SMALL                       108
 #define IDC_WINFILE                     109
-#define IDC_WINFILE_FRAME               110
-//#define IDR_WINFILE_MENU                130
+#define IDC_WINFILE_CHILD               110
+//#define IDR_WINFILE_MENU              130
 #define IDD_DIALOG1                     131
 #define IDD_DIALOG1                     131
-#define IDB_OPEN_FILE                   132
-#define IDB_CLOSED_FILE                 133
-#define IDB_ROOT                        134
-#define        IDB_TOOLBAR                                             135
-#define        IDB_DRIVEBAR                                    136
-#define        IDB_IMAGES                      137
+
+#define IDB_FOLDER                      132
+#define IDB_FOLDER_RED                  133
+#define        IDB_FOLDER_OPEN                         134
+
+#define IDB_ROOT                        135
+#define        IDB_TOOLBAR                                 136
+#define        IDB_DRIVEBAR                            137
+#define        IDB_IMAGES                      138
+
+//#define      IDB_FOLDER_PLUS                 139
+//#define      IDB_FOLDER_MINUS                140
+//#define      IDB_FOLDER_OPEN_PLUS            142
+//#define      IDB_FOLDER_OPEN_MINUS           143
+
+
+#define ID_WINDOW_CLOSE                 798
+#define ID_WINDOW_CLOSEALL              799
 
 #define ID_FILE_OPEN                          32769
 #define ID_FILE_MOVE                          32770
 
 #define ID_FILE_OPEN                          32769
 #define ID_FILE_MOVE                          32770
@@ -41,7 +61,7 @@
 #define ID_FILE_ASSOCIATE                     32780
 #define ID_FILE_CREATE_DIRECTORY              32781
 #define ID_FILE_SEARCH                        32782
 #define ID_FILE_ASSOCIATE                     32780
 #define ID_FILE_CREATE_DIRECTORY              32781
 #define ID_FILE_SEARCH                        32782
-#define ID_FILE_SEARCH_FILES                  32783
+#define ID_FILE_SELECT_FILES                  32783
 #define ID_FILE_EXIT                          32784
 
 #define ID_DISK_COPY_DISK                     32785
 #define ID_FILE_EXIT                          32784
 
 #define ID_DISK_COPY_DISK                     32785
 #define IDC_LICENSE_EDIT                      32831
 #define IDS_LICENSE                           32832
 
 #define IDC_LICENSE_EDIT                      32831
 #define IDS_LICENSE                           32832
 
-/*
-#define ID_HELP_HELPTOPICS              32771
-#define ID_VIEW_STATUSBAR               32774
-#define ID_VIEW_SPLIT                   32775
-#define ID_VIEW_REFRESH                 32776
-#define ID_EDIT_DELETE                  32778
-#define ID_EDIT_RENAME                  32779
-#define ID_EDIT_COPYKEYNAME             32781
-#define ID_EDIT_FIND                    32782
-#define ID_EDIT_FINDNEXT                32783
-#define ID_EDIT_MODIFY                  32784
-#define ID_HELP_CONTENTS                32795
-#define ID_WINDOW_CASCADE               32797
-#define ID_WINDOW_TILE                  32798
-#define ID_WINDOW_ARRANGEICONS          32799
-#define ID_OPTIONS_FONT                 32800
-#define ID_OPTIONS_AUTOREFRESH          32801
-#define ID_OPTIONS_READONLYMODE         32802
-#define ID_OPTIONS_CONFIRMONDELETE      32803
-#define ID_OPTIONS_SAVESETTINGSONEXIT   32804
-#define ID_SECURITY_PERMISSIONS         32805
-#define ID_VIEW_TREEANDDATA             32806
-#define ID_VIEW_TREEONLY                32807
-#define ID_VIEW_DATAONLY                32808
-#define ID_VIEW_DISPLAYBINARYDATA       32810
-#define ID_VIEW_REFRESHALL              32811
-#define ID_VIEW_REFRESHACTIVE           32812
-#define ID_VIEW_FINDKEY                 32813
-#define ID_TREE_EXPANDONELEVEL          32814
-#define ID_TREE_EXPANDBRANCH            32815
-#define ID_TREE_EXPANDALL               32816
-#define ID_TREE_COLLAPSEBRANCH          32817
-#define ID_REGISTRY_OPENLOCAL           32825
- */
 
 #define IDC_STATIC                      -1
 
 
 #define IDC_STATIC                      -1
 
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        138
+#define _APS_NEXT_RESOURCE_VALUE        144
 #define _APS_NEXT_COMMAND_VALUE         32832
 #define _APS_NEXT_CONTROL_VALUE         1000
 #define _APS_NEXT_SYMED_VALUE           110
 #define _APS_NEXT_COMMAND_VALUE         32832
 #define _APS_NEXT_CONTROL_VALUE         1000
 #define _APS_NEXT_SYMED_VALUE           110
index dbf3b9f..e489a36 100644 (file)
@@ -34,7 +34,7 @@
 #include <stdio.h>
 #endif
        
 #include <stdio.h>
 #endif
        
-#include "winfile.h"
+#include "main.h"
 #include "run.h"
 
 
 #include "run.h"
 
 
index f1cdb9c..6fb4c38 100644 (file)
@@ -34,5 +34,5 @@
 #include <stdio.h>
 #endif
     
 #include <stdio.h>
 #endif
     
-#include "winfile.h"
+#include "main.h"
 
 
index 8a07d26..eb69df5 100644 (file)
@@ -42,7 +42,7 @@
 #include <assert.h>
 #define ASSERT assert
 
 #include <assert.h>
 #define ASSERT assert
 
-#include "winfile.h"
+#include "main.h"
 #include "sort.h"
 
 
 #include "sort.h"
 
 
@@ -160,6 +160,7 @@ void SortDirectory(Entry* parent, SORT_ORDER sortOrder)
 #else
                array = (Entry**) malloc(len*sizeof(Entry*));
 #endif
 #else
                array = (Entry**) malloc(len*sizeof(Entry*));
 #endif
+        memset(array, 0, len*sizeof(Entry*));
                p = array;
                for(entry=parent->down; entry; entry=entry->next)
                        *p++ = entry;
                p = array;
                for(entry=parent->down; entry; entry=entry->next)
                        *p++ = entry;
index 475cc67..fc2467f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ReactOS winfile
  *
 /*
  *  ReactOS winfile
  *
- *  winfile.c
+ *  splitpath.c
  *
  *  Copyright (C) 2002  Robert Dickenson <robd@reactos.org>
  *
  *
  *  Copyright (C) 2002  Robert Dickenson <robd@reactos.org>
  *
@@ -34,7 +34,7 @@
 #include <stdio.h>
 #endif
     
 #include <stdio.h>
 #endif
     
-#include "winfile.h"
+#include "main.h"
 
 
 #ifdef UNICODE
 
 
 #ifdef UNICODE
diff --git a/rosapps/winfile/trace.c b/rosapps/winfile/trace.c
new file mode 100644 (file)
index 0000000..5ce4c85
--- /dev/null
@@ -0,0 +1,79 @@
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#include <stdio.h> 
+#include <stdarg.h>
+#include "trace.h"
+//#include "windows.h"
+
+DeclAssertFile;  // Should be added at the begining of each .C/.CPP
+
+
+#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__;
+
+void _DebugBreak(void)
+{
+    DebugBreak();
+}
+
+void Trace(char* lpszFormat, ...)
+{
+    va_list args;
+    int nBuf;
+    char szBuffer[512];
+
+    va_start(args, lpszFormat);
+//  nBuf = vsprintf(szBuffer, lpszFormat, args);
+//  nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
+    nBuf = _vsnprintf(szBuffer, sizeof(szBuffer), lpszFormat, args);
+    OutputDebugString(szBuffer);
+    // was there an error? was the expanded string too long?
+    ASSERT(nBuf >= 0);
+    va_end(args);
+}
+
+void Assert(void* assert, char* file, int line, void* msg)
+{
+    if (msg == NULL) {
+        printf("ASSERT -- %s occured on line %u of file %s.\n",
+               assert, line, file);
+    } else {
+        printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
+               assert, line, file, msg);
+    }
+}
+
+
+#else
+
+//inline void Trace(char* lpszFormat, ...) { };
+//inline void Assert(void* assert, char* file, int line, void* msg) { };
+void Trace(char* lpszFormat, ...) { };
+void Assert(void* assert, char* file, int line, void* msg) { };
+
+#endif //_DEBUG
+/////////////////////////////////////////////////////////////////////////////
diff --git a/rosapps/winfile/trace.h b/rosapps/winfile/trace.h
new file mode 100644 (file)
index 0000000..d81e6d5
--- /dev/null
@@ -0,0 +1,72 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+#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);   \
+        BreakPoint();                               \
+    }                                               \
+}                                                   \
+
+#define ASSERTMSG(exp, msg)                         \
+{                                                   \
+    if ( !(exp) )                                   \
+    {                                               \
+        Assert(#exp, __FILE__, __LINE__, msg);    \
+        BreakPoint();                               \
+    }                                               \
+}
+#endif
+
+//=============================================================================
+//  MACRO: TRACE()
+//=============================================================================
+
+void Assert(void* assert, char* file, int line, void* msg);
+void Trace(char* lpszFormat, ...);
+void Trace1(int code, char* lpszFormat, ...);
+
+#define TRACE  Trace
+#define TRACE0 Trace
+
+#else   // _DEBUG
+
+#ifndef ASSERT
+#define ASSERT(exp)
+#define ASSERTMSG(exp, msg)
+#endif
+
+//#define TRACE0 TRACE
+//#define TRACE1 TRACE
+
+void Assert(void* assert, char* file, int line, void* msg);
+void Trace(char* lpszFormat, ...);
+
+#define TRACE 0 ? (void)0 : Trace
+
+
+#endif // !_DEBUG
+
+#endif // __TRACE_H__
+/////////////////////////////////////////////////////////////////////////////
index 3886ec1..b90f462 100644 (file)
 #include <assert.h>
 #define ASSERT assert
 
 #include <assert.h>
 #define ASSERT assert
 
-#include "winfile.h"
+#include "main.h"
 #include "treeview.h"
 #include "entries.h"
 #include "utils.h"
 
 #include "treeview.h"
 #include "entries.h"
 #include "utils.h"
 
+#include "trace.h"
 
 // Global Variables:
 extern HINSTANCE hInst;
 
 // Global Variables:
 extern HINSTANCE hInst;
@@ -82,18 +83,13 @@ HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
     HTREEITEM hti; 
  
     tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 
     HTREEITEM hti; 
  
     tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 
     // Set the text of the item. 
     tvi.pszText = lpszItem; 
     tvi.cchTextMax = lstrlen(lpszItem); 
     // 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; 
     // Assume the item is not a parent item, so give it an image. 
     tvi.iImage = Image_Root; 
     tvi.iSelectedImage = Image_Root; 
-
     tvi.cChildren = 1; 
     tvi.cChildren = 1; 
-
     // Save the heading level in the item's application-defined data area. 
     tvi.lParam = (LPARAM)nLevel; 
  
     // Save the heading level in the item's application-defined data area. 
     tvi.lParam = (LPARAM)nLevel; 
  
@@ -127,31 +123,102 @@ HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
         tvi.iSelectedImage = Image_Closed; 
         TreeView_SetItem(hwndTV, &tvi); 
     } 
         tvi.iSelectedImage = Image_Closed; 
         TreeView_SetItem(hwndTV, &tvi); 
     } 
     return hPrev; 
 } 
 
     return hPrev; 
 } 
 
+HTREEITEM AddEntryToTree(HWND hwndTV, Entry* entry)
+{ 
+    HTREEITEM hItem = 0;
+#if 0
+    hItem = AddItemToTree(hwndTV, entry->data.cFileName, entry->level);
+#else
+//HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
+    TVITEM tvi; 
+    TVINSERTSTRUCT tvins; 
+    static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST; 
+    static HTREEITEM hPrevRootItem = NULL; 
+    static HTREEITEM hPrevLev2Item = NULL; 
+    HTREEITEM hti; 
+
+    TRACE("AddEntryToTree(level:%u - %s)\n", entry->level, entry->data.cFileName); 
+    
+    tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | 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; 
+    // 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 || entry->level == 1) {
+    if (entry->level == 0) {
+        tvins.hParent = TVI_ROOT; 
+    } else if (entry->level == 1) {
+        tvins.hParent = hPrevRootItem; 
+        if (hPrevRootItem) {
+            //tvins.hParent = entry->up->hTreeItem; 
+            int foobar = entry->level * 2; 
+        }
+    } else {
+        tvins.hParent = hPrevLev2Item; 
+        if (hPrevLev2Item) {
+            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) { 
+        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; 
+#endif
+    return hItem;
+}
+
+
 // InitTreeViewItems - extracts headings from the specified file and 
 // passes them to a function that adds them to a tree view control. 
 // Returns TRUE if successful, or FALSE otherwise. 
 // hwndTV - handle to the tree view control. 
 // lpszFileName - name of file with headings.
 
 // InitTreeViewItems - extracts headings from the specified file and 
 // passes them to a function that adds them to a tree view control. 
 // Returns TRUE if successful, or FALSE otherwise. 
 // hwndTV - handle to the tree view control. 
 // lpszFileName - name of file with headings.
 
-BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName) 
+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); 
     HTREEITEM hItem;
     
     hItem = AddItemToTree(hwndTV, "C:\\ - FAT32", 1); 
     AddItemToTree(hwndTV, "reactos", 2); 
     AddItemToTree(hwndTV, "bin", 3); 
     AddItemToTree(hwndTV, "media", 3); 
-//    AddItemToTree(hwndTV, "fonts", 4); 
     AddItemToTree(hwndTV, "symbols", 3); 
     AddItemToTree(hwndTV, "system32", 3); 
     AddItemToTree(hwndTV, "symbols", 3); 
     AddItemToTree(hwndTV, "system32", 3); 
-//    AddItemToTree(hwndTV, "config", 4); 
-//    AddItemToTree(hwndTV, "drivers", 4); 
-
     TreeView_Expand(hwndTV, hItem, TVE_EXPAND);
     TreeView_Expand(hwndTV, hItem, TVE_EXPAND);
+*/
     return TRUE; 
 } 
  
     return TRUE; 
 } 
  
@@ -160,7 +227,7 @@ BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName)
 // Returns TRUE if successful, or FALSE otherwise. 
 // hwndTV - handle to the tree view control. 
 
 // Returns TRUE if successful, or FALSE otherwise. 
 // hwndTV - handle to the tree view control. 
 
-BOOL InitTreeViewImageLists(HWND hwndTV) 
+static BOOL InitTreeViewImageLists(HWND hwndTV) 
 { 
     HIMAGELIST himl;  // handle to image list 
     HBITMAP hbmp;     // handle to bitmap 
 { 
     HIMAGELIST himl;  // handle to image list 
     HBITMAP hbmp;     // handle to bitmap 
@@ -171,15 +238,15 @@ BOOL InitTreeViewImageLists(HWND hwndTV)
         return FALSE; 
 
     // Add the open file, closed file, and document bitmaps. 
         return FALSE; 
 
     // Add the open file, closed file, and document bitmaps. 
-    hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_OPEN_FILE)); 
+    hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FOLDER_RED)); 
     Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL); 
     DeleteObject(hbmp); 
 
     Image_Open = ImageList_Add(himl, hbmp, (HBITMAP) NULL); 
     DeleteObject(hbmp); 
 
-    hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_CLOSED_FILE)); 
+    hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FOLDER_OPEN)); 
     Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL); 
     DeleteObject(hbmp); 
 
     Image_Closed = ImageList_Add(himl, hbmp, (HBITMAP) NULL); 
     DeleteObject(hbmp); 
 
-    hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_ROOT)); 
+    hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FOLDER)); 
     Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL); 
     DeleteObject(hbmp); 
 
     Image_Root = ImageList_Add(himl, hbmp, (HBITMAP) NULL); 
     DeleteObject(hbmp); 
 
@@ -199,7 +266,7 @@ BOOL InitTreeViewImageLists(HWND hwndTV)
 // hwndParent - handle to the control's parent window. 
 // lpszFileName - name of the file to parse for tree view items.
 
 // hwndParent - handle to the control's parent window. 
 // lpszFileName - name of the file to parse for tree view items.
 
-HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName) 
+static HWND CreateTreeView(HWND hwndParent, int id, LPSTR lpszFileName) 
 { 
     RECT rcClient;  // dimensions of client area 
     HWND hwndTV;    // handle to tree view control 
 { 
     RECT rcClient;  // dimensions of client area 
     HWND hwndTV;    // handle to tree view control 
@@ -210,7 +277,7 @@ HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName)
     hwndTV = CreateWindowEx(0, WC_TREEVIEW, "Tree View", 
         WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
         0, 0, rcClient.right, rcClient.bottom, 
     hwndTV = CreateWindowEx(0, WC_TREEVIEW, "Tree View", 
         WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
         0, 0, rcClient.right, rcClient.bottom, 
-        hwndParent, (HMENU)TREE_WINDOW, hInst, NULL); 
+        hwndParent, (HMENU)id, hInst, NULL); 
 /* 
     hwndTV = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
                                                LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
 /* 
     hwndTV = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
                                                LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
@@ -227,41 +294,52 @@ HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName)
 ////////////////////////////////////////////////////////////////////////////////
 static WNDPROC g_orgTreeWndProc;
 
 ////////////////////////////////////////////////////////////////////////////////
 static WNDPROC g_orgTreeWndProc;
 
-LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
+static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 {
-       ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hwnd), GWL_USERDATA);
-       Pane* pane = (Pane*)GetWindowLong(hwnd, GWL_USERDATA);
+       ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
+       Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
        ASSERT(child);
 
        ASSERT(child);
 
-       switch(nmsg) {
+       switch(message) {
 #ifndef _NO_EXTENSIONS
                case WM_HSCROLL:
                        set_header(pane);
                        break;
 #endif
 #ifndef _NO_EXTENSIONS
                case WM_HSCROLL:
                        set_header(pane);
                        break;
 #endif
+        case WM_NOTIFY:
+            switch (((LPNMHDR)lParam)->code) { 
+//            case LVN_GETDISPINFO: 
+//                OnGetDispInfo((NMLVDISPINFO*)lParam); 
+//                break; 
+//            case LVN_ENDLABELEDIT: 
+//                return OnEndLabelEdit((NMLVDISPINFO*)lParam);
+//                break;
+            }
+//                     break;
+            return 0;
 
                case WM_SETFOCUS:
 
                case WM_SETFOCUS:
-                       child->focus_pane = pane==&child->right? 1: 0;
-                       ListBox_SetSel(hwnd, TRUE, 1);
+                       child->nFocusPanel = pane == &child->right? 1: 0;
+                       //ListBox_SetSel(hWnd, TRUE, 1);
                        //TODO: check menu items
                        break;
 
                case WM_KEYDOWN:
                        //TODO: check menu items
                        break;
 
                case WM_KEYDOWN:
-                       if (wparam == VK_TAB) {
+                       if (wParam == VK_TAB) {
                                //TODO: SetFocus(Globals.hDriveBar)
                                //TODO: SetFocus(Globals.hDriveBar)
-                               SetFocus(child->focus_pane? child->left.hwnd: child->right.hwnd);
+                               SetFocus(child->nFocusPanel ? child->left.hWnd: child->right.hWnd);
                        }
        }
 
                        }
        }
 
-       return CallWindowProc(g_orgTreeWndProc, hwnd, nmsg, wparam, lparam);
+       return CallWindowProc(g_orgTreeWndProc, hWnd, message, wParam, lParam);
 }
 
 
 }
 
 
-static void init_output(HWND hwnd)
+static void init_output(HWND hWnd)
 {
        TCHAR b[16];
        HFONT old_font;
 {
        TCHAR b[16];
        HFONT old_font;
-       HDC hdc = GetDC(hwnd);
+       HDC hdc = GetDC(hWnd);
 
        if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
                Globals.num_sep = b[1];
 
        if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
                Globals.num_sep = b[1];
@@ -271,42 +349,95 @@ static void init_output(HWND hwnd)
        old_font = SelectFont(hdc, Globals.hFont);
        GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
        SelectFont(hdc, old_font);
        old_font = SelectFont(hdc, Globals.hFont);
        GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
        SelectFont(hdc, old_font);
-       ReleaseDC(hwnd, hdc);
+       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)
 {
        static int s_init = 0;
        Entry* entry = pane->root;
 {
        static int s_init = 0;
        Entry* entry = pane->root;
-#if 1
-       pane->hwnd = CreateTreeView(parent, lpszFileName);
-#else
-       pane->hwnd = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
-//                                                             LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
-                                                               LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_NOTIFY,
-                                                               0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
-#endif
-       SetWindowLong(pane->hwnd, GWL_USERDATA, (LPARAM)pane);
-       g_orgTreeWndProc = SubclassWindow(pane->hwnd, TreeWndProc);
 
 
-       SendMessage(pane->hwnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
+       pane->treePane = 1;
+
+    pane->hWnd = CreateTreeView(parent, id, lpszFileName);
+    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 listbox
-       if (entry)
-               insert_entries(pane, entry, -1);
+        // insert entries into treectrl
+    if (entry) {
+               //insert_tree_entries(pane, entry, -1);
+               insert_tree_entries(pane, entry, 0);
+    }
 
         // calculate column widths
        if (!s_init) {
                s_init = 1;
 
         // calculate column widths
        if (!s_init) {
                s_init = 1;
-               init_output(pane->hwnd);
+               init_output(pane->hWnd);
        }
        }
-
-       calc_widths(pane, TRUE);
-
-#ifndef _NO_EXTENSIONS
-       pane->hwndHeader = create_header(parent, pane, id_header);
-#endif
+//     calc_widths(pane, TRUE);
+//#ifndef _NO_EXTENSIONS
+//     pane->hwndHeader = create_header(parent, pane, id_header);
+//#endif
 }
 
 
 }
 
 
index 63aa4ce..828fb15 100644 (file)
@@ -34,12 +34,13 @@ extern "C" {
 #include "resource.h"
 
 
 #include "resource.h"
 
 
+void CreateTreeWnd(HWND parent, Pane* pane, int id, LPSTR lpszFileName);
 
 
-HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName);
+HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel);
 
 
-void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPSTR lpszFileName);
-
-LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
+//HWND CreateTreeView(HWND hwndParent, LPSTR lpszFileName);
+//void create_tree_window(HWND parent, Pane* pane, int id, int id_header, LPSTR lpszFileName);
+//LRESULT CALLBACK TreeWndProc(HWND, UINT, WPARAM, LPARAM);
 
 
 
 
 
 
index e48221d..3ae6ad8 100644 (file)
     
 #include <windowsx.h>
 
     
 #include <windowsx.h>
 
-#include "winfile.h"
+#include "main.h"
 #include "utils.h"
 #include "sort.h"
 #include "draw.h"
 
 #define        FRM_CALC_CLIENT         0xBF83
 #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))
+#define        Frame_CalcFrameClient(hWnd, prt) ((BOOL)SNDMSG(hWnd, FRM_CALC_CLIENT, 0, (LPARAM)(PRECT)prt))
 
 
 
 
-void display_error(HWND hwnd, DWORD error)
+void display_error(HWND hWnd, DWORD error)
 {
        PTSTR msg;
 
        if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
                0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PTSTR)&msg, 0, NULL))
 {
        PTSTR msg;
 
        if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
                0, error, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (PTSTR)&msg, 0, NULL))
-               MessageBox(hwnd, msg, _T("Winefile"), MB_OK);
+               MessageBox(hWnd, msg, _T("Winefile"), MB_OK);
        else
        else
-               MessageBox(hwnd, _T("Error"), _T("Winefile"), MB_OK);
-
+               MessageBox(hWnd, _T("Error"), _T("Winefile"), MB_OK);
        LocalFree(msg);
 }
 
        LocalFree(msg);
 }
 
@@ -65,9 +64,9 @@ static void read_directory_win(Entry* parent, LPCTSTR path)
        int level = parent->level + 1;
        Entry* last = 0;
        HANDLE hFind;
        int level = parent->level + 1;
        Entry* last = 0;
        HANDLE hFind;
-#ifndef _NO_EXTENSIONS
+//#ifndef _NO_EXTENSIONS
        HANDLE hFile;
        HANDLE hFile;
-#endif
+//#endif
 
        TCHAR buffer[MAX_PATH], *p;
        for(p=buffer; *path; )
 
        TCHAR buffer[MAX_PATH], *p;
        for(p=buffer; *path; )
@@ -75,6 +74,7 @@ static void read_directory_win(Entry* parent, LPCTSTR path)
 
        lstrcpy(p, _T("\\*"));
 
 
        lstrcpy(p, _T("\\*"));
 
+    memset(entry, 0, sizeof(Entry));
        hFind = FindFirstFile(buffer, &entry->data);
 
        if (hFind != INVALID_HANDLE_VALUE) {
        hFind = FindFirstFile(buffer, &entry->data);
 
        if (hFind != INVALID_HANDLE_VALUE) {
@@ -87,7 +87,8 @@ static void read_directory_win(Entry* parent, LPCTSTR path)
                        entry->scanned = FALSE;
                        entry->level = level;
 
                        entry->scanned = FALSE;
                        entry->level = level;
 
-#ifdef _NO_EXTENSIONS
+//#ifdef _NO_EXTENSIONS
+#if 0
                         // hide directory entry "."
                        if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
                                LPCTSTR name = entry->data.cFileName;
                         // hide directory entry "."
                        if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
                                LPCTSTR name = entry->data.cFileName;
@@ -115,6 +116,7 @@ static void read_directory_win(Entry* parent, LPCTSTR path)
                        last = entry;
 
                        entry = (Entry*) malloc(sizeof(Entry));
                        last = entry;
 
                        entry = (Entry*) malloc(sizeof(Entry));
+            memset(entry, 0, sizeof(Entry));
 
                        if (last)
                                last->next = entry;
 
                        if (last)
                                last->next = entry;
@@ -238,17 +240,15 @@ void get_path(Entry* dir, PTSTR path)
 
 #ifndef _NO_EXTENSIONS
 
 
 #ifndef _NO_EXTENSIONS
 
-void frame_get_clientspace(HWND hwnd, PRECT prect)
+void frame_get_clientspace(HWND hWnd, PRECT prect)
 {
        RECT rt;
 
 {
        RECT rt;
 
-       if (!IsIconic(hwnd))
-               GetClientRect(hwnd, prect);
+       if (!IsIconic(hWnd))
+               GetClientRect(hWnd, prect);
        else {
                WINDOWPLACEMENT wp;
        else {
                WINDOWPLACEMENT wp;
-
-               GetWindowPlacement(hwnd, &wp);
-
+               GetWindowPlacement(hWnd, &wp);
                prect->left = prect->top = 0;
                prect->right = wp.rcNormalPosition.right-wp.rcNormalPosition.left-
                                                2*(GetSystemMetrics(SM_CXSIZEFRAME)+GetSystemMetrics(SM_CXEDGE));
                prect->left = prect->top = 0;
                prect->right = wp.rcNormalPosition.right-wp.rcNormalPosition.left-
                                                2*(GetSystemMetrics(SM_CXSIZEFRAME)+GetSystemMetrics(SM_CXEDGE));
@@ -256,17 +256,14 @@ void frame_get_clientspace(HWND hwnd, PRECT prect)
                                                2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))-
                                                GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE);
        }   
                                                2*(GetSystemMetrics(SM_CYSIZEFRAME)+GetSystemMetrics(SM_CYEDGE))-
                                                GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYMENUSIZE);
        }   
-
        if (IsWindowVisible(Globals.hToolBar)) {
                GetClientRect(Globals.hToolBar, &rt);
                prect->top += rt.bottom+2;
        }
        if (IsWindowVisible(Globals.hToolBar)) {
                GetClientRect(Globals.hToolBar, &rt);
                prect->top += rt.bottom+2;
        }
-
        if (IsWindowVisible(Globals.hDriveBar)) {
                GetClientRect(Globals.hDriveBar, &rt);
                prect->top += rt.bottom+2;
        }
        if (IsWindowVisible(Globals.hDriveBar)) {
                GetClientRect(Globals.hDriveBar, &rt);
                prect->top += rt.bottom+2;
        }
-
        if (IsWindowVisible(Globals.hStatusBar)) {
                GetClientRect(Globals.hStatusBar, &rt);
                prect->bottom -= rt.bottom;
        if (IsWindowVisible(Globals.hStatusBar)) {
                GetClientRect(Globals.hStatusBar, &rt);
                prect->bottom -= rt.bottom;
@@ -291,19 +288,16 @@ int is_exe_file(LPCTSTR ext)
 #endif
                0
        };
 #endif
                0
        };
-
        TCHAR ext_buffer[_MAX_EXT];
        const LPCTSTR* p;
        LPCTSTR s;
        LPTSTR d;
 
        TCHAR ext_buffer[_MAX_EXT];
        const LPCTSTR* p;
        LPCTSTR s;
        LPTSTR d;
 
-       for(s=ext+1,d=ext_buffer; (*d=tolower(*s)); s++)
+       for (s = ext + 1, d = ext_buffer; (*d = tolower(*s)); s++)
                d++;
                d++;
-
-       for(p=executable_extensions; *p; p++)
+       for (p = executable_extensions; *p; p++)
                if (!_tcscmp(ext_buffer, *p))
                        return 1;
                if (!_tcscmp(ext_buffer, *p))
                        return 1;
-
        return 0;
 }
 
        return 0;
 }
 
@@ -325,17 +319,16 @@ void set_curdir(ChildWnd* child, Entry* entry)
        if (!entry->scanned)
                scan_entry(child, entry);
        else {
        if (!entry->scanned)
                scan_entry(child, entry);
        else {
-               ListBox_ResetContent(child->right.hwnd);
+               ListBox_ResetContent(child->right.hWnd);
                insert_entries(&child->right, entry->down, -1);
                calc_widths(&child->right, FALSE);
 #ifndef _NO_EXTENSIONS
                set_header(&child->right);
 #endif
        }
                insert_entries(&child->right, entry->down, -1);
                calc_widths(&child->right, FALSE);
 #ifndef _NO_EXTENSIONS
                set_header(&child->right);
 #endif
        }
-
        get_path(entry, path);
        get_path(entry, path);
-       lstrcpy(child->path, path);
-       SetWindowText(child->hwnd, path);
+       lstrcpy(child->szPath, path);
+       SetWindowText(child->hWnd, path);
        SetCurrentDirectory(path);
 }
 
        SetCurrentDirectory(path);
 }
 
@@ -344,7 +337,7 @@ void set_curdir(ChildWnd* child, Entry* entry)
 BOOL calc_widths(Pane* pane, BOOL anyway)
 {
        int col, x, cx, spc=3*Globals.spaceSize.cx;
 BOOL calc_widths(Pane* pane, BOOL anyway)
 {
        int col, x, cx, spc=3*Globals.spaceSize.cx;
-       int entries = ListBox_GetCount(pane->hwnd);
+       int entries = ListBox_GetCount(pane->hWnd);
        int orgWidths[COLUMNS];
        int orgPositions[COLUMNS+1];
        HFONT hfontOld;
        int orgWidths[COLUMNS];
        int orgPositions[COLUMNS+1];
        HFONT hfontOld;
@@ -356,45 +349,38 @@ BOOL calc_widths(Pane* pane, BOOL anyway)
                memcpy(orgPositions, pane->positions, sizeof(orgPositions));
        }
 
                memcpy(orgPositions, pane->positions, sizeof(orgPositions));
        }
 
-       for(col=0; col<COLUMNS; col++)
+       for (col = 0; col < COLUMNS; col++)
                pane->widths[col] = 0;
 
                pane->widths[col] = 0;
 
-       hdc = GetDC(pane->hwnd);
+       hdc = GetDC(pane->hWnd);
        hfontOld = SelectFont(hdc, Globals.hFont);
 
        hfontOld = SelectFont(hdc, Globals.hFont);
 
-       for(cnt=0; cnt<entries; cnt++) {
-               Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, cnt);
+       for (cnt = 0; cnt < entries; cnt++) {
+               Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, cnt);
 
                DRAWITEMSTRUCT dis = {0/*CtlType*/, 0/*CtlID*/,
                        0/*itemID*/, 0/*itemAction*/, 0/*itemState*/,
 
                DRAWITEMSTRUCT dis = {0/*CtlType*/, 0/*CtlID*/,
                        0/*itemID*/, 0/*itemAction*/, 0/*itemState*/,
-                       pane->hwnd/*hwndItem*/, hdc};
+                       pane->hWnd/*hwndItem*/, hdc};
 
                draw_item(pane, &dis, entry, COLUMNS);
        }
 
                draw_item(pane, &dis, entry, COLUMNS);
        }
-
        SelectObject(hdc, hfontOld);
        SelectObject(hdc, hfontOld);
-       ReleaseDC(pane->hwnd, hdc);
+       ReleaseDC(pane->hWnd, hdc);
 
        x = 0;
 
        x = 0;
-       for(col=0; col<COLUMNS; col++) {
+       for ( col = 0; col < COLUMNS; col++) {
                pane->positions[col] = x;
                cx = pane->widths[col];
                pane->positions[col] = x;
                cx = pane->widths[col];
-
                if (cx) {
                        cx += spc;
                if (cx) {
                        cx += spc;
-
                        if (cx < IMAGE_WIDTH)
                                cx = IMAGE_WIDTH;
                        if (cx < IMAGE_WIDTH)
                                cx = IMAGE_WIDTH;
-
                        pane->widths[col] = cx;
                }
                        pane->widths[col] = cx;
                }
-
                x += cx;
        }
                x += cx;
        }
-
        pane->positions[COLUMNS] = x;
        pane->positions[COLUMNS] = x;
-
-       ListBox_SetHorizontalExtent(pane->hwnd, x);
+       ListBox_SetHorizontalExtent(pane->hWnd, x);
 
         // no change?
        if (!memcmp(orgWidths, pane->widths, sizeof(orgWidths)))
 
         // no change?
        if (!memcmp(orgWidths, pane->widths, sizeof(orgWidths)))
@@ -408,9 +394,7 @@ BOOL calc_widths(Pane* pane, BOOL anyway)
 
                return FALSE;
        }
 
                return FALSE;
        }
-
-       InvalidateRect(pane->hwnd, 0, TRUE);
-
+       InvalidateRect(pane->hWnd, 0, TRUE);
        return TRUE;
 }
 
        return TRUE;
 }
 
@@ -421,44 +405,33 @@ void calc_single_width(Pane* pane, int col)
 {
        HFONT hfontOld;
        int x, cx;
 {
        HFONT hfontOld;
        int x, cx;
-       int entries = ListBox_GetCount(pane->hwnd);
+       int entries = ListBox_GetCount(pane->hWnd);
        int cnt;
        HDC hdc;
 
        pane->widths[col] = 0;
        int cnt;
        HDC hdc;
 
        pane->widths[col] = 0;
-
-       hdc = GetDC(pane->hwnd);
+       hdc = GetDC(pane->hWnd);
        hfontOld = SelectFont(hdc, Globals.hFont);
        hfontOld = SelectFont(hdc, Globals.hFont);
-
-       for(cnt=0; cnt<entries; cnt++) {
-               Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, cnt);
-               DRAWITEMSTRUCT dis = {0, 0, 0, 0, 0, pane->hwnd, hdc};
-
+       for (cnt = 0; cnt < entries; cnt++) {
+               Entry* entry = (Entry*) ListBox_GetItemData(pane->hWnd, cnt);
+               DRAWITEMSTRUCT dis = {0, 0, 0, 0, 0, pane->hWnd, hdc};
                draw_item(pane, &dis, entry, col);
        }
                draw_item(pane, &dis, entry, col);
        }
-
        SelectObject(hdc, hfontOld);
        SelectObject(hdc, hfontOld);
-       ReleaseDC(pane->hwnd, hdc);
-
+       ReleaseDC(pane->hWnd, hdc);
        cx = pane->widths[col];
        cx = pane->widths[col];
-
        if (cx) {
                cx += 3*Globals.spaceSize.cx;
        if (cx) {
                cx += 3*Globals.spaceSize.cx;
-
                if (cx < IMAGE_WIDTH)
                        cx = IMAGE_WIDTH;
        }
                if (cx < IMAGE_WIDTH)
                        cx = IMAGE_WIDTH;
        }
-
        pane->widths[col] = cx;
        pane->widths[col] = cx;
-
        x = pane->positions[col] + cx;
        x = pane->positions[col] + cx;
-
        for(; col<COLUMNS; ) {
                pane->positions[++col] = x;
                x += pane->widths[col];
        }
        for(; col<COLUMNS; ) {
                pane->positions[++col] = x;
                x += pane->widths[col];
        }
-
-       ListBox_SetHorizontalExtent(pane->hwnd, x);
+       ListBox_SetHorizontalExtent(pane->hWnd, x);
 }
 
 
 }
 
 
@@ -472,51 +445,51 @@ static struct FullScreenParameters {
        FALSE   // mode
 };
 
        FALSE   // mode
 };
 
-BOOL toggle_fullscreen(HWND hwnd)
+BOOL toggle_fullscreen(HWND hWnd)
 {
        RECT rt;
 
        if ((g_fullscreen.mode=!g_fullscreen.mode)) {
 {
        RECT rt;
 
        if ((g_fullscreen.mode=!g_fullscreen.mode)) {
-               GetWindowRect(hwnd, &g_fullscreen.orgPos);
-               g_fullscreen.wasZoomed = IsZoomed(hwnd);
+               GetWindowRect(hWnd, &g_fullscreen.orgPos);
+               g_fullscreen.wasZoomed = IsZoomed(hWnd);
 
 
-               Frame_CalcFrameClient(hwnd, &rt);
-               ClientToScreen(hwnd, (LPPOINT)&rt.left);
-               ClientToScreen(hwnd, (LPPOINT)&rt.right);
+               Frame_CalcFrameClient(hWnd, &rt);
+               ClientToScreen(hWnd, (LPPOINT)&rt.left);
+               ClientToScreen(hWnd, (LPPOINT)&rt.right);
 
                rt.left = g_fullscreen.orgPos.left-rt.left;
                rt.top = g_fullscreen.orgPos.top-rt.top;
                rt.right = GetSystemMetrics(SM_CXSCREEN)+g_fullscreen.orgPos.right-rt.right;
                rt.bottom = GetSystemMetrics(SM_CYSCREEN)+g_fullscreen.orgPos.bottom-rt.bottom;
 
 
                rt.left = g_fullscreen.orgPos.left-rt.left;
                rt.top = g_fullscreen.orgPos.top-rt.top;
                rt.right = GetSystemMetrics(SM_CXSCREEN)+g_fullscreen.orgPos.right-rt.right;
                rt.bottom = GetSystemMetrics(SM_CYSCREEN)+g_fullscreen.orgPos.bottom-rt.bottom;
 
-               MoveWindow(hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
+               MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
        } else {
        } else {
-               MoveWindow(hwnd, g_fullscreen.orgPos.left, g_fullscreen.orgPos.top,
+               MoveWindow(hWnd, g_fullscreen.orgPos.left, g_fullscreen.orgPos.top,
                                                        g_fullscreen.orgPos.right-g_fullscreen.orgPos.left,
                                                        g_fullscreen.orgPos.bottom-g_fullscreen.orgPos.top, TRUE);
 
                if (g_fullscreen.wasZoomed)
                                                        g_fullscreen.orgPos.right-g_fullscreen.orgPos.left,
                                                        g_fullscreen.orgPos.bottom-g_fullscreen.orgPos.top, TRUE);
 
                if (g_fullscreen.wasZoomed)
-                       ShowWindow(hwnd, WS_MAXIMIZE);
+                       ShowWindow(hWnd, WS_MAXIMIZE);
        }
 
        return g_fullscreen.mode;
 }
 
        }
 
        return g_fullscreen.mode;
 }
 
-void fullscreen_move(HWND hwnd)
+void fullscreen_move(HWND hWnd)
 {
        RECT rt, pos;
 {
        RECT rt, pos;
-       GetWindowRect(hwnd, &pos);
+       GetWindowRect(hWnd, &pos);
 
 
-       Frame_CalcFrameClient(hwnd, &rt);
-       ClientToScreen(hwnd, (LPPOINT)&rt.left);
-       ClientToScreen(hwnd, (LPPOINT)&rt.right);
+       Frame_CalcFrameClient(hWnd, &rt);
+       ClientToScreen(hWnd, (LPPOINT)&rt.left);
+       ClientToScreen(hWnd, (LPPOINT)&rt.right);
 
        rt.left = pos.left-rt.left;
        rt.top = pos.top-rt.top;
        rt.right = GetSystemMetrics(SM_CXSCREEN)+pos.right-rt.right;
        rt.bottom = GetSystemMetrics(SM_CYSCREEN)+pos.bottom-rt.bottom;
 
 
        rt.left = pos.left-rt.left;
        rt.top = pos.top-rt.top;
        rt.right = GetSystemMetrics(SM_CXSCREEN)+pos.right-rt.right;
        rt.bottom = GetSystemMetrics(SM_CYSCREEN)+pos.bottom-rt.bottom;
 
-       MoveWindow(hwnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
+       MoveWindow(hWnd, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top, TRUE);
 }
 
 #endif
 }
 
 #endif
index e047d24..fecd972 100644 (file)
@@ -33,10 +33,10 @@ extern "C" {
 
 
 
 
 
 
-void display_error(HWND hwnd, DWORD error);
-void frame_get_clientspace(HWND hwnd, PRECT prect);
-BOOL toggle_fullscreen(HWND hwnd);
-void fullscreen_move(HWND hwnd);
+void display_error(HWND hWnd, DWORD error);
+void frame_get_clientspace(HWND hWnd, PRECT prect);
+BOOL toggle_fullscreen(HWND hWnd);
+void fullscreen_move(HWND hWnd);
 
 BOOL calc_widths(Pane* pane, BOOL anyway);
 void calc_single_width(Pane* pane, int col);
 
 BOOL calc_widths(Pane* pane, BOOL anyway);
 void calc_single_width(Pane* pane, int col);
index 9ec7724..56071fa 100644 (file)
@@ -31,19 +31,27 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
-IDI_WINFILE             ICON    DISCARDABLE     "winfile.ICO"
-IDI_SMALL               ICON    DISCARDABLE     "SMALL.ICO"
+IDI_WINFILE             ICON    DISCARDABLE     "res/winfile.ico"
+IDI_SMALL               ICON    DISCARDABLE     "res/small.ico"
 
 ////////////////////////////////////////////////////////////////////////////////
 // Bitmaps
 //
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Bitmaps
 //
 
-IDB_OPEN_FILE           BITMAP DISCARDABLE     "folder1.bmp"
-IDB_CLOSED_FILE         BITMAP DISCARDABLE     "folder2.bmp"
-IDB_ROOT                BITMAP DISCARDABLE     "folder3.bmp"
-IDB_TOOLBAR                            BITMAP  DISCARDABLE     "toolbar.bmp"
-IDB_DRIVEBAR                   BITMAP  DISCARDABLE     "drivebar.bmp"
-IDB_IMAGES                         BITMAP      DISCARDABLE     "images.bmp"
+//IDB_FOLDER_PLUS         BITMAP       DISCARDABLE     "res/folder_plus.bmp"
+//IDB_FOLDER_MINUS        BITMAP       DISCARDABLE     "res/folder_minus.bmp"
+//IDB_FOLDER_OPEN_PLUS BITMAP  DISCARDABLE     "res/folder_open_plus.bmp"
+//IDB_FOLDER_OPEN_MINUS        BITMAP  DISCARDABLE     "res/folder_open_minus.bmp"
+
+IDB_FOLDER              BITMAP DISCARDABLE     "res/folder1.bmp"
+IDB_FOLDER_RED          BITMAP DISCARDABLE     "res/folder3.bmp"
+IDB_FOLDER_OPEN         BITMAP DISCARDABLE     "res/folder_open.bmp"
+
+IDB_ROOT                BITMAP DISCARDABLE     "res/folder2.bmp"
+
+IDB_TOOLBAR                            BITMAP  DISCARDABLE     "res/toolbar.bmp"
+IDB_DRIVEBAR                   BITMAP  DISCARDABLE     "res/drivebar.bmp"
+IDB_IMAGES                         BITMAP      DISCARDABLE     "res/images.bmp"
 
 /////////////////////////////////////////////////////////////////////////////
 //
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -71,7 +79,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Cr&eate directory...\t",      ID_FILE_CREATE_DIRECTORY, GRAYED
         MENUITEM "Searc&h...\t",                ID_FILE_SEARCH, GRAYED
         MENUITEM SEPARATOR
         MENUITEM "Cr&eate directory...\t",      ID_FILE_CREATE_DIRECTORY, GRAYED
         MENUITEM "Searc&h...\t",                ID_FILE_SEARCH, GRAYED
-        MENUITEM "Select &Files...\t",          ID_FILE_SEARCH_FILES, GRAYED
+        MENUITEM "Select &Files...\t",          ID_FILE_SELECT_FILES, GRAYED
         MENUITEM SEPARATOR
         MENUITEM "E&xit",                       ID_FILE_EXIT
     END
         MENUITEM SEPARATOR
         MENUITEM "E&xit",                       ID_FILE_EXIT
     END
@@ -100,20 +108,20 @@ BEGIN
     END
     POPUP "&View"
     BEGIN
     END
     POPUP "&View"
     BEGIN
-        MENUITEM "T&ree and Directory",          ID_VIEW_TREE_DIRECTORY, GRAYED
-        MENUITEM "Tr&ee Only",                   ID_VIEW_TREE_ONLY, GRAYED
-        MENUITEM "Directory &Only",              ID_VIEW_DIRECTORY_ONLY, GRAYED
+        MENUITEM "T&ree and Directory",         ID_VIEW_TREE_DIRECTORY, GRAYED
+        MENUITEM "Tr&ee Only",                  ID_VIEW_TREE_ONLY, GRAYED
+        MENUITEM "Directory &Only",             ID_VIEW_DIRECTORY_ONLY, GRAYED
         MENUITEM SEPARATOR
         MENUITEM SEPARATOR
-        MENUITEM "Sp&lit",                       ID_VIEW_SPLIT, GRAYED
+        MENUITEM "Sp&lit",                      ID_VIEW_SPLIT, GRAYED
         MENUITEM SEPARATOR
         MENUITEM SEPARATOR
-        MENUITEM "&Name",                        ID_VIEW_NAME
-        MENUITEM "&All File Details",            ID_VIEW_ALL_FILE_DETAILS
-        MENUITEM "&Partial Details...",          ID_VIEW_PARTIAL_DETAILS, GRAYED
+        MENUITEM "&Name",                       ID_VIEW_NAME
+        MENUITEM "&All File Details",           ID_VIEW_ALL_FILE_DETAILS
+        MENUITEM "&Partial Details...",         ID_VIEW_PARTIAL_DETAILS, GRAYED
         MENUITEM SEPARATOR
         MENUITEM SEPARATOR
-        MENUITEM "&Sort by Name",                ID_VIEW_SORT_BY_NAME
-        MENUITEM "Sort &by Type",                ID_VIEW_SORT_BY_TYPE
-        MENUITEM "Sort by Si&ze",                ID_VIEW_SORT_BY_SIZE
-        MENUITEM "Sort by &Date",                ID_VIEW_SORT_BY_DATE
+        MENUITEM "&Sort by Name",               ID_VIEW_SORT_BY_NAME
+        MENUITEM "Sort &by Type",               ID_VIEW_SORT_BY_TYPE
+        MENUITEM "Sort by Si&ze",               ID_VIEW_SORT_BY_SIZE
+        MENUITEM "Sort by &Date",               ID_VIEW_SORT_BY_DATE
         MENUITEM SEPARATOR
         MENUITEM "By File &Type...",            ID_VIEW_BY_FILE_TYPE, GRAYED
     END
         MENUITEM SEPARATOR
         MENUITEM "By File &Type...",            ID_VIEW_BY_FILE_TYPE, GRAYED
     END
@@ -208,7 +216,6 @@ END
 STRINGTABLE DISCARDABLE 
 BEGIN
     IDS_APP_TITLE           "ReactOS File Manager"
 STRINGTABLE DISCARDABLE 
 BEGIN
     IDS_APP_TITLE           "ReactOS File Manager"
-    IDS_HELLO               "Hello World!"
 
     ID_FILE_MENU            "Commands for working with files"
     ID_DISK_MENU            "Commands for working with disk"
 
     ID_FILE_MENU            "Commands for working with files"
     ID_DISK_MENU            "Commands for working with disk"
@@ -219,11 +226,49 @@ BEGIN
     ID_WINDOW_MENU          "Commands for manipulating windows"
     ID_HELP_MENU            "Commands for displaying help and information about file manager"
 
     ID_WINDOW_MENU          "Commands for manipulating windows"
     ID_HELP_MENU            "Commands for displaying help and information about file manager"
 
-    ID_FILE_DELETE          "Deletes the selection"
-    ID_FILE_RENAME          "Renames the selection"
-    ID_FILE_SEARCH          "Finds a text string in a key, value or data"
-    ID_FILE_SEARCH_FILES    "Finds next occurrence of text specified in previous search"
-    ID_FILE_EXIT            "Quits the file manager"
+    ID_FILE_OPEN             "Opens selected item"
+    ID_FILE_MOVE                        "Moves selected item"
+    ID_FILE_COPY                        "Copies files and directories"
+    ID_FILE_COPY_CLIPBOARD      "Copies selected item to the clipboard"
+    ID_FILE_DELETE                      "Deletes files and directories"
+    ID_FILE_RENAME                      "Renames a file or directory"
+    ID_FILE_PROPERTIES          "Set file attributes and display file properties"
+    ID_FILE_COMPRESS            "Compresses files or directories"
+    ID_FILE_UNCOMPRESS          "Uncompresses files or directories"
+    ID_FILE_RUN                                 "Starts or opens and application or file"
+    ID_FILE_PRINT                       "Prints a file"
+    ID_FILE_ASSOCIATE           "associates a file type with an application"
+    ID_FILE_CREATE_DIRECTORY "Creates a directory"
+    ID_FILE_SEARCH                      "Searches for files and directories"
+    ID_FILE_SELECT_FILES        "Selects files and directories"
+    ID_FILE_EXIT             "Quits the file manager"
+
+    ID_DISK_COPY_DISK                           "Copies a floppy disk"
+    ID_DISK_LABEL_DISK                          "Assigns or changes the volume lable of the disk"
+    ID_DISK_FORMAT_DISK                                 "Formats a floppy disk"
+    ID_DISK_CONNECT_NETWORK_DRIVE       "Connects to a network drive"
+    ID_DISK_DISCONNECT_NETWORK_DRIVE "Disconnects from a network drive"
+    ID_DISK_SHARE_AS                            "Shares a directory"
+    ID_DISK_STOP_SHARING                        "Stops sharing a directory"
+    ID_DISK_SELECT_DRIVE                        "Selects a different drive or volume"
+
+    ID_TREE_EXPAND_ONE_LEVEL             "Displays another level of a directory"
+    ID_TREE_EXPAND_BRANCH                               "Displays all levels of a directory"
+    ID_TREE_EXPAND_ALL                                  "Displays all levels of all directories"
+    ID_TREE_INDICATE_EXPANDABLE_BRANCHES "Indicates directories that have sub-directories"
+
+    ID_VIEW_TREE_DIRECTORY      "Displays the directory tree and the contents of the current directory"
+    ID_VIEW_TREE_ONLY           "Displays the directory tree"
+    ID_VIEW_DIRECTORY_ONLY      "Displays the contents of the current directory"
+    ID_VIEW_SPLIT                       "Splits a directory window or moves the split bar"
+    ID_VIEW_NAME                        "Show filenames only"
+    ID_VIEW_ALL_FILE_DETAILS "Show all file details"
+    ID_VIEW_PARTIAL_DETAILS     "Show partial file details"
+    ID_VIEW_SORT_BY_NAME        "Sorts files by name"
+    ID_VIEW_SORT_BY_TYPE        "Sorts files by type"
+    ID_VIEW_SORT_BY_SIZE        "Sorts files by size"
+    ID_VIEW_SORT_BY_DATE        "Sorts files by date"
+    ID_VIEW_BY_FILE_TYPE     "Shows files of a specified type and filters filenames"
 
     ID_OPTIONS_CONFIRMATION      "Controls confirmation messages..."
     ID_OPTIONS_FONT              "Changes the File Manager Font..."
 
     ID_OPTIONS_CONFIRMATION      "Controls confirmation messages..."
     ID_OPTIONS_FONT              "Changes the File Manager Font..."
@@ -235,16 +280,30 @@ BEGIN
     ID_OPTIONS_MINIMISE_ON_USE   "Reduces File Manager to an icon at startup"
     ID_OPTIONS_SAVE_ON_EXIT      "Saves settings when exiting File Manager"
 
     ID_OPTIONS_MINIMISE_ON_USE   "Reduces File Manager to an icon at startup"
     ID_OPTIONS_SAVE_ON_EXIT      "Saves settings when exiting File Manager"
 
-    ID_VIEW_SPLIT           "Change position of split between two panes"
-    ID_WINDOW_REFRESH       "Refreshes the window"
+    ID_SECURITY_PERMISSIONS "View or set permission information on the selected items"
+    ID_SECURITY_AUDITING    "View or set auditing information on the selected items"
+    ID_SECURITY_OWNER       "View or take ownership of the selected items"
+
+    ID_WINDOW_NEW_WINDOW    "Opens a new window"
+    ID_WINDOW_CASCADE      "Cascades windows"
+    ID_WINDOW_TILE_HORZ                "Tiles windows horizontally"
+    ID_WINDOW_TILE_VERT                "Tiles windows vertically"
+    ID_WINDOW_ARRANGE_ICONS    "Arranges icons"
+    ID_WINDOW_REFRESH       "Updates the contents of a window"
 
        ID_HELP_CONTENTS        "Displays contents for File Manager Help"
        ID_HELP_SEARCH_HELP     "Searches for a topic in File Manager Help"
        ID_HELP_HOW_TO_USE_HELP "Displays information about using help"
     ID_HELP_ABOUT           "Displays program information, version number and copyright"
 
 
        ID_HELP_CONTENTS        "Displays contents for File Manager Help"
        ID_HELP_SEARCH_HELP     "Searches for a topic in File Manager Help"
        ID_HELP_HOW_TO_USE_HELP "Displays information about using help"
     ID_HELP_ABOUT           "Displays program information, version number and copyright"
 
-    IDC_WINFILE             "WINFILE"
-    IDC_WINFILE_FRAME       "WINFILE_FRAME"
+    IDC_WINFILE             "ROSFILE"
+    IDC_WINFILE_CHILD       "ROSFILE_CHILD"
+
+    IDS_LIST_COLUMN_NAME    "Name"
+    IDS_LIST_COLUMN_SIZE    "Size"
+    IDS_LIST_COLUMN_DATE    "Date"
+    IDS_LIST_COLUMN_ATTRIB  "Attributes"
+    IDS_LIST_COLUMN_DOSNAME "DOS-Name"
 END
 
 #endif    // English (U.S.) resources
 END
 
 #endif    // English (U.S.) resources