Updated with latest progress. Started on a worker thread for network enumerating...
authorRobert Dickenson <robd@reactos.org>
Sat, 20 Jul 2002 16:24:45 +0000 (16:24 +0000)
committerRobert Dickenson <robd@reactos.org>
Sat, 20 Jul 2002 16:24:45 +0000 (16:24 +0000)
svn path=/trunk/; revision=3272

12 files changed:
rosapps/winfile/Makefile
rosapps/winfile/childwnd.c
rosapps/winfile/framewnd.c
rosapps/winfile/framewnd.h
rosapps/winfile/listview.c
rosapps/winfile/main.c
rosapps/winfile/main.h
rosapps/winfile/res/winfile.ico
rosapps/winfile/treeview.c
rosapps/winfile/winfile.rc
rosapps/winfile/worker.c [new file with mode: 0644]
rosapps/winfile/worker.h [new file with mode: 0644]

index fa7abcf..b6cc00d 100644 (file)
@@ -30,25 +30,26 @@ RCFLAGS = -DGCC -D_WIN32_IE=0x0400
 
 
 OBJS = about.o \
-        framewnd.o \
         childwnd.o \
         debug.o \
         dialogs.o \
         draw.o \
         entries.o \
-        run.o \
-        shell.o \
+        framewnd.o \
+        listview.o \
+        main.o \
         network.o \
         settings.o \
-        splitpath.o \
+        shell.o \
         sort.o \
-        utils.o \
-        treeview.o \
-        listview.o \
+        splitpath.o \
+        run.o \
         trace.o \
-        main.o
+        treeview.o \
+        utils.o \
+        worker.o
 
-LIBS = -lgdi32 -luser32 -lkernel32 -lcomctl32
+LIBS = -lgdi32 -luser32 -lkernel32 -ladvapi32 -lcomctl32 -lcomdlg32 -lversion
 
 all:   $(TARGET).exe
 
index 61d8652..8614eca 100644 (file)
@@ -40,8 +40,8 @@
 #define ASSERT assert
 
 #include "main.h"
-#include "childwnd.h"
 #include "framewnd.h"
+#include "childwnd.h"
 #include "treeview.h"
 #include "listview.h"
 #include "dialogs.h"
 ////////////////////////////////////////////////////////////////////////////////
 // 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)
 {
@@ -168,22 +87,12 @@ static BOOL pane_command(Pane* pane, UINT cmd)
                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:
@@ -191,24 +100,6 @@ static BOOL pane_command(Pane* pane, UINT cmd)
        }
        return TRUE;
 }
- */
-////////////////////////////////////////////////////////////////////////////////
-//
-//HWND hSplitWnd;                  // Splitter Bar Control Window
-//
-//    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)
 {
@@ -222,72 +113,14 @@ static void draw_splitbar(HWND hWnd, int x)
        ReleaseDC(hWnd, hdc);
 }
 
-#if 1
-static void OnPaint(HWND hWnd, ChildWnd* pChildWnd)
+static void ResizeWnd(ChildWnd* pChildWnd, int cx, int cy)
 {
-    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);
+       HDWP hdwp = BeginDeferWindowPos(2);
        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);
+       cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2;
+       DeferWindowPos(hdwp, pChildWnd->left.hWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
+       DeferWindowPos(hdwp, pChildWnd->right.hWnd, 0, rt.left+cx+1, rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
        EndDeferWindowPos(hdwp);
 }
 
@@ -305,6 +138,22 @@ void OnFileMove(HWND hWnd)
        }
 }
 
+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);
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 //  FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
@@ -315,11 +164,11 @@ void OnFileMove(HWND hWnd)
 
 static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-       UINT cmd = LOWORD(wParam);
+       //UINT cmd = LOWORD(wParam);
        //HWND hChildWnd;
 
