merged corrected version of the Wine commit http://cvs.winehq.org/patch.py?id=13936:

- added choosing fonts
- added file moving

svn path=/trunk/; revision=11179
This commit is contained in:
Martin Fuchs 2004-10-04 09:31:10 +00:00
parent 184c8d80f1
commit 83de11e97e
6 changed files with 166 additions and 18 deletions

View file

@ -25,6 +25,7 @@ TARGET_SDKLIBS = \
user32.a \
gdi32.a \
comctl32.a \
comdlg32.a \
ole32.a \
oleaut32.a \
shell32.a

View file

@ -31,7 +31,7 @@ IDM_WINEFILE MENU FIXED IMPURE
{
POPUP "&File" {
MENUITEM "&Open\tEnter" , 101
MENUITEM "&Move...\tF7" , 106
MENUITEM "&Move...\tF7" , ID_FILE_MOVE
MENUITEM "&Copy...\tF8" , 107
MENUITEM "&In Clipboard...\tF9" , 118
MENUITEM "&Delete\tDel" , 108
@ -104,7 +104,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Options" {
MENUITEM "&Confirmation..." , -1
MENUITEM "&Font..." , -1
MENUITEM "&Font..." , ID_SELECT_FONT
MENUITEM "Customize Tool&bar..." , -1
MENUITEM SEPARATOR
MENUITEM "&Toolbar" , ID_VIEW_TOOL_BAR, CHECKED
@ -161,7 +161,26 @@ FONT 8, "MS Shell Dlg"
CONTROL "&Command:" , -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10
EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL
CONTROL "As &Symbol" , 214, "Button", BS_AUTOCHECKBOX|WS_TABSTOP,3, 45, 71, 12
DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14
DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14
PUSHBUTTON "Cancel" , 2, 158, 23, 47, 14
PUSHBUTTON "&Help" , 254, 158, 43, 47, 14
}
IDD_SELECT_DESTINATION DIALOG FIXED IMPURE 15, 13, 210, 63
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Select destination"
FONT 8, "MS Shell Dlg"
{
CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10
CONTROL "&Path:" , -1, "Static", SS_LEFTNOWORDWRAP|WS_GROUP, 3, 18, 60, 10
EDITTEXT 201, 3, 29, 134, 12, ES_AUTOHSCROLL
DEFPUSHBUTTON "OK" , 1, 158, 6, 47, 14
PUSHBUTTON "Cancel" , 2, 158, 23, 47, 14
PUSHBUTTON "&Browse" , 254, 158, 43, 47, 14
}
STRINGTABLE
{
IDS_FONT_SEL_DLG_NAME "Applying font settings"
IDS_FONT_SEL_ERROR "Error while selecting new font."
}

View file

@ -17,9 +17,9 @@
*/
/* images */
#define IDB_TOOLBAR 100
#define IDB_TOOLBAR 100
#define IDB_DRIVEBAR 101
#define IDB_IMAGES 102
#define IDB_IMAGES 102
#define IDI_WINEFILE 100
@ -31,32 +31,35 @@
/* dialogs */
#define IDD_EXECUTE 103
#define IDD_EXECUTE 103
#define IDD_SELECT_DESTINATION 104
/* control ids */
#define ID_ACTIVATE 101
#define ID_EXECUTE 105
#define ID_ACTIVATE 101
#define ID_EXECUTE 105
#define ID_FILE_MOVE 106
#define ID_FILE_EXIT 115
#define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403
#define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403
#define ID_SELECT_FONT 510
#define ID_VIEW_TOOL_BAR 508
#define ID_VIEW_DRIVE_BAR 507
#define ID_VIEW_STATUSBAR 503
#define ID_ABOUT 1803
#define ID_REFRESH 1704
#define ID_ABOUT 1803
#define ID_REFRESH 1704
#define ID_EDIT_PROPERTIES 57656
#define ID_WINDOW_NEW 0xE130
#define ID_WINDOW_ARRANGE 0xE131
#define ID_WINDOW_CASCADE 0xE132
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_TILE_HORZ 0xE133
#define ID_WINDOW_TILE_VERT 0xE134
#define ID_WINDOW_SPLIT 0xE135
#define ID_HELP_USING 0xE144
#define ID_HELP 0xE146
#define ID_HELP 0xE146
/* winefile extensions */
@ -68,6 +71,10 @@
#define ID_PREFERED_SIZES 0x8005
/* string table */
#define IDS_FONT_SEL_DLG_NAME 1101
#define IDS_FONT_SEL_ERROR 1103
/* range for drive bar command ids: 0x9000..0x90FF */
#ifdef __WINE__
#define ID_DRIVE_UNIX_FS 0x9000

View file

@ -20,6 +20,7 @@ IDA_WINEFILE ACCELERATORS DISCARDABLE
{
// VK_F1, ID_HELP, VIRTKEY, NOINVERT
// VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
// VK_F7, ID_FILE_MOVE, VIRTKEY, NOINVERT
// VK_RETURN, ID_ACTIVATE, VIRTKEY, NOINVERT
#ifndef _NO_EXTENSIONS
"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT

View file

@ -179,6 +179,7 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
/* display error message for the specified WIN32 error code */
static void display_error(HWND hwnd, DWORD error)
{
PTSTR msg;
@ -1486,6 +1487,8 @@ static HWND create_child_window(ChildWnd* child)
UnhookWindowsHookEx(hcbthook);
ListBox_SetItemHeight(child->left.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
ListBox_SetItemHeight(child->right.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
idx = ListBox_FindItemData(child->left.hwnd, ListBox_GetCurSel(child->left.hwnd), child->left.cur);
ListBox_SetCurSel(child->left.hwnd, idx);
@ -1499,7 +1502,7 @@ struct ExecuteDialog {
};
static BOOL CALLBACK ExecuteDialogWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
static BOOL CALLBACK ExecuteDialogDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
{
static struct ExecuteDialog* dlg;
@ -1525,6 +1528,39 @@ static BOOL CALLBACK ExecuteDialogWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, L
return 0;
}
static BOOL CALLBACK sDestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case WM_INITDIALOG:
SetWindowLong(hwnd, GWL_USERDATA, lparam);
return 1;
case WM_COMMAND: {
int id = (int)wparam;
switch(id) {
case IDOK: {
LPTSTR dest = (LPTSTR) GetWindowLong(hwnd, GWL_USERDATA);
GetWindowText(GetDlgItem(hwnd, 201), dest, MAX_PATH);
EndDialog(hwnd, id);
break;}
case IDCANCEL:
EndDialog(hwnd, id);
break;
case 254:
MessageBox(hwnd, TEXT("Not yet implemented"), TEXT("Winefile"), MB_OK);
break;
}
return 1;
}
}
return 0;
}
#ifndef _NO_EXTENSIONS
@ -1774,6 +1810,53 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
case ID_WINDOW_ARRANGE:
SendMessage(Globals.hmdiclient, WM_MDIICONARRANGE, 0, 0);
break;
case ID_SELECT_FONT: {
TCHAR dlg_name[BUFFER_LEN], dlg_info[BUFFER_LEN];
CHOOSEFONT chFont;
LOGFONT lFont;
HDC hdc = GetDC(hwnd);
chFont.lStructSize = sizeof(CHOOSEFONT);
chFont.hwndOwner = hwnd;
chFont.hDC = NULL;
chFont.lpLogFont = &lFont;
chFont.Flags = CF_SCREENFONTS | CF_FORCEFONTEXIST | CF_LIMITSIZE | CF_NOSCRIPTSEL;
chFont.rgbColors = RGB(0,0,0);
chFont.lCustData = 0;
chFont.lpfnHook = NULL;
chFont.lpTemplateName = NULL;
chFont.hInstance = Globals.hInstance;
chFont.lpszStyle = NULL;
chFont.nFontType = SIMULATED_FONTTYPE;
chFont.nSizeMin = 0;
chFont.nSizeMax = 24;
if (ChooseFont(&chFont)) {
HWND childWnd;
Globals.hfont = CreateFontIndirect(&lFont);
SelectFont(hdc, Globals.hfont);
GetTextExtentPoint32(hdc, TEXT(" "), 1, &Globals.spaceSize);
/* change font in all open child windows */
for(childWnd=GetWindow(Globals.hmdiclient,GW_CHILD); childWnd; childWnd=GetNextWindow(childWnd,GW_HWNDNEXT)) {
ChildWnd* child = (ChildWnd*) GetWindowLong(childWnd, GWL_USERDATA);
SetWindowFont(child->left.hwnd, Globals.hfont, TRUE);
SetWindowFont(child->right.hwnd, Globals.hfont, TRUE);
InvalidateRect(child->left.hwnd, NULL, TRUE);
InvalidateRect(child->right.hwnd, NULL, TRUE);
}
}
else if (CommDlgExtendedError()) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN);
LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, BUFFER_LEN);
MessageBox(hwnd, dlg_info, dlg_name, MB_OK);
}
ReleaseDC(hwnd, hdc);
break;
}
case ID_VIEW_TOOL_BAR:
toggle_child(hwnd, cmd, Globals.htoolbar);
@ -1792,7 +1875,7 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
memset(&dlg, 0, sizeof(struct ExecuteDialog));
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_EXECUTE), hwnd, ExecuteDialogWndProc, (LPARAM)&dlg) == IDOK) {
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_EXECUTE), hwnd, ExecuteDialogDlgProc, (LPARAM)&dlg) == IDOK) {
HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, dlg.cmd/*file*/, NULL/*parameters*/, NULL/*dir*/, dlg.cmdshow);
if ((int)hinst <= 32)
@ -3434,6 +3517,42 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
activate_entry(child, pane, hwnd);
break;
case ID_FILE_MOVE: {
TCHAR new_name[BUFFER_LEN], old_name[BUFFER_LEN];
int len;
int ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), hwnd, sDestinationDlgProc, (LPARAM)new_name);
if (ret != IDOK)
break;
if (new_name[0]!='/' && new_name[1]!=':') {
get_path(pane->cur->up, old_name);
len = lstrlen(old_name);
if (old_name[len-1]!='\\' && old_name[len-1]!='/') {
old_name[len++] = '/';
old_name[len] = '\n';
}
lstrcpy(&old_name[len], new_name);
lstrcpy(new_name, old_name);
}
get_path(pane->cur, old_name);
if (MoveFileEx(old_name, new_name, MOVEFILE_COPY_ALLOWED)) {
if (pane->treePane) {
pane->root->scanned = FALSE;
pane->cur = pane->root;
activate_entry(child, pane, hwnd);
}
else
scan_entry(child, pane->root, hwnd);
}
else
display_error(hwnd, GetLastError());
break;}
default:
return pane_command(pane, LOWORD(wparam));
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2000, 2003 Martin Fuchs
* Copyright 2000, 2003, 2004 Martin Fuchs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -36,6 +36,7 @@
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>