diff --git a/rosapps/winfile/mdiclient.c b/rosapps/winfile/mdiclient.c deleted file mode 100644 index ca0110b4dbc..00000000000 --- a/rosapps/winfile/mdiclient.c +++ /dev/null @@ -1,599 +0,0 @@ -/* - * ReactOS winfile - * - * mdiclient.c - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#endif - -#include -//#include -#include -#include -#include -#include -#define ASSERT assert - -#include "winfile.h" -#include "about.h" -#include "mdiclient.h" -#include "subframe.h" -#include "run.h" -#include "utils.h" -#include "treeview.h" -#include "listview.h" -#include "debug.h" -#include "draw.h" - - -#ifdef _NO_EXTENSIONS -#define COLOR_SPLITBAR WHITE_BRUSH -#else -#define COLOR_SPLITBAR LTGRAY_BRUSH -#endif - - -ChildWnd* alloc_child_window(LPCTSTR path) -{ - TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT]; - ChildWnd* child = (ChildWnd*) malloc(sizeof(ChildWnd)); - Root* root = &child->root; - Entry* entry; - - memset(child, 0, sizeof(ChildWnd)); - - child->left.treePane = TRUE; - child->left.visible_cols = 0; - - child->right.treePane = FALSE; -#ifndef _NO_EXTENSIONS - child->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES|COL_INDEX|COL_LINKS; -#else - child->right.visible_cols = COL_SIZE|COL_DATE|COL_TIME|COL_ATTRIBUTES; -#endif - - child->pos.length = sizeof(WINDOWPLACEMENT); - child->pos.flags = 0; - child->pos.showCmd = SW_SHOWNORMAL; - child->pos.rcNormalPosition.left = CW_USEDEFAULT; - child->pos.rcNormalPosition.top = CW_USEDEFAULT; - child->pos.rcNormalPosition.right = CW_USEDEFAULT; - child->pos.rcNormalPosition.bottom = CW_USEDEFAULT; - - child->focus_pane = 0; - child->split_pos = 200; - child->sortOrder = SORT_NAME; - child->header_wdths_ok = FALSE; - - lstrcpy(child->path, 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, child->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, child->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; - - child->left.root = &root->entry; - - set_curdir(child, entry); - - return child; -} - - -static HHOOK hcbthook; -static ChildWnd* newchild = NULL; - -LRESULT CALLBACK CBTProc(int code, WPARAM wparam, LPARAM lparam) -{ - if (code==HCBT_CREATEWND && newchild) { - ChildWnd* child = newchild; - newchild = NULL; - child->hwnd = (HWND) wparam; - SetWindowLong(child->hwnd, GWL_USERDATA, (LPARAM)child); - } - return CallNextHookEx(hcbthook, code, wparam, lparam); -} - -HWND create_child_window(ChildWnd* child) -{ - MDICREATESTRUCT mcs = { -// WINEFILETREE, (LPTSTR)child->path, Globals.hInstance, - szFrameClass, (LPTSTR)child->path, Globals.hInstance, - child->pos.rcNormalPosition.left, child->pos.rcNormalPosition.top, - child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left, - child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top, - 0/*style*/, 0/*lParam*/ - }; - int idx; - - hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId()); - - newchild = child; - child->hwnd = (HWND) SendMessage(Globals.hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); - if (!child->hwnd) - return 0; - - UnhookWindowsHookEx(hcbthook); - - idx = ListBox_FindItemData(child->left.hwnd, ListBox_GetCurSel(child->left.hwnd), child->left.cur); - ListBox_SetCurSel(child->left.hwnd, idx); - - return child->hwnd; -} - -// free all memory associated with a child window -static void free_child_window(ChildWnd* child) -{ - free_entries(&child->root.entry); - free(child); -} - -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); -} - -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* child = (ChildWnd*) GetWindowLong(child_wnd, GWL_USERDATA); - if (child) { - _tsplitpath(child->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 InitChildWindow(ChildWnd* child) -{ - create_tree_window(child->hwnd, &child->left, IDW_TREE_LEFT, IDW_HEADER_LEFT, child->path); - create_list_window(child->hwnd, &child->right, IDW_TREE_RIGHT, IDW_HEADER_RIGHT); -} - - -#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]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(; iwidths[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; -} - - -LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) -{ - static int last_split; - - ChildWnd* child = (ChildWnd*) GetWindowLong(hwnd, GWL_USERDATA); - ASSERT(child); - - switch(nmsg) { - case WM_DRAWITEM: { - LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lparam; - Entry* entry = (Entry*) dis->itemData; - - if (dis->CtlID == IDW_TREE_LEFT) - draw_item(&child->left, dis, entry, -1); - else - draw_item(&child->right, dis, entry, -1); - - return TRUE;} - - case WM_CREATE: - InitChildWindow(child); - break; - - case WM_NCDESTROY: - free_child_window(child); - SetWindowLong(hwnd, GWL_USERDATA, 0); - break; - - case WM_PAINT: { - PAINTSTRUCT ps; - HBRUSH lastBrush; - RECT rt; - GetClientRect(hwnd, &rt); - BeginPaint(hwnd, &ps); - rt.left = child->split_pos-SPLIT_WIDTH/2; - rt.right = child->split_pos+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); - break;} - - case WM_SETCURSOR: - if (LOWORD(lparam) == HTCLIENT) { - POINT pt; - GetCursorPos(&pt); - ScreenToClient(hwnd, &pt); - - if (pt.x>=child->split_pos-SPLIT_WIDTH/2 && pt.xsplit_pos+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>=child->split_pos-SPLIT_WIDTH/2 && xsplit_pos+SPLIT_WIDTH/2+1) { - last_split = child->split_pos; -#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); - child->split_pos = x; - resize_tree(child, 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 - child->split_pos = last_split; -#endif - GetClientRect(hwnd, &rt); - resize_tree(child, 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 && xsplit_pos = x; - resize_tree(child, rt.right, rt.bottom); - rt.left = x-SPLIT_WIDTH/2; - rt.right = x+SPLIT_WIDTH/2+1; - InvalidateRect(hwnd, &rt, FALSE); - UpdateWindow(child->left.hwnd); - UpdateWindow(hwnd); - UpdateWindow(child->right.hwnd); - } -#endif - } - break; - -#ifndef _NO_EXTENSIONS - case WM_GETMINMAXINFO: - DefMDIChildProc(hwnd, nmsg, 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(child->path); - SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd); - break; - - case WM_DISPATCH_COMMAND: { - Pane* pane = GetFocus()==child->left.hwnd? &child->left: &child->right; - - switch(LOWORD(wparam)) { - case ID_WINDOW_NEW_WINDOW: { - ChildWnd* new_child = alloc_child_window(child->path); - - if (!create_child_window(new_child)) - free(new_child); - - break;} -#if 0 - case ID_REFRESH: - scan_entry(child, pane->cur); - break; - case ID_ACTIVATE: - activate_entry(child, 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;} - - case WM_COMMAND: { - Pane* pane = GetFocus()==child->left.hwnd? &child->left: &child->right; - - switch(HIWORD(wparam)) { - case LBN_SELCHANGE: { - int idx = ListBox_GetCurSel(pane->hwnd); - Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx); - - if (pane == &child->left) - set_curdir(child, entry); - else - pane->cur = entry; - break;} - - case LBN_DBLCLK: - activate_entry(child, pane); - break; - } - break;} - -#ifndef _NO_EXTENSIONS - case WM_NOTIFY: { - NMHDR* pnmh = (NMHDR*) lparam; - return pane_notify(pnmh->idFrom==IDW_HEADER_LEFT? &child->left: &child->right, pnmh);} -#endif - case WM_SIZE: - if (wparam != SIZE_MINIMIZED) - resize_tree(child, LOWORD(lparam), HIWORD(lparam)); - // fall through - default: def: - return DefMDIChildProc(hwnd, nmsg, wparam, lparam); - } - return 0; -} - -/* -RegenerateUserEnvironment - */ \ No newline at end of file diff --git a/rosapps/winfile/mdiclient.h b/rosapps/winfile/mdiclient.h deleted file mode 100644 index f9575e95861..00000000000 --- a/rosapps/winfile/mdiclient.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ReactOS winfile - * - * mdiclient.h - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 __MDICLIENT_H__ -#define __MDICLIENT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" - - - -LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM); - -HWND create_child_window(ChildWnd* child); - -void toggle_child(HWND hwnd, UINT cmd, HWND hchild); -ChildWnd* alloc_child_window(LPCTSTR path); -void set_header(Pane* pane); - -void toggle_child(HWND hwnd, UINT cmd, HWND hchild); -BOOL activate_drive_window(LPCTSTR path); - - - -#ifdef __cplusplus -}; -#endif - -#endif // __MDICLIENT_H__ diff --git a/rosapps/winfile/subframe.c b/rosapps/winfile/subframe.c deleted file mode 100644 index 246f207bd9e..00000000000 --- a/rosapps/winfile/subframe.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * ReactOS winfile - * - * subframe.c - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#endif - -//#include -//#include -#include -#define ASSERT assert - -#include "winfile.h" -#include "mdiclient.h" -#include "subframe.h" -#include "utils.h" -//#include "treeview.h" -//#include "listview.h" -//#include "debug.h" - - -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)) { - 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); -} - - -LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam) -{ - if (1) { - switch (nmsg) { - case WM_CLOSE: - DestroyWindow(hwnd); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - case WM_COMMAND: - { - UINT cmd = LOWORD(wparam); - HWND hwndClient = (HWND) SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0); - - if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wparam, lparam)) - break; - - if (cmd>=ID_DRIVE_FIRST && cmd<=ID_DRIVE_FIRST+0xFF) { - TCHAR drv[_MAX_DRIVE], path[MAX_PATH]; - ChildWnd* child; - 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 - child = alloc_child_window(path); - if (!create_child_window(child)) - free(child); - } else { - switch (cmd) { - case ID_FILE_EXIT: - PostQuitMessage(0); - break; - case ID_WINDOW_NEW_WINDOW: - { - TCHAR path[MAX_PATH]; - ChildWnd* child; - GetCurrentDirectory(MAX_PATH, path); - child = alloc_child_window(path); - if (!create_child_window(child)) - free(child); - } - 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_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; -#if 0 - case ID_EXECUTE: - { - 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_HELP: - WinHelp(hwnd, _T("winfile"), HELP_INDEX, 0); - break; -#endif -#ifndef _NO_EXTENSIONS - case ID_VIEW_FULLSCREEN: - CheckMenuItem(Globals.hMenuOptions, cmd, toggle_fullscreen(hwnd)?MF_CHECKED:0); - break; -#ifdef __linux__ - case ID_DRIVE_UNIX_FS: - { - TCHAR path[MAX_PATH]; - ChildWnd* child; - if (activate_drive_window(_T("/"))) - break; - getcwd(path, MAX_PATH); - child = alloc_child_window(path); - if (!create_child_window(child)) - free(child); - } - break; -#endif -#endif - //TODO: There are even more menu items! - default: - /*@@if (wParam >= PM_FIRST_LANGUAGE && wParam <= PM_LAST_LANGUAGE) - STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE); - else */ - if ((cmd=IDW_FIRST_CHILD+0x100) && - (cmdSC_RESTORE)) { - MessageBox(hwnd, _T("Not yet implemented"), _T("Winefile"), MB_OK); - } - return DefFrameProc(hwnd, Globals.hMDIClient, nmsg, wparam, lparam); - } - } - } - break; - case WM_SIZE: - resize_frame(hwnd, LOWORD(lparam), HIWORD(lparam)); - break; // do not pass message to DefFrameProc -#ifndef _NO_EXTENSIONS - case WM_GETMINMAXINFO: - { - 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; - case FRM_CALC_CLIENT: - frame_get_clientspace(hwnd, (PRECT)lparam); - return TRUE; -#endif - default: - return DefFrameProc(hwnd, Globals.hMDIClient, nmsg, wparam, lparam); - } - } - return 0; -} - - diff --git a/rosapps/winfile/subframe.h b/rosapps/winfile/subframe.h deleted file mode 100644 index 4b49059e043..00000000000 --- a/rosapps/winfile/subframe.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ReactOS winfile - * - * subframe.h - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 __SUBFRAME_H__ -#define __SUBFRAME_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" - - -LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam); - -void resize_frame_client(HWND hwnd); - - - -#ifdef __cplusplus -}; -#endif - -#endif // __SUBFRAME_H__ diff --git a/rosapps/winfile/winfile.c b/rosapps/winfile/winfile.c deleted file mode 100644 index 3f9b5199416..00000000000 --- a/rosapps/winfile/winfile.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * ReactOS winfile - * - * winfile.c - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#endif - -#include -//#include - -#include "winfile.h" -#include "about.h" -#include "run.h" -#include "treeview.h" -#include "listview.h" -#include "mdiclient.h" -#include "subframe.h" -#include "format.h" - - - -//////////////////////////////////////////////////////////////////////////////// -// Global Variables: -// - -SORT_ORDER SortOrder = SORT_NAME; - -HWND hTreeWnd; // Tree Control Window -HWND hListWnd; // List Control Window -HWND hSplitWnd; // Splitter Bar Control Window - -int nOldWidth; // Holds the previous client area width -int nOldHeight; // Holds the previous client area height - -BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop - - -//////////////////////////////////////////////////////////////////////////////// - -// OnSize() -// This function handles all the sizing events for the application -// It re-sizes every window, and child window that needs re-sizing -void OnSize(UINT nType, int cx, int cy) -{ - if (nType == SIZE_MINIMIZED) - return; -#if 1 - resize_frame_client(Globals.hMainWnd); -#else - int nParts[3]; - int nXDifference; - int nYDifference; - RECT rc; - - nXDifference = cx - nOldWidth; - nYDifference = cy - nOldHeight; - nOldWidth = cx; - nOldHeight = cy; - - // Update the status bar size - GetWindowRect(Globals.hStatusBar, &rc); - SendMessage(Globals.hStatusBar, WM_SIZE, nType, MAKELPARAM(cx, cy + (rc.bottom - rc.top))); - - // Update the status bar pane sizes - nParts[0] = bInMenuLoop ? -1 : 100; - nParts[1] = 210; - nParts[2] = cx; - SendMessage(Globals.hStatusBar, SB_SETPARTS, bInMenuLoop ? 1 : 3, (long)nParts); - - GetWindowRect(Globals.hStatusBar, &rc); - -// MoveWindow(hTreeWnd,0,0,cx/2,cy-(rc.bottom - rc.top),TRUE); -// MoveWindow(hListWnd,cx/2,0,cx,cy-(rc.bottom - rc.top),TRUE); - -// MoveWindow(Globals.hMDIClient,0,0,cx/2,cy-(rc.bottom - rc.top),TRUE); - ShowWindow(Globals.hMDIClient, SW_SHOW); - -// ShowWindow(hTreeWnd, SW_HIDE); -// ShowWindow(hListWnd, SW_HIDE); -#endif -} - -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]; -// TCHAR text[260]; - - 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("")); -// wsprintf(text, _T("CPU Usage: %3d%%"), PerfDataGetProcessorUsage()); -// SendMessage(Globals.hStatusBar, SB_SETTEXT, 1, (LPARAM)text); -// wsprintf(text, _T("Processes: %d"), PerfDataGetProcessCount()); -// SendMessage(Globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)text); -} - -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); -} - -// -// FUNCTION: WndProc(HWND, unsigned, WORD, LONG) -// -// PURPOSE: Processes messages for the main window. -// -// WM_COMMAND - process the application menu -// WM_PAINT - Paint the main window -// WM_DESTROY - post a quit message and return -// -// - -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND hwndClient; - int wmId, wmEvent; - PAINTSTRUCT ps; - HDC hdc; - RECT rc; - //TCHAR szHello[MAX_LOADSTRING]; - //LoadString(Globals.hInstance, IDS_HELLO, szHello, MAX_LOADSTRING); - - switch (message) { - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - - hwndClient = (HWND)SendMessage(Globals.hMDIClient, WM_MDIGETACTIVE, 0, 0); - if (hwndClient) - if (SendMessage(hwndClient, WM_DISPATCH_COMMAND, wParam, lParam)) - break; - - // Parse the menu selections: - switch (wmId) { - - case ID_FILE_RUN: - OnFileRun(); - break; - - /* - FormatDisk - */ - - case ID_VIEW_SORT_BY_NAME: - SortOrder = SORT_NAME; - break; - case ID_VIEW_SORT_BY_TYPE: - SortOrder = SORT_EXT; - break; - case ID_VIEW_SORT_BY_SIZE: - SortOrder = SORT_SIZE; - break; - case ID_VIEW_SORT_BY_DATE: - SortOrder = SORT_DATE; - break; - - case ID_OPTIONS_TOOLBAR: - toggle_child(hWnd, wmId, Globals.hToolBar); - break; - case ID_OPTIONS_DRIVEBAR: - toggle_child(hWnd, wmId, Globals.hDriveBar); - break; - case ID_OPTIONS_STATUSBAR: - toggle_child(hWnd, wmId, Globals.hStatusBar); - break; -#if 0 - case ID_REGISTRY_OPENLOCAL: - { - HWND hChildWnd; -// hChildWnd = CreateWindow(szChildClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD, -// CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWnd, NULL, Globals.hInstance, NULL); - hChildWnd = CreateWindow(szChildClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CHILD, - 0, 0, 150, 170, hWnd, NULL, Globals.hInstance, NULL); - if (hChildWnd) { - ShowWindow(hChildWnd, 1); - UpdateWindow(hChildWnd); - } - } - break; -#endif - 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_HELP_ABOUT: -#if 1 - ShowAboutBox(hWnd); -#else - { - HICON hIcon = LoadIcon(Globals.hInstance, (LPCTSTR)IDI_WINFILE); - ShellAbout(hWnd, szTitle, "", hIcon); - //if (hIcon) DestroyIcon(hIcon); // NOT REQUIRED - } -#endif - break; - case ID_FILE_EXIT: - DestroyWindow(hWnd); - break; - default: -#if 0 - if (SendMessage(Globals.hMDIClient, message, wParam, lParam) != 0) { - //return DefWindowProc(hWnd, message, wParam, lParam); - return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam); - } -#else - //return DefWindowProc(hWnd, message, wParam, lParam); - return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam); -#endif - break; - } - break; - case WM_SIZE: - // Handle the window sizing in it's own function - OnSize(wParam, LOWORD(lParam), HIWORD(lParam)); - break; - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - // TODO: Add any drawing code here... - GetClientRect(hWnd, &rc); - //DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); - EndPaint(hWnd, &ps); - break; - case WM_DESTROY: - PostQuitMessage(0); - break; - case WM_TIMER: - 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; - default: - //return DefWindowProc(hWnd, message, wParam, lParam); - return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam); - } - return 0; -} diff --git a/rosapps/winfile/winfile.h b/rosapps/winfile/winfile.h deleted file mode 100644 index a725d3911cc..00000000000 --- a/rosapps/winfile/winfile.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * ReactOS winfile - * - * winfile.h - * - * Copyright (C) 2002 Robert Dickenson - * - * 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 - */ - -#ifndef __WINFILE_H__ -#define __WINFILE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" -#include "entries.h" - - - -LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); - -//////////////////////////////////////////////////////////////////////////////// - -#define STATUS_WINDOW 2001 -#define TREE_WINDOW 2002 -#define LIST_WINDOW 2003 -#define SPLIT_WINDOW 2004 - -#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 5 - -#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 - - -//////////////////////////////////////////////////////////////////////////////// -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 -}; - - -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; - -extern HINSTANCE hInst; -//extern HWND hMainWnd; -extern TCHAR szTitle[]; -extern TCHAR szChildClass[]; -extern TCHAR szFrameClass[]; -//extern TCHAR szChildClass[]; - -#define STRINGID(id) (Globals.wStringTableOffset + 0x##id) - - -#ifdef __cplusplus -}; -#endif - -#endif // __WINFILE_H__