-    if (1) {
-               switch (cmd) {
+       switch (LOWORD(wParam)) {
+    // Parse the menu selections:
 /*
 //        case ID_FILE_MOVE:
 //            OnFileMove(hWnd);
@@ -397,12 +246,11 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 //                     return DefMDIChildProc(hWnd, message, wParam, lParam);
             return FALSE;
             break;
-               }
        }
        return TRUE;
 }
 
-
+////////////////////////////////////////////////////////////////////////////////
 //
 //  FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
 //
@@ -421,139 +269,94 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
        ASSERT(pChildWnd);
 
        switch(message) {
-               case WM_CREATE:
-               CreateTreeWnd(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT);
-            CreateListWnd(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, pChildWnd->szPath);
-            //create_tree_window(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT, IDW_HEADER_LEFT, pChildWnd->szPath);
-            //create_list_window(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT);
-            return 0;
-                       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;
-                               }
+       case WM_CREATE:
+        CreateTreeWnd(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT);
+        CreateListWnd(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, pChildWnd->szPath);
+        //create_tree_window(pChildWnd->hWnd, &pChildWnd->left, IDW_TREE_LEFT, IDW_HEADER_LEFT, pChildWnd->szPath);
+        //create_list_window(pChildWnd->hWnd, &pChildWnd->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT);
+        return 0;
+               break;
+    case WM_PAINT:
+        OnPaint(hWnd, pChildWnd);
+        return 0;
+       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;
+               }
+               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;
+                       draw_splitbar(hWnd, last_split);
+                       SetCapture(hWnd);
+               }
+               break;}
 
-               case WM_LBUTTONDOWN: {
+       case WM_LBUTTONUP:
+               if (GetCapture() == hWnd) {
                        RECT rt;
                        int x = LOWORD(lParam);
-
+                       draw_splitbar(hWnd, last_split);
+                       last_split = -1;
                        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;}
+                       pChildWnd->nSplitPos = x;
+                       ResizeWnd(pChildWnd, rt.right, rt.bottom);
+                       ReleaseCapture();
+               }
+               break;
 
-               case WM_LBUTTONUP:
+       case WM_CAPTURECHANGED:
+               if (GetCapture()==hWnd && last_split>=0)
+                       draw_splitbar(hWnd, last_split);
+               break;
+
+    case WM_KEYDOWN:
+               if (wParam == VK_ESCAPE)
                        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
+                ResizeWnd(pChildWnd, rt.right, rt.bottom);
+                               last_split = -1;
                                ReleaseCapture();
+                               SetCursor(LoadCursor(0, IDC_ARROW));
                        }
-                       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;
+               break;
 
-                       lpmmi->ptMaxTrackSize.x <<= 1;//2*GetSystemMetrics(SM_CXSCREEN) / SM_CXVIRTUALSCREEN
-                       lpmmi->ptMaxTrackSize.y <<= 1;//2*GetSystemMetrics(SM_CYSCREEN) / SM_CYVIRTUALSCREEN
-                       break;}
-#endif
+       case WM_MOUSEMOVE:
+               if (GetCapture() == hWnd) {
+                       RECT rt;
+                       int x = LOWORD(lParam);
+                       HDC hdc = GetDC(hWnd);
+                       GetClientRect(hWnd, &rt);
+                       rt.left = last_split-SPLIT_WIDTH/2;
+                       rt.right = last_split+SPLIT_WIDTH/2+1;
+                       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);
+               }
+               break;
 
-               case WM_SETFOCUS:
-                       SetCurrentDirectory(pChildWnd->szPath);
-                       SetFocus(pChildWnd->nFocusPanel? pChildWnd->right.hWnd: pChildWnd->left.hWnd);
-                       break;
+       case WM_SETFOCUS:
+               SetCurrentDirectory(pChildWnd->szPath);
+               SetFocus(pChildWnd->nFocusPanel? pChildWnd->right.hWnd: pChildWnd->left.hWnd);
+               break;
 
        case WM_DISPATCH_COMMAND:
         if (_CmdWndProc(hWnd, message, wParam, lParam)) break;
@@ -565,15 +368,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
                break;
 
        case WM_COMMAND:
-/*
-        if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
-            return DefMDIChildProc(hWnd, message, wParam, lParam);
-        } else {
-               return _CmdWndProc(hWnd, message, wParam, lParam);
-//             return DefMDIChildProc(hWnd, message, wParam, lParam);
-        }
-               break;
- */
         if (_CmdWndProc(hWnd, message, wParam, lParam)) break;
                        return DefMDIChildProc(hWnd, message, wParam, lParam);
 
@@ -585,102 +379,39 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
 //             return _CmdWndProc(hWnd, message, wParam, lParam);
 //        }
                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) {
-                if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) {
-                    Entry* entry = (Entry*)((NMTREEVIEW*)lParam)->itemNew.lParam;
-                    if (entry != NULL) {
-                        //RefreshList(pChildWnd->right.hWnd, entry);
-                        //void set_curdir(ChildWnd* child, Entry* entry)
-                        set_curdir(pChildWnd, entry);
-                    }
-                }
-                if (!SendMessage(pChildWnd->left.hWnd, message, wParam, lParam)) {
-                    return DefMDIChildProc(hWnd, message, wParam, lParam);
+       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 ((int)wParam == IDW_TREE_LEFT) {
+            if ((((LPNMHDR)lParam)->code) == TVN_SELCHANGED) {
+                Entry* entry = (Entry*)((NMTREEVIEW*)lParam)->itemNew.lParam;
+                if (entry != NULL) {
+                    //RefreshList(pChildWnd->right.hWnd, entry);
+                    //void set_curdir(ChildWnd* child, Entry* entry)
+                    set_curdir(pChildWnd, entry);
                 }
             }
-            if (idCtrl == IDW_TREE_RIGHT) {
-                if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
-                    return DefMDIChildProc(hWnd, message, wParam, lParam);
-                }
+            if (!SendMessage(pChildWnd->left.hWnd, message, wParam, lParam)) {
+                return DefMDIChildProc(hWnd, message, wParam, lParam);
             }
-                        }
-//#endif
-            break;
-
-               case WM_SIZE:
-            if (wParam != SIZE_MINIMIZED) {
-                OnSize(pChildWnd, wParam, lParam);
+        } else
+        if ((int)wParam == IDW_TREE_RIGHT) {
+            if (!SendMessage(pChildWnd->right.hWnd, message, wParam, lParam)) {
+                return DefMDIChildProc(hWnd, message, wParam, lParam);
             }
-            // fall through
-               default: def:
-                       return DefMDIChildProc(hWnd, message, wParam, lParam);
+        }
+        }
+        break;
+
+       case WM_SIZE:
+        if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
+               ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
+        }
+        // fall through
+    default: def:
+               return DefMDIChildProc(hWnd, message, wParam, lParam);
        }
        return 0;
 }
