Added combobox to drivebar, yet to get working. Whole application needs alot of cleanup.
authorRobert Dickenson <robd@reactos.org>
Sun, 4 Aug 2002 18:40:49 +0000 (18:40 +0000)
committerRobert Dickenson <robd@reactos.org>
Sun, 4 Aug 2002 18:40:49 +0000 (18:40 +0000)
Fixed up makefile plus dependancies and now builds (and runs) with ros-tools.

svn path=/trunk/; revision=3315

16 files changed:
rosapps/winfile/Makefile
rosapps/winfile/drivebar.c [new file with mode: 0644]
rosapps/winfile/drivebar.h [new file with mode: 0644]
rosapps/winfile/entries.c
rosapps/winfile/framewnd.c
rosapps/winfile/main.c
rosapps/winfile/network.c
rosapps/winfile/network.h
rosapps/winfile/run.c
rosapps/winfile/run.h
rosapps/winfile/settings.c
rosapps/winfile/shell.c
rosapps/winfile/shell.h
rosapps/winfile/trace.c
rosapps/winfile/treeview.c
rosapps/winfile/worker.c

index f7e0c23..6a729a2 100644 (file)
@@ -24,10 +24,9 @@ PATH_TO_TOP = ..
 
 TARGET = winfile
 
-BASE_CFLAGS = -DGCC -D_WIN32_IE=0x0400
-
-RCFLAGS = -DGCC -D_WIN32_IE=0x0400
+BASE_CFLAGS = -D_WIN32_IE=0x0400
 
+RCFLAGS = -D_WIN32_IE=0x0400
 
 OBJS = about.o \
         childwnd.o \
@@ -61,23 +60,25 @@ $(TARGET).exe:      $(OBJS) $(TARGET).coff
        $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
 
 
-about.o:       about.c about.h resource.h
+main.h:                resource.h makefile 
+
+about.o:       about.c about.h main.h
 
-main.o:                main.c main.h childwnd.h framewnd.h resource.h
+main.o:                main.c main.h childwnd.h framewnd.h main.h
 
-childwnd.o:    childwnd.c childwnd.h resource.h
+childwnd.o:    childwnd.c childwnd.h main.h
 
-framewnd.o:    framewnd.c framewnd.h resource.h
+framewnd.o:    framewnd.c framewnd.h main.h
 
-debug.o:       debug.c debug.h
+debug.o:       debug.c debug.h main.h
 
-font.o:                font.c font.h
+font.o:                font.c font.h main.h
 
-run.o:         run.c run.h
+run.o:         run.c run.h main.h
 
-setttings.o:   setttings.c setttings.h resource.h
+setttings.o:   setttings.c setttings.h  main.h
 
-$(TARGET).o:   $(TARGET).c $(TARGET).h resource.h
+$(TARGET).o:   $(TARGET).c $(TARGET).h main.h makefile
 
 
 clean:
