Added combobox to drivebar, yet to get working. Whole application needs alot of cleanup.

Fixed up makefile plus dependancies and now builds (and runs) with ros-tools.

svn path=/trunk/; revision=3315
This commit is contained in:
Robert Dickenson 2002-08-04 18:40:49 +00:00
parent c724d71f77
commit aa405ed6f1
16 changed files with 261 additions and 51 deletions

View 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
main.o: main.c main.h childwnd.h framewnd.h resource.h
about.o: about.c about.h main.h
childwnd.o: childwnd.c childwnd.h resource.h
main.o: main.c main.h childwnd.h framewnd.h main.h
framewnd.o: framewnd.c framewnd.h resource.h
childwnd.o: childwnd.c childwnd.h main.h
debug.o: debug.c debug.h
framewnd.o: framewnd.c framewnd.h main.h
font.o: font.c font.h
debug.o: debug.c debug.h main.h
run.o: run.c run.h
font.o: font.c font.h main.h
setttings.o: setttings.c setttings.h resource.h
run.o: run.c run.h main.h
$(TARGET).o: $(TARGET).c $(TARGET).h resource.h
setttings.o: setttings.c setttings.h main.h
$(TARGET).o: $(TARGET).c $(TARGET).h main.h makefile
clean:

162
rosapps/winfile/drivebar.c Normal file
View file

@ -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);
}

View file

@ -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__

View 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)

View 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;

View 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

View 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)

View file

@ -1,5 +1,5 @@
/*
* ReactOS Application Debug Routines
* ReactOS Application Network support routines
*
* network.h
*

View file

@ -40,6 +40,25 @@
#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)
{

View 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
};

View 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;

View 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);

View file

@ -1,5 +1,5 @@
/*
* ReactOS Application Debug Routines
* ReactOS Application Shell support routines
*
* shell.h
*

View file

@ -7,8 +7,6 @@
#include "windows.h"
#include "trace.h"
DeclAssertFile; // Should be added at the begining of each .C/.CPP
#ifdef _DEBUG

View 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"

View 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)