index 06383ac..47dc719 100644 (file)
@@ -23,7 +23,7 @@
 #ifdef _MSC_VER
 #include "stdafx.h"
 #else
-#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
+//#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
 #include <windows.h>
 #include <commctrl.h>
 #include <stdlib.h>
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// Global Variables:
+// Global and Local 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
 
+static HHOOK hcbthook;
+static ChildWnd* newchild = NULL;
+
+
 ////////////////////////////////////////////////////////////////////////////////
 // Local module support methods
 //
@@ -110,8 +114,6 @@ void resize_frame_client(HWND hWnd)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-static HHOOK hcbthook;
-static ChildWnd* newchild = NULL;
 
 static LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
 {
@@ -486,7 +488,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                case ID_OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT:
             if (Globals.Options & OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT) {
                 Globals.Options &= ~OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT;
-                CheckMenuItem(Globals.hMenuOptions, cmd, MF_CHECKED);
+                CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND);
             } else {
                 Globals.Options |= OPTIONS_OPEN_NEW_WINDOW_ON_CONNECT;
                 CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND | MF_CHECKED);
@@ -495,7 +497,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                case ID_OPTIONS_MINIMISE_ON_USE:
             if (Globals.Options & ID_OPTIONS_MINIMISE_ON_USE) {
                 Globals.Options &= ~ID_OPTIONS_MINIMISE_ON_USE;
-                CheckMenuItem(Globals.hMenuOptions, cmd, MF_CHECKED);
+                CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND);
             } else {
                 Globals.Options |= ID_OPTIONS_MINIMISE_ON_USE;
                 CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND | MF_CHECKED);