diff --git a/rosapps/winfile/drivebar.c b/rosapps/winfile/drivebar.c
new file mode 100644 (file)
index 0000000..feeb090
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ *  ReactOS winfile
+ *
+ *  drivebar.c
+ *
+ *  Copyright (C) 2002  Robert Dickenson <robd@reactos.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifdef _MSC_VER
+#include "stdafx.h"
+#else
+#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
+#include <windows.h>
+#include <commctrl.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <memory.h>
+#include <tchar.h>
+#include <process.h>
+#include <stdio.h>
+#endif
+    
+#include "main.h"
+#include "settings.h"
+#include "framewnd.h"
+#include "childwnd.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Global Variables:
+//
+
+void ConfigureDriveBar(HWND hDriveBar)
+{
+    static DWORD dwLogicalDrivesSaved;
+    DWORD dwLogicalDrives = GetLogicalDrives();
+
+    if (!hDriveBar) return;
+
+    if (dwLogicalDrives != dwLogicalDrivesSaved) {
+           TBBUTTON drivebarBtn = {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP};
+       int btn = 1;
+           PTSTR p;
+        int count = SendMessage(hDriveBar, TB_BUTTONCOUNT, 0, 0);
+        while (count) {
+                       SendMessage(hDriveBar, TB_DELETEBUTTON, (WPARAM)--count, 0);
+        }
+        count = SendMessage(Globals.hDriveCombo, CB_GETCOUNT, 0, 0);
+        while (count) {
+//                     SendMessage(Globals.hDriveCombo, CB_DELETESTRING, (WPARAM)--count, 0);
+        }
+        SendMessage(Globals.hDriveCombo, CB_RESETCONTENT, 0, 0); 
+        memset(Globals.drives, 0, BUFFER_LEN);
+           GetLogicalDriveStrings(BUFFER_LEN, Globals.drives);
+       drivebarBtn.fsStyle = TBSTYLE_BUTTON;
+        drivebarBtn.idCommand = ID_DRIVE_FIRST;
+               for (p = Globals.drives; *p;) {
+                        // insert drive letter
+                       TCHAR b[3] = { tolower(*p) };
+                       SendMessage(hDriveBar, TB_ADDSTRING, 0, (LPARAM)b);
+                       switch(GetDriveType(p)) {
+                       case DRIVE_REMOVABLE:   drivebarBtn.iBitmap = 1;        break;
+                       case DRIVE_CDROM:               drivebarBtn.iBitmap = 3;        break;
+                       case DRIVE_REMOTE:              drivebarBtn.iBitmap = 4;        break;
+                       case DRIVE_RAMDISK:             drivebarBtn.iBitmap = 5;        break;
+                       default:/*DRIVE_FIXED*/ drivebarBtn.iBitmap = 2;
+                       }
+                       SendMessage(hDriveBar, TB_INSERTBUTTON, btn, (LPARAM)&drivebarBtn);
+                       drivebarBtn.idCommand++;
+                       drivebarBtn.iString++;
+                       while(*p++);
+//
+//                     SendMessage(Globals.hDriveCombo, CB_INSERTSTRING, btn, (LPARAM)b);
+//                     SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)b);
+//            SendMessage(Globals.hDriveCombo, WM_SETTEXT, 0, (LPARAM)lpszWord); 
+//            SendMessage(Globals.hDriveCombo, CB_ADDSTRING, 0, (LPARAM)&b); 
+//
+            ++btn;
+               }
+        dwLogicalDrivesSaved = dwLogicalDrives;
+
+//        SendMessage(Globals.hDriveCombo, CB_SHOWDROPDOWN, (WPARAM)TRUE, (LPARAM)0);
+    }
+#ifndef __GNUC__
+
+            {
+            COMBOBOXEXITEM cbei;
+            int iCnt;
+
+            typedef struct {
+                int iImage;
+                int iSelectedImage;
+                int iIndent;
+                LPTSTR pszText;
+            } ITEMINFO, *PITEMINFO;
+
+#define MAX_ITEMS 15
+
+    ITEMINFO IInf[] = {
+        { 0, 3,  0, _T("first")}, 
+        { 1, 4,  1, _T("second")},
+        { 2, 5,  2, _T("third")},
+        { 0, 3,  0, _T("fourth")},
+        { 1, 4,  1, _T("fifth")},
+        { 2, 5,  2, _T("sixth")},
+        { 0, 3,  0, _T("seventh")},
+        { 1, 4,  1, _T("eighth")},
+        { 2, 5,  2, _T("ninth")},
+        { 0, 3,  0, _T("tenth")},
+        { 1, 4,  1, _T("eleventh")},
+        { 2, 5,  2, _T("twelfth")},
+        { 0, 3,  0, _T("thirteenth")},
+        { 1, 4,  1, _T("fourteenth")},
+        { 2, 5,  2, _T("fifteenth")}
+    };
+
+            for (iCnt = 0; iCnt < MAX_ITEMS; iCnt++) {
+
+            cbei.mask = CBEIF_TEXT | CBEIF_INDENT | CBEIF_IMAGE| CBEIF_SELECTEDIMAGE;
+            cbei.iItem          = iCnt;
+            cbei.pszText        = IInf[iCnt].pszText;
+            cbei.cchTextMax     = sizeof(IInf[iCnt].pszText);
+            cbei.iImage         = IInf[iCnt].iImage;
+            cbei.iSelectedImage = IInf[iCnt].iSelectedImage;
+            cbei.iIndent        = IInf[iCnt].iIndent;
+            }
+
+
+            SendMessage(Globals.hDriveCombo, CBEM_INSERTITEM, 0, (LPARAM)&cbei); 
+            }
+#endif    
+}
+
+void _GetFreeSpaceEx(void)
+{
+   BOOL fResult;
+   TCHAR szDrive[MAX_PATH];
+   ULARGE_INTEGER i64FreeBytesToCaller;
+   ULARGE_INTEGER i64TotalBytes;
+   ULARGE_INTEGER i64FreeBytes;
+
+   fResult = GetDiskFreeSpaceEx(szDrive,
+                (PULARGE_INTEGER)&i64FreeBytesToCaller,
+                (PULARGE_INTEGER)&i64TotalBytes,
+                (PULARGE_INTEGER)&i64FreeBytes);
+}
+
diff --git a/rosapps/winfile/drivebar.h b/rosapps/winfile/drivebar.h
new file mode 100644 (file)
index 0000000..3f70a24
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  ReactOS Application Drivebar support routines
+ *
+ *  drivebar.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 __DRIVEBAR_H__
+#define __DRIVEBAR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void ConfigureDriveBar(HWND hDriveBar);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // __DRIVEBAR_H__
index 4e105a3..35fd20d 100644 (file)
@@ -254,7 +254,7 @@ void scan_entry(ChildWnd* child, Entry* entry)
 // expand a directory entry
 BOOL expand_entry(ChildWnd* child, Entry* dir)
 {
-       int idx;
+       int idx = 0;
        Entry* p;
 
        if (!dir || dir->expanded || !dir->down)
index 943ee02..f91ea13 100644 (file)
@@ -598,7 +598,7 @@ static LPTBBUTTON      lpSaveButtons;
         
     if (lpnmhdr->code == TBN_GETBUTTONINFO) {
         LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
-        char szBuffer[20];
+        TCHAR szBuffer[20];
 
 //        int tbButtonNew[20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };
                TBBUTTON tbButtonNew[] = {
@@ -632,7 +632,7 @@ static LPTBBUTTON      lpSaveButtons;
     case TBN_GETBUTTONINFO:
         {
         LPTBNOTIFY lpTbNotify = (LPTBNOTIFY)lparam;
-        char szBuffer[20];
+        TCHAR szBuffer[20];
 /*
 typedef struct _TBBUTTON {
     int iBitmap; 
index 64ef332..873c700 100644 (file)
@@ -170,16 +170,25 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
         {
 #define DRIVEBOX_WIDTH  200
 #define DRIVEBOX_HEIGHT 8
-
+/*
+typedef struct _TBBUTTON {
+    int iBitmap; 
+    int idCommand; 
+    BYTE fsState; 
+    BYTE fsStyle; 
+    DWORD dwData; 
+    INT_PTR iString; 
+} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON; 
+ */
                TBBUTTON toolbarBtns[] = {
                        {DRIVEBOX_WIDTH+10, 0, 0, TBSTYLE_SEP},
                        {0, 0, 0, TBSTYLE_SEP},
 
 //                     {1, ID_FILE_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_OPEN }, 
-                       {2, ID_FILE_MOVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_MOVE}, 
-                       {3, ID_FILE_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY}, 
-                       {4, ID_FILE_COPY_CLIPBOARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY_CLIPBOARD}, 
-                       {5, ID_FILE_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_DELETE}, 
+//                     {2, ID_FILE_MOVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_MOVE}, 
+//                     {3, ID_FILE_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY}, 
+//                     {4, ID_FILE_COPY_CLIPBOARD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, ID_FILE_COPY_CLIPBOARD}, 
+                       {5, ID_FILE_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON}, 
                        {6, ID_FILE_RENAME, TBSTATE_ENABLED, TBSTYLE_BUTTON}, 
                        {7, ID_FILE_PROPERTIES, TBSTATE_ENABLED, TBSTYLE_BUTTON}, 
                        {8, ID_FILE_COMPRESS, TBSTATE_ENABLED, TBSTYLE_BUTTON}, 
@@ -258,7 +267,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
             // Create the edit control. Notice that the parent of
             // the toolbar, is used as the parent of the edit control.    
             //hWndEdit = CreateWindowEx(0L, WC_COMBOBOXEX, NULL, WS_CHILD | WS_BORDER | WS_VISIBLE 
-            Globals.hDriveCombo = CreateWindowEx(0L, "ComboBox", NULL, WS_CHILD | WS_BORDER | WS_VISIBLE 
+            Globals.hDriveCombo = CreateWindowEx(0L, _T("ComboBox"), NULL, WS_CHILD | WS_BORDER | WS_VISIBLE 
                 | CBS_DROPDOWNLIST | ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE, 
                 10, 0, DRIVEBOX_WIDTH, DRIVEBOX_HEIGHT, Globals.hMainWnd, (HMENU)IDW_DRIVEBOX, hInstance, 0);
             // Set the toolbar window as the parent of the edit control
index 7cdfbce..48a9d76 100644 (file)
@@ -308,7 +308,7 @@ void NetworkMonitorThreadProc(void *lpParameter)
     HWND hWnd = (HWND)lpParameter;
 
        // Create the event
-       hNetworkMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Network Monitor Event");
+       hNetworkMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, _T("Winfile Network Monitor Event"));
 
        // If we couldn't create the event then exit the thread
        if (!hNetworkMonitorThreadEvent)
index c796b3a..f90e02b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  ReactOS Application Debug Routines
+ *  ReactOS Application Network support routines
  *
  *  network.h
  *
index 847ff53..0d80fcc 100644 (file)
 #include "run.h"
 
 
+typedef        void (WINAPI *RUNFILEDLG)(
+                                               HWND    hwndOwner, 
+                                               HICON   hIcon, 
+                                               LPCSTR  lpstrDirectory, 
+                                               LPCSTR  lpstrTitle, 
+                                               LPCSTR  lpstrDescription,
+                                               UINT    uFlags); 
+
+//
+// Flags for RunFileDlg
+//
+
+#define        RFF_NOBROWSE            0x01    // Removes the browse button. 
+#define        RFF_NODEFAULT           0x02    // No default item selected. 
+#define        RFF_CALCDIRECTORY       0x04    // Calculates the working directory from the file name.
+#define        RFF_NOLABEL                     0x08    // Removes the edit box label. 
+#define        RFF_NOSEPARATEMEM       0x20    // Removes the Separate Memory Space check box (Windows NT only).
+
+
 // Show "Run..." dialog
 void OnFileRun(void)
 {
index 9e95fa5..83a045e 100644 (file)
@@ -39,23 +39,6 @@ extern "C" {
 void OnFileRun(void);
 BOOL OpenTarget(HWND hWnd, TCHAR* target);
 
-typedef        void (WINAPI *RUNFILEDLG)(
-                                               HWND    hwndOwner, 
-                                               HICON   hIcon, 
-                                               LPCSTR  lpstrDirectory, 
-                                               LPCSTR  lpstrTitle, 
-                                               LPCSTR  lpstrDescription,
-                                               UINT    uFlags); 
-
-//
-// Flags for RunFileDlg
-//
-
-#define        RFF_NOBROWSE            0x01    // Removes the browse button. 
-#define        RFF_NODEFAULT           0x02    // No default item selected. 
-#define        RFF_CALCDIRECTORY       0x04    // Calculates the working directory from the file name.
-#define        RFF_NOLABEL                     0x08    // Removes the edit box label. 
-#define        RFF_NOSEPARATEMEM       0x20    // Removes the Separate Memory Space check box (Windows NT only).
 
 #ifdef __cplusplus
 };
index a011bde..74f0872 100644 (file)
@@ -47,7 +47,7 @@ TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];
 void LoadSettings(void)
 {
     HKEY    hKey;
-    char    szSubKey[] = "Software\\ReactWare\\FileManager";
+    TCHAR   szSubKey[] = _T("Software\\ReactWare\\FileManager");
 /*
     int     i;
     DWORD   dwSize;
@@ -154,9 +154,9 @@ void LoadSettings(void)
 void SaveSettings(void)
 {
     HKEY hKey;
-    char szSubKey1[] = "Software";
-    char szSubKey2[] = "Software\\ReactWare";
-    char szSubKey3[] = "Software\\ReactWare\\FileManager";
+    TCHAR szSubKey1[] = _T("Software");
+    TCHAR szSubKey2[] = _T("Software\\ReactWare");
+    TCHAR szSubKey3[] = _T("Software\\ReactWare\\FileManager");
 
     // Open (or create) the key
     hKey = NULL;
index 94f00b5..2b8cb35 100644 (file)
@@ -72,7 +72,7 @@ void FormatDisk(HWND hWnd)
         if (pSHFormatDrive)    {
                    UINT OldMode = SetErrorMode(0); // Get the current Error Mode settings.
                    SetErrorMode(OldMode & ~SEM_FAILCRITICALERRORS); // Force O/S to handle
-            pSHFormatDrive(hWnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
+            pSHFormatDrive(0/*hWnd*/, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
                    SetErrorMode(OldMode); // Put it back the way it was.                       
         }
         FreeLibrary(hShell32);
index 92e7e39..9769deb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  ReactOS Application Debug Routines
+ *  ReactOS Application Shell support routines
  *
  *  shell.h
  *
index 894408d..4d47136 100644 (file)
@@ -7,8 +7,6 @@
 #include "windows.h"
 #include "trace.h"
 
-DeclAssertFile;  // Should be added at the begining of each .C/.CPP
-
 
 #ifdef _DEBUG
 
index 29296a1..a6040e5 100644 (file)
@@ -37,8 +37,8 @@
 #include <windowsx.h>
 #include <shellapi.h>
 #include <ctype.h>
-#include <assert.h>
-#define ASSERT assert
+//#include <assert.h>
+//#define ASSERT assert
 
 #include "main.h"
 #include "treeview.h"
index c98fc12..c95cee5 100644 (file)
@@ -92,7 +92,7 @@ void MonitorThreadProc(void *lpParameter)
     HWND hWnd = (HWND)lpParameter;
 
        // Create the event
-       hMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Monitor Event");
+       hMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, _T("Winfile Monitor Event"));
 
        // If we couldn't create the event then exit the thread
        if (!hMonitorThreadEvent)