- added choosing fonts

- added file moving
This commit is contained in:
Piotr Caban 2004-09-27 20:35:53 +00:00 committed by Alexandre Julliard
parent d9c9bfd779
commit c25c8cafe1
7 changed files with 172 additions and 17 deletions

View File

@ -29,7 +29,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
@ -102,7 +102,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
@ -160,7 +160,28 @@ 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_DLG_INFO "Changed font settings apply only to newly started windows."
IDS_FONT_SEL_ERROR "Error while selecting new font."
IDS_FILE_MOVE_ERROR "Error while moving file or directory."
}

View File

@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winefile.exe
APPMODE = -mwindows
IMPORTS = shell32 comctl32 ole32 user32 gdi32 kernel32
IMPORTS = shell32 comdlg32 comctl32 ole32 user32 gdi32 kernel32
EXTRALIBS = -luuid
C_SRCS = \

View File

@ -30,7 +30,7 @@ IDM_WINEFILE MENU FIXED IMPURE
{
POPUP "&Plik" {
MENUITEM "&Otwórz\tEnter" , 101
MENUITEM "&Przenieś...\tF7" , 106
MENUITEM "&Przenieœ...\tF7" , ID_FILE_MOVE
MENUITEM "&Kopiuj...\tF8" , 107
MENUITEM "W s&chowku...\tF9" , 118
MENUITEM "&Usuñ\tDel" , 108
@ -103,7 +103,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Opcje" {
MENUITEM "&Potwierdzenie..." , -1
MENUITEM "&Czcionka..." , -1
MENUITEM "&Czcionka..." , ID_SELECT_FONT
MENUITEM "&Ustawienia paska narzêdzi..." , -1
MENUITEM SEPARATOR
MENUITEM "Pasek &narzêdzi" , ID_VIEW_TOOL_BAR, CHECKED
@ -165,3 +165,24 @@ FONT 8, "MS Shell Dlg"
PUSHBUTTON "Anuluj" , 2, 158, 23, 47, 14
PUSHBUTTON "&Pomoc" , 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 "Wybór celu"
FONT 8, "MS Shell Dlg"
{
CONTROL "", 101, "Static", SS_SIMPLE|SS_NOPREFIX, 3, 6, 162, 10
CONTROL "&Œcie¿ka:" , -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 "Anuluj" , 2, 158, 23, 47, 14
PUSHBUTTON "&Przegl¹daj" , 254, 158, 43, 47, 14
}
STRINGTABLE
{
IDS_FONT_SEL_DLG_NAME "Wprowadzanie ustawieñ czcionki"
IDS_FONT_SEL_DLG_INFO "Nowe ustawienia czcionki zadzia³aj¹ jedynie dla nowo otwartych okien."
IDS_FONT_SEL_ERROR "B³¹d przy wybieraniu czcionki"
IDS_FILE_MOVE_ERROR "B³¹d przy przenoszeniu pliku."
}

View File

@ -32,16 +32,19 @@
/* dialogs */
#define IDD_EXECUTE 103
#define IDD_SELECT_DESTINATION 104
/* control ids */
#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_SELECT_FONT 510
#define ID_VIEW_TOOL_BAR 508
#define ID_VIEW_DRIVE_BAR 507
#define ID_VIEW_STATUSBAR 503
@ -67,6 +70,12 @@
#define ID_VIEW_FULLSCREEN 0x8004
#define ID_PREFERED_SIZES 0x8005
/* string table */
#define IDS_FONT_SEL_DLG_NAME 1101
#define IDS_FONT_SEL_DLG_INFO 1102
#define IDS_FONT_SEL_ERROR 1103
#define IDS_FILE_MOVE_ERROR 1104
/* 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

@ -190,8 +190,6 @@ static void display_error(HWND hwnd, DWORD error)
LocalFree(msg);
}
/* allocate and initialise a directory entry */
static Entry* alloc_entry()
{
Entry* entry = (Entry*) malloc(sizeof(Entry));
@ -1490,7 +1488,7 @@ static HWND create_child_window(ChildWnd* child)
mcs.y = child->pos.rcNormalPosition.top;
mcs.cx = child->pos.rcNormalPosition.right-child->pos.rcNormalPosition.left;
mcs.cy = child->pos.rcNormalPosition.bottom-child->pos.rcNormalPosition.top;
mcs.style = 0;
mcs.style = 1;
mcs.lParam = 0;
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, 0, GetCurrentThreadId());
@ -1504,6 +1502,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);
@ -1543,6 +1543,29 @@ static BOOL CALLBACK ExecuteDialogWndProg(HWND hwnd, UINT nmsg, WPARAM wparam, L
return 0;
}
static BOOL CALLBACK sDestinationWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case WM_INITDIALOG:
return 1;
case WM_COMMAND:{
int id = (int)wparam;
if (id == IDOK) {
char *dest;
dest = malloc(MAX_PATH);
GetWindowText(GetDlgItem(hwnd, 201), dest, MAX_PATH);
EndDialog(hwnd, (int)dest);
}
else if (id == IDCANCEL) EndDialog(hwnd, id);
else if (id == 254) MessageBox(hwnd, TEXT("Not yet implemented"), TEXT("Winefile"), MB_OK);
return 1;
}
}
return 0;
}
#ifndef _NO_EXTENSIONS
@ -1792,6 +1815,42 @@ 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: {
CHOOSEFONT chFont;
LOGFONT lFont;
HDC hdc = GetDC(hwnd);
char dlg_name[255], dlg_info[255];
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)) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, MAX_LOAD_STRING);
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_INFO, dlg_info, MAX_LOAD_STRING);
MessageBox(hwnd,dlg_info,dlg_name,MB_OK|MB_ICONINFORMATION);
Globals.hfont = CreateFontIndirect(&lFont);
SelectFont(hdc, Globals.hfont);
GetTextExtentPoint32(hdc, TEXT(" "), 1, &Globals.spaceSize);
}
else if(CommDlgExtendedError()) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, MAX_LOAD_STRING);
LoadString(Globals.hInstance, IDS_FONT_SEL_ERROR, dlg_info, MAX_LOAD_STRING);
MessageBox(hwnd,dlg_info,dlg_name,MB_OK);
}
ReleaseDC(hwnd,hdc);
break;
}
case ID_VIEW_TOOL_BAR:
toggle_child(hwnd, cmd, Globals.htoolbar);
@ -2473,7 +2532,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
if (pane->treePane) {
if (entry) {
img_pos = dis->rcItem.left + entry->level*(IMAGE_WIDTH+Globals.spaceSize.cx);
img_pos = dis->rcItem.left + entry->level*(IMAGE_WIDTH+TREE_LINE_DX);
if (calcWidthCol == -1) {
int x;
@ -2506,7 +2565,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
x = img_pos - IMAGE_WIDTH/2;
do {
x -= IMAGE_WIDTH+Globals.spaceSize.cx;
x -= IMAGE_WIDTH+TREE_LINE_DX;
if (up->next
#ifndef _LEFT_FILES
@ -2532,8 +2591,8 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
LineTo(dis->hDC, x, dis->rcItem.bottom);
if (entry->down && entry->expanded) {
x += IMAGE_WIDTH+Globals.spaceSize.cx;
MoveToEx(dis->hDC, x, dis->rcItem.top+IMAGE_HEIGHT, 0);
x += IMAGE_WIDTH+TREE_LINE_DX;
MoveToEx(dis->hDC, x, dis->rcItem.top+IMAGE_HEIGHT+2, 0);
LineTo(dis->hDC, x, dis->rcItem.bottom);
}
@ -2541,7 +2600,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
if (hrgn_org) DeleteObject(hrgn_org);
/* SelectObject(dis->hDC, holdPen); */
} else if (calcWidthCol==col || calcWidthCol==COLUMNS) {
int right = img_pos + IMAGE_WIDTH - Globals.spaceSize.cx;
int right = img_pos + IMAGE_WIDTH - TREE_LINE_DX;
if (right > pane->widths[col])
pane->widths[col] = right;
@ -2565,7 +2624,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
DrawText(dis->hDC, entry->data.cFileName, -1, &rt, DT_CALCRECT|DT_SINGLELINE|DT_NOPREFIX);
focusRect.right = dis->rcItem.left+pane->positions[col+1]+Globals.spaceSize.cx + rt.right +2;
focusRect.right = dis->rcItem.left+pane->positions[col+1]+TREE_LINE_DX + rt.right +2;
}
#else
@ -2584,6 +2643,10 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
hbrush = CreateSolidBrush(bkcolor);
FillRect(dis->hDC, &focusRect, hbrush);
if (entry->down && entry->expanded) {
MoveToEx(dis->hDC, img_pos + IMAGE_WIDTH/2 + TREE_LINE_DX, dis->rcItem.top+IMAGE_HEIGHT+2, 0);
LineTo(dis->hDC, img_pos + IMAGE_WIDTH/2 + TREE_LINE_DX, dis->rcItem.bottom);
}
DeleteObject(hbrush);
SetBkMode(dis->hDC, TRANSPARENT);
@ -2592,6 +2655,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi
cx = pane->widths[col];
if (cx && img!=IMG_NONE) {
if (cx > IMAGE_WIDTH)
cx = IMAGE_WIDTH;
@ -3278,6 +3342,8 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lparam;
Entry* entry = (Entry*) dis->itemData;
/*dis->rcItem.top*=2;
dis->rcItem.bottom*=2;*/
if (dis->CtlID == IDW_TREE_LEFT)
draw_item(&child->left, dis, entry, -1);
else
@ -3452,6 +3518,39 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
activate_entry(child, pane, hwnd);
break;
case ID_FILE_MOVE: {
char *new_name,*old_name;
int len;
if((int)(new_name=(char *)DialogBox(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), hwnd, sDestinationWndProc))==1|| (int)new_name==IDCANCEL) break;
old_name = malloc(MAX_PATH);
if(new_name[1]!=':' && new_name[0]!='/') {
get_path(pane->cur->up, old_name);
len = strlen(old_name);
if(old_name[len-1]!='\\') {
old_name[len]='\\';
len++;
old_name[len]='\n';
}
strcpy(&old_name[len], new_name);
strcpy(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 {
LoadString(Globals.hInstance, IDS_FILE_MOVE_ERROR, old_name, MAX_PATH);
MessageBox(hwnd, old_name, "WineFile", MB_OK);
}
free(old_name);
free(new_name);
break;}
default:
return pane_command(pane, LOWORD(wparam));
}

View File

@ -36,6 +36,7 @@
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <commdlg.h>
#include <shellapi.h>
#include <stdlib.h>
#include <stdio.h>
@ -74,10 +75,13 @@ enum IMAGE {
IMG_FOLDER, IMG_OPEN_FOLDER, IMG_FOLDER_PLUS,IMG_OPEN_PLUS, IMG_OPEN_MINUS,
IMG_FOLDER_UP, IMG_FOLDER_CUR
};
#ifndef MAX_LOAD_STRING
#define MAX_LOAD_STRING 256
#endif
#define IMAGE_WIDTH 16
#define IMAGE_HEIGHT 13
#define IMAGE_HEIGHT 13
#define SPLIT_WIDTH 5
#define TREE_LINE_DX 3
#define IDW_STATUSBAR 0x100
#define IDW_TOOLBAR 0x101