@@ -504,7 +506,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         case ID_OPTIONS_SAVE_ON_EXIT:
             if (Globals.Options & OPTIONS_SAVE_ON_EXIT) {
                 Globals.Options &= ~OPTIONS_SAVE_ON_EXIT;
-                CheckMenuItem(Globals.hMenuOptions, cmd, MF_CHECKED);
+                CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND);
             } else {
                 Globals.Options |= OPTIONS_SAVE_ON_EXIT;
                 CheckMenuItem(Globals.hMenuOptions, cmd, MF_BYCOMMAND | MF_CHECKED);
@@ -716,7 +718,6 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
         HMENU hMenuWindow = GetSubMenu(Globals.hMenuFrame, GetMenuItemCount(Globals.hMenuFrame)-2);
         CLIENTCREATESTRUCT ccs = { hMenuWindow, IDW_FIRST_CHILD };
         Globals.hMDIClient = CreateWindowEx(0, _T("MDICLIENT"), NULL,
-                //WS_CHILD|WS_CLIPCHILDREN|WS_VSCROLL|WS_HSCROLL|WS_VISIBLE|WS_BORDER,
                 WS_EX_MDICHILD|WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
                 0, 0, 0, 0,
                 hWnd, (HMENU)0, hInst, &ccs);
@@ -732,6 +733,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
         if (MsgNotify(hWnd, message, wParam, lParam)) return TRUE;
 //        return MsgNotify(hWnd, message, wParam, lParam);
         switch (((LPNMHDR)lParam)->code) { 
+#ifdef _MSC_VER
         case TTN_GETDISPINFO: 
             { 
             LPTOOLTIPTEXT lpttt; 
@@ -741,6 +743,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
             lpttt->lpszText = MAKEINTRESOURCE(lpttt->hdr.idFrom); 
             } 
             break; 
+#endif
         default:
             break;
         }
index c629d15..82805a9 100644 (file)
@@ -34,10 +34,7 @@ extern "C" {
 
 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
index 359500d..df2fd40 100644 (file)
@@ -35,9 +35,6 @@
 #endif
     
 #include <windowsx.h>
-//#include <assert.h>
-//#define ASSERT assert
-
 #include "main.h"
 #include "listview.h"
 #include "dialogs.h"
 
 static WNDPROC g_orgListWndProc;
 
+#define MAX_LIST_COLUMNS 5
+static int default_column_widths[MAX_LIST_COLUMNS] = { 175, 100, 100, 100, 70 };
+static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_LEFT };
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // Local module support methods
@@ -98,10 +99,6 @@ static void InsertListEntries(HWND hWnd, Entry* entry, int idx)
     ShowWindow(hWnd, SW_SHOW);
 }
 
-#define MAX_LIST_COLUMNS 5
-static int default_column_widths[MAX_LIST_COLUMNS] = { 175, 100, 100, 100, 70 };
-static int column_alignment[MAX_LIST_COLUMNS] = { LVCFMT_LEFT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_RIGHT, LVCFMT_LEFT };
-
 static void CreateListColumns(HWND hWndListView)
 {
     TCHAR szText[50];
@@ -296,13 +293,9 @@ void RefreshList(HWND hWnd, Entry* entry)
 
 static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-       UINT cmd = LOWORD(wParam);
-       //HWND hChildWnd;
-
-    if (1) {
-               switch (cmd) {
-        case ID_FILE_OPEN:
-            {
+       switch (LOWORD(wParam)) {
+    case ID_FILE_OPEN:
+        {
             LVITEM item;
             item.mask = LVIF_PARAM;
 //            UINT selected_count = ListView_GetSelectedCount(hWnd);
@@ -313,19 +306,18 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                     OpenTarget(hWnd, entry->data.cFileName);
                 }
             }
-            }
-
-            break;
-        case ID_FILE_MOVE:
-            //OnFileMove(hWnd);
-            break;
-        case ID_FILE_COPY:
-        case ID_FILE_COPY_CLIPBOARD:
-        case ID_FILE_DELETE:
-        case ID_FILE_RENAME:
-            break;
-        case ID_FILE_PROPERTIES:
-            {
+        }
+        break;
+    case ID_FILE_MOVE:
+        //OnFileMove(hWnd);
+        break;
+    case ID_FILE_COPY:
+    case ID_FILE_COPY_CLIPBOARD:
+    case ID_FILE_DELETE:
+    case ID_FILE_RENAME:
+        break;
+    case ID_FILE_PROPERTIES:
+        {
             LVITEM item;
             item.mask = LVIF_PARAM;
             item.iItem = ListView_GetNextItem(hWnd, -1, LVNI_SELECTED);
@@ -337,37 +329,34 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                     }
                 }
             }
-            }
-            break;
+        }
+        break;
 
-        case ID_FILE_COMPRESS:
-        case ID_FILE_UNCOMPRESS:
-            break;
-        case ID_FILE_RUN:
-            OnFileRun();
-            break;
-        case ID_FILE_PRINT:
-        case ID_FILE_ASSOCIATE:
-        case ID_FILE_CREATE_DIRECTORY:
-            break;
-        case ID_VIEW_SORT_BY_NAME:
-        case ID_VIEW_SORT_BY_TYPE:
-        case ID_VIEW_SORT_BY_SIZE:
-        case ID_VIEW_SORT_BY_DATE:
-            CmdSortItems(hWnd, cmd);
-            break;
-        case ID_WINDOW_REFRESH:
-            RefreshList(hWnd, NULL/*entry*/);
-            break;
-               default:
-            return FALSE;
-               }
-       }
-       return TRUE;
+    case ID_FILE_COMPRESS:
+    case ID_FILE_UNCOMPRESS:
+        break;
+    case ID_FILE_RUN:
+        OnFileRun();
+        break;
+    case ID_FILE_PRINT:
+    case ID_FILE_ASSOCIATE:
+    case ID_FILE_CREATE_DIRECTORY:
+        break;
+    case ID_VIEW_SORT_BY_NAME:
+    case ID_VIEW_SORT_BY_TYPE:
+    case ID_VIEW_SORT_BY_SIZE:
+    case ID_VIEW_SORT_BY_DATE:
+        CmdSortItems(hWnd, LOWORD(wParam));
+        break;
+    case ID_WINDOW_REFRESH:
+        RefreshList(hWnd, NULL/*entry*/);
+        break;
+    default:
+        return FALSE;
+    }
+    return TRUE;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-
 static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
        ChildWnd* child = (ChildWnd*)GetWindowLong(GetParent(hWnd), GWL_USERDATA);
@@ -395,6 +384,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
             if (nmitem->hdr.hwndFrom != hWnd) break; 
 //            if (nmitem->hdr.idFrom != IDW_LISTVIEW) break; 
 //            if (nmitem->hdr.code != ???) break; 
+#ifdef _MSC_VER
             switch (nmitem->uKeyFlags) {
             case LVKF_ALT:     //  The ALT key is pressed.  
                 // properties dialog box ?
@@ -405,6 +395,7 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
             case LVKF_SHIFT:   //  The SHIFT key is pressed.   
                 break;
             }
+#endif
             info.pt.x = nmitem->ptAction.x;
             info.pt.y = nmitem->ptAction.y;
             if (ListView_HitTest(hWnd, &info) != -1) {
index 1b2edad..9cc771a 100644 (file)
@@ -95,10 +95,6 @@ TCHAR szChildClass[MAX_LOADSTRING];
 //
 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
 {
-//    char TCHAR[MAX_PATH];
-//    int nParts[4];
-//    ChildWnd* child;
-
        WNDCLASSEX wcFrame = {
                sizeof(WNDCLASSEX),
                CS_HREDRAW | CS_VREDRAW/*style*/,
@@ -157,7 +153,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
        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*/);
+                                       0/*hWndParent*/, hMenuFrame, hInstance, NULL/*lpParam*/);
     if (!Globals.hMainWnd) {
         return FALSE;
     }
@@ -320,13 +316,6 @@ SetParent (hWndEdit, Globals.hToolBar);
 
     // Create the status bar panes
        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);
@@ -355,16 +344,7 @@ SetParent (hWndEdit, Globals.hToolBar);
     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)
 {
index 8ddce78..004bb9b 100644 (file)
@@ -189,6 +189,19 @@ extern TCHAR szChildClass[];
 void SetupStatusBar(BOOL bResize);
 void UpdateStatusBar(void);
 
+#ifndef _MSC_VER
+typedef struct tagNMITEMACTIVATE{
+    NMHDR   hdr;
+    int     iItem;
+    int     iSubItem;
+    UINT    uNewState;
+    UINT    uOldState;
+    UINT    uChanged;
+    POINT   ptAction;
+    LPARAM  lParam;
+    UINT    uKeyFlags;
+} NMITEMACTIVATE, FAR *LPNMITEMACTIVATE;
+#endif
 
 #ifdef __cplusplus
 };
index 3868835..930fe4f 100644 (file)
Binary files a/rosapps/winfile/res/winfile.ico and b/rosapps/winfile/res/winfile.ico differ
index 42d8dbe..29296a1 100644 (file)
 
 #include "trace.h"
 
-// Global Variables:
-extern HINSTANCE hInst;
-
 
 // Global variables and constants 
-// Image_Open, Image_Closed, and Image_Root - integer variables for 
-// indexes of the images. 
+// Image_Open, Image_Closed, and Image_Root - integer variables for indexes of the images. 
 // CX_BITMAP and CY_BITMAP - width and height of an icon. 
 // NUM_BITMAPS - number of bitmaps to add to the image list. 
 int Image_Open; 
@@ -315,6 +311,22 @@ static BOOL InitTreeViewImageLists(HWND hwndTV)
     return TRUE; 
 } 
 
+BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
+{ 
+    static int expanding;
+
+    Entry* entry = (Entry*)pnmtv->itemNew.lParam;
+
+    if (expanding) return FALSE;
+    expanding = TRUE;
+    if (entry) {
+        insert_tree_entries(hwndTV, entry->down, 0);
+//             insert_tree_entries(hwndTV, entry, 0);
+    }
+    expanding = FALSE;
+    return TRUE;
+} 
+
 #ifndef _MSC_VER
 #define NMTVDISPINFO TV_DISPINFO
 #define NMTVDISPINFO TV_DISPINFO
@@ -342,27 +354,6 @@ static void OnGetDispInfo(NMTVDISPINFO* ptvdi)
         ptvdi->item.cchTextMax = lstrlen(entry->data.cFileName); 
     }
 } 
-/*
-typedef struct tagTVITEM{
-    UINT      mask;
-    HTREEITEM hItem;
-    UINT      state;
-    UINT      stateMask;
-    LPTSTR    pszText;
-    int       cchTextMax;
-    int       iImage;
-    int       iSelectedImage;
-    int       cChildren;
-    LPARAM    lParam;
-} TVITEM, FAR *LPTVITEM;
-
-TVITEM structure that identifies and contains information about the tree view item. The mask member of the TVITEM structure specifies which information is being set or retrieved. It can be one or more of the following values: TVIF_CHILDREN  The cChildren member specifies, or is to receive, a value that indicates whether the item has child items.  
-TVIF_IMAGE  The iImage member specifies, or is to receive, the index of the item's nonselected icon in the image list.  
-TVIF_SELECTEDIMAGE  The iSelectedImage member specifies, or is to receive, the index of the item's selected icon in the image list.  
-TVIF_TEXT  The pszText member specifies the new item text or the address of a buffer that is to receive the item text. 
-If the structure is receiving item text, you typically copy the text to the buffer pointed to by the pszText member of the TVITEM structure. However, you can return a string in the pszText member instead. If you do so, you cannot change or delete the string until the corresponding item text is deleted or until two additional TVN_GETDISPINFO notification messages have been sent. 
- */
 
 // OnEndLabelEdit - processes the LVN_ENDLABELEDIT notification message. 
 // Returns TRUE if the label is changed, or FALSE otherwise. 
@@ -381,48 +372,6 @@ static BOOL OnEndLabelEdit(NMTVDISPINFO* ptvdi)
     // many characters in the field. 
 } 
 
-
-static BOOL OnExpand(int flag, HTREEITEM* pti)
-{ 
-    TRACE(_T("TreeWndProc(...) OnExpand()\n"));
-//    pnmtv = (NMTREEVIEW) lParam 
-    //TRACE("OnExpand(...) entry name: %s\n", entry->data.cFileName);
-    /*
-TVE_COLLAPSE Collapses the list.  
-TVE_COLLAPSERESET Collapses the list and removes the child items. The TVIS_EXPANDEDONCE state flag is reset. This flag must be used with the TVE_COLLAPSE flag. 
-TVE_EXPAND Expands the list. 
-TVE_EXPANDPARTIAL Version 4.70. Partially expands the list. In this state, the child items are visible and the parent item's plus symbol is displayed. This flag must be used in combination with the TVE_EXPAND flag. 
-TVE_TOGGLE Collapses the list if it is expanded or expands it if it is collapsed. 
-     */
-    return TRUE;
-} 
-
-static BOOL OnExpanding(HWND hWnd, NMTREEVIEW* pnmtv)
-{ 
-    static int expanding;
-
-    Entry* entry = (Entry*)pnmtv->itemNew.lParam;
-
-    TRACE(_T("TreeWndProc(...) OnExpanding() entry: %p\n"), entry);
-
-    if (expanding) return FALSE;
-    expanding = TRUE;
-    if (entry) {
-        insert_tree_entries(hWnd, entry->down, 0);
-//             insert_tree_entries(hWnd, entry, 0);
-    }
-    expanding = FALSE;
-    return TRUE;
-} 
-/*
-static BOOL OnSelChanged(NMTREEVIEW* pnmtv)
-{ 
-    LPARAM parm = pnmtv->itemNew.lParam;
-    ChildWnd* child = (ChildWnd*)pnmtv->itemNew.lParam;
-    return TRUE;
-} 
- */
-
 void UpdateStatus(HWND hWnd, Entry* pEntry)
 {
     int file_count = 0;
@@ -478,15 +427,14 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
 #endif
     case WM_NOTIFY:
         switch (((LPNMHDR)lParam)->code) { 
-        case TVM_EXPAND: 
-            //return OnExpand((int)wParam, (HTREEITEM*)lParam);
-            OnExpand((int)wParam, (HTREEITEM*)lParam);
-            break;
+//        case TVM_EXPAND: 
+//            OnTreeExpand((int)wParam, (HTREEITEM*)lParam);
+//            break;
         case TVN_GETDISPINFO: 
             OnGetDispInfo((NMTVDISPINFO*)lParam); 
             break; 
         case TVN_ITEMEXPANDING: 
-            return OnExpanding(hWnd, (NMTREEVIEW*)lParam);
+            return OnTreeExpanding(hWnd, (NMTREEVIEW*)lParam);
             break;
         case TVN_SELCHANGED:
 
@@ -528,20 +476,18 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
 }
 
 // CreateTreeView - creates a tree view control. 
-// Returns the handle to the new control if successful,
-// or NULL otherwise. 
+// Returns the handle to the new control if successful, or NULL otherwise. 
 // hwndParent - handle to the control's parent window. 
 
 static HWND CreateTreeView(HWND hwndParent, int id) 
 { 
-    RECT rcClient;  // dimensions of client area 
-    HWND hwndTV;    // handle to tree view control 
+    RECT rcClient;
+    HWND hwndTV;
  
-    // Get the dimensions of the parent window's client area, and create 
-    // the tree view control. 
+    // Get the dimensions of the parent window's client area, and create the tree view control. 
     GetClientRect(hwndParent, &rcClient); 
     hwndTV = CreateWindowEx(0, WC_TREEVIEW, _T("Tree View"), 
-        WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
+        WS_VISIBLE | WS_CHILD | WS_BORDER | WS_EX_CLIENTEDGE | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT,
         0, 0, rcClient.right, rcClient.bottom, 
         hwndParent, (HMENU)id, hInst, NULL); 
     // Initialize the image list, and add items to the control. 
index 93151cd..1b04fce 100644 (file)
@@ -1,3 +1,6 @@
+#include <defines.h>
+#include <reactos/resource.h>
+
 //Microsoft Developer Studio generated resource script.
 //
 #include "resource.h"
@@ -529,8 +532,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,1
- PRODUCTVERSION 1,0,0,1
+       FILEVERSION     RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+       PRODUCTVERSION  RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -543,10 +546,10 @@ VS_VERSION_INFO VERSIONINFO
 BEGIN
     BLOCK "StringFileInfo"
     BEGIN
-        BLOCK "0c0904b0"
+        BLOCK "040904b0"
         BEGIN
             VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0"
-            VALUE "CompanyName", "ReactWare\0"
+            VALUE "CompanyName", RES_STR_COMPANY_NAME
             VALUE "FileDescription", "ReactOS File Manager by Robert Dickenson\0"
             VALUE "FileVersion", "1, 0, 0, 1\0"
             VALUE "InternalName", "winfile\0"
@@ -554,8 +557,8 @@ BEGIN
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "winfile.exe\0"
             VALUE "PrivateBuild", "\0"
-            VALUE "ProductName", "ReactOS File Manager\0"
-            VALUE "ProductVersion", "1, 0, 0, 1\0"
+            VALUE "ProductName",       RES_STR_PRODUCT_NAME
+            VALUE "ProductVersion",    RES_STR_PRODUCT_VERSION
             VALUE "SpecialBuild", "Non-versioned Development Beta Release\0"
         END
     END
@@ -572,7 +575,7 @@ END
 //
 // Accelerator
 //
-
+#ifdef _MSC_VER
 IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE 
 BEGIN
     "+",            ID_DISK_SELECT_DRIVE,   ASCII,  NOINVERT
@@ -591,7 +594,7 @@ BEGIN
     VK_RETURN,      ID_FILE_PROPERTIES,     VIRTKEY, ALT, NOINVERT
     VK_SUBTRACT,    ID_TREE_EXPAND_ALL,     VIRTKEY, NOINVERT
 END
-
+#endif // _MSC_VER
 
 /////////////////////////////////////////////////////////////////////////////
 //
diff --git a/rosapps/winfile/worker.c b/rosapps/winfile/worker.c
new file mode 100644 (file)
index 0000000..848ae94
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ *  ReactOS winfile
+ *
+ *  worker.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 <process.h>
+#include <assert.h>
+#define ASSERT assert
+
+#include "main.h"
+#include "worker.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Global Variables:
+//
+
+static HANDLE hMonitorThreadEvent = NULL;      // When this event becomes signaled then we run the monitor thread
+
+void MonitorThreadProc(void *lpParameter);
+
+////////////////////////////////////////////////////////////////////////////////
+// Local module support methods
+//
+
+
+LRESULT CALLBACK MoveDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HWND    hLicenseEditWnd;
+    TCHAR   strLicense[0x1000];
+
+    switch (message) {
+    case WM_INITDIALOG:
+        hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT);
+        LoadString(hInst, IDS_LICENSE, strLicense, 0x1000);
+        SetWindowText(hLicenseEditWnd, strLicense);
+        return TRUE;
+    case WM_COMMAND:
+        if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) {
+            EndDialog(hDlg, LOWORD(wParam));
+            return TRUE;
+        }
+        break;
+    }
+    return 0;
+}
+
+void StartWorkerThread(HWND hWnd)
+{
+    DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)MoveDialogWndProc);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+void MonitorThreadProc(void *lpParameter)
+{
+//     ULONG   OldProcessorUsage = 0;
+//     ULONG   OldProcessCount = 0;
+    HWND hWnd = (HWND)lpParameter;
+
+       // Create the event
+       hMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Monitor Event");
+
+       // If we couldn't create the event then exit the thread
+       if (!hMonitorThreadEvent)
+               return;
+
+       while (1) {
+               DWORD   dwWaitVal;
+
+               // Wait on the event
+               dwWaitVal = WaitForSingleObject(hMonitorThreadEvent, INFINITE);
+
+               // If the wait failed then the event object must have been
+               // closed and the task manager is exiting so exit this thread
+        if (dwWaitVal == WAIT_FAILED) {
+            // CloseHandle(hMonitorThreadEvent); // Should we close the event object handle or not ???
+            // hMonitorThreadEvent = NULL; // if we do then check what happens when main thread tries to delete it also....
+                       return;
+        }
+
+               if (dwWaitVal == WAIT_OBJECT_0) {
+                       // Reset our event
+                       ResetEvent(hMonitorThreadEvent);
+#if 0
+                       TCHAR   text[260];
+                       if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
+                               SendMessage(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
+                       if (IsWindowVisible(hProcessPage))
+                               InvalidateRect(hProcessPageListCtrl, NULL, FALSE);
+                       if (OldProcessorUsage != PerfDataGetProcessorUsage()) {
+                               OldProcessorUsage = PerfDataGetProcessorUsage();
+                               wsprintf(text, _T("CPU Usage: %3d%%"), OldProcessorUsage);
+                               SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text);
+                       }
+                       if (OldProcessCount != PerfDataGetProcessCount()) {
+                               OldProcessCount = PerfDataGetProcessCount();
+                               wsprintf(text, _T("Processes: %d"), OldProcessCount);
+                               SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text);
+                       }
+#endif
+               }
+       }
+}
+
+BOOL CreateMonitorThread(HWND hWnd)
+{
+    _beginthread(MonitorThreadProc, 0, hWnd);
+    return TRUE;
+}
+
+void SignalMonitorEvent(void)
+{
+    SetEvent(hMonitorThreadEvent);
+}
+
+BOOL DestryMonitorThread(void)
+{
+       CloseHandle(hMonitorThreadEvent);
+    hMonitorThreadEvent = NULL;
+    return TRUE;
+}
+
diff --git a/rosapps/winfile/worker.h b/rosapps/winfile/worker.h
new file mode 100644 (file)
index 0000000..4d6c08d
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *  ReactOS winfile
+ *
+ *  worker.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 __WORKER_H__
+#define __WORKER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void StartWorkerThread(HWND hWnd);
+//void StopWorkerThread(HWND hWnd);
+
+BOOL CreateMonitorThread(HWND hWnd);
+void SignalMonitorEvent(void);
+BOOL DestryMonitorThread(void);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // __WORKER_H__