Implement switching of file sort order.

This commit is contained in:
Martin Fuchs 2005-05-16 08:48:54 +00:00 committed by Alexandre Julliard
parent c6b0ad6963
commit a55f54fb44
13 changed files with 181 additions and 103 deletions

View File

@ -93,10 +93,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "A&lle Dateiangaben" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "A&lle Dateiangaben" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Bestimmte Dateiangaben..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Bestimmte Dateiangaben..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Nach N&ame" , 404 MENUITEM "Nach N&ame" , ID_VIEW_SORT_NAME
MENUITEM "Nach T&yp" , 405 MENUITEM "Nach T&yp" , ID_VIEW_SORT_TYPE
MENUITEM "Nach &Größe" , 406 MENUITEM "Nach &Größe" , ID_VIEW_SORT_SIZE
MENUITEM "Nach &Datum" , 407 MENUITEM "Nach &Datum" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Angaben ausw&ählen..." , 409 MENUITEM "Angaben ausw&ählen..." , 409
} }

View File

@ -92,12 +92,12 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&All File Details" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&All File Details" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Partial Details..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Partial Details..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Sort by Name" , 404 MENUITEM "&Sort by Name" , ID_VIEW_SORT_NAME
MENUITEM "Sort &by Type" , 405 MENUITEM "Sort &by Type" , ID_VIEW_SORT_TYPE
MENUITEM "Sort by Si&ze" , 406 MENUITEM "Sort by Si&ze" , ID_VIEW_SORT_SIZE
MENUITEM "Sort by &Date" , 407 MENUITEM "Sort by &Date" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Sort by &..." , 409 MENUITEM "Filter by &..." , 409
} }
POPUP "&Options" { POPUP "&Options" {

View File

@ -90,10 +90,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "T&odos los detalles" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "T&odos los detalles" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "Detalles &parciales..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "Detalles &parciales..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Ordenar por &nombre" , 404 MENUITEM "Ordenar por &nombre" , ID_VIEW_SORT_NAME
MENUITEM "Ordenar por &tipo" , 405 MENUITEM "Ordenar por &tipo" , ID_VIEW_SORT_TYPE
MENUITEM "Ordenar por t&amaño" , 406 MENUITEM "Ordenar por t&amaño" , ID_VIEW_SORT_SIZE
MENUITEM "Ordenar por &fecha" , 407 MENUITEM "Ordenar por &fecha" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Ordenar por &..." , 409 MENUITEM "Ordenar por &..." , 409
} }

View File

@ -93,10 +93,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "Tous &les Détails" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "Tous &les Détails" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Détails..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Détails..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Trier par N&om" , 404 MENUITEM "Trier par N&om" , ID_VIEW_SORT_NAME
MENUITEM "Trier par &Type" , 405 MENUITEM "Trier par &Type" , ID_VIEW_SORT_TYPE
MENUITEM "Trier par Ta&ille" , 406 MENUITEM "Trier par Ta&ille" , ID_VIEW_SORT_SIZE
MENUITEM "Trier par Dat&e" , 407 MENUITEM "Trier par Dat&e" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Trier par &..." , 409 MENUITEM "Trier par &..." , 409
} }

View File

@ -93,10 +93,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Minden részlet" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&Minden részlet" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Egyedi..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Egyedi..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Rendezés név szerint" , 404 MENUITEM "&Rendezés név szerint" , ID_VIEW_SORT_NAME
MENUITEM "Rendezés k&iterjesztés szerint" , 405 MENUITEM "Rendezés k&iterjesztés szerint" , ID_VIEW_SORT_TYPE
MENUITEM "Rendezés &méret szerint" , 406 MENUITEM "Rendezés &méret szerint" , ID_VIEW_SORT_SIZE
MENUITEM "Rendezés &dátum szerint" , 407 MENUITEM "Rendezés &dátum szerint" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Egyedi rendezés &..." , 409 MENUITEM "Egyedi rendezés &..." , 409
} }

View File

@ -93,10 +93,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Mostra tutti i dettagli sui file" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&Mostra tutti i dettagli sui file" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Mostra dettagli parziali..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Mostra dettagli parziali..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Ordina per Nome" , 404 MENUITEM "&Ordina per Nome" , ID_VIEW_SORT_NAME
MENUITEM "&Ordina per Tipo" , 405 MENUITEM "&Ordina per Tipo" , ID_VIEW_SORT_TYPE
MENUITEM "&Ordina per Dimensione" , 406 MENUITEM "&Ordina per Dimensione" , ID_VIEW_SORT_SIZE
MENUITEM "&Ordina per Data" , 407 MENUITEM "&Ordina per Data" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Ordina per &..." , 409 MENUITEM "Ordina per &..." , 409
} }

View File

@ -89,10 +89,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Alle details" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&Alle details" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Gedeeltelijke details..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Gedeeltelijke details..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Sorteer op &naam" , 404 MENUITEM "Sorteer op &naam" , ID_VIEW_SORT_NAME
MENUITEM "Sorteer op &type" , 405 MENUITEM "Sorteer op &type" , ID_VIEW_SORT_TYPE
MENUITEM "Sorteer op &grootte" , 406 MENUITEM "Sorteer op &grootte" , ID_VIEW_SORT_SIZE
MENUITEM "Sorteer op &datum" , 407 MENUITEM "Sorteer op &datum" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Sorteer op &..." , 409 MENUITEM "Sorteer op &..." , 409
} }

View File

@ -92,10 +92,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Todos os delalhes" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&Todos os delalhes" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "D&etalhes parciais..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "D&etalhes parciais..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Classificar por nome" , 404 MENUITEM "&Classificar por nome" , ID_VIEW_SORT_NAME
MENUITEM "C&lassificar por tipo" , 405 MENUITEM "C&lassificar por tipo" , ID_VIEW_SORT_TYPE
MENUITEM "Cl&assificar por tamanho" , 406 MENUITEM "Cl&assificar por tamanho" , ID_VIEW_SORT_SIZE
MENUITEM "Cla&ssificar por &data" , 407 MENUITEM "Cla&ssificar por &data" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Classificar &por..." , 409 MENUITEM "Classificar &por..." , 409
} }
@ -219,10 +219,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&Todos os delalhes" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&Todos os delalhes" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "D&etalhes parciais..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "D&etalhes parciais..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Classificar por nome" , 404 MENUITEM "&Classificar por nome" , ID_VIEW_SORT_NAME
MENUITEM "C&lassificar por tipo" , 405 MENUITEM "C&lassificar por tipo" , ID_VIEW_SORT_TYPE
MENUITEM "Cl&assificar por tamanho" , 406 MENUITEM "Cl&assificar por tamanho" , ID_VIEW_SORT_SIZE
MENUITEM "Cla&ssificar por &data" , 407 MENUITEM "Cla&ssificar por &data" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Classificar &por..." , 409 MENUITEM "Classificar &por..." , 409
} }

View File

@ -89,10 +89,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "Â&ñå ïîäðîáíîñòè î ôàéëå" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "Â&ñå ïîäðîáíîñòè î ôàéëå" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Âûáîðî÷íî î ôàéëå..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Âûáîðî÷íî î ôàéëå..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Сортировать по имени" , 404 MENUITEM "&Сортировать по имени" , ID_VIEW_SORT_NAME
MENUITEM "Сортировать по &типу" , 405 MENUITEM "Сортировать по &типу" , ID_VIEW_SORT_TYPE
MENUITEM "Сортировать по &размеру" , 406 MENUITEM "Сортировать по &размеру" , ID_VIEW_SORT_SIZE
MENUITEM "Сортировать по д&ате" , 407 MENUITEM "Сортировать по д&ате" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Ñîðòèðîâàòü ïî &..." , 409 MENUITEM "Ñîðòèðîâàòü ïî &..." , 409
} }

View File

@ -90,12 +90,12 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "&All File Details" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "&All File Details" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "&Partial Details..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "&Partial Details..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Sort by Name" , 404 MENUITEM "&Sort by Name" , ID_VIEW_SORT_NAME
MENUITEM "Sort &by Type" , 405 MENUITEM "Sort &by Type" , ID_VIEW_SORT_TYPE
MENUITEM "Sort by Si&ze" , 406 MENUITEM "Sort by Si&ze" , ID_VIEW_SORT_SIZE
MENUITEM "Sort by &Date" , 407 MENUITEM "Sort by &Date" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Sort by &..." , 409 MENUITEM "Filter by &..." , 409
} }
POPUP "&Options" { POPUP "&Options" {

View File

@ -90,10 +90,10 @@ IDM_WINEFILE MENU FIXED IMPURE
MENUITEM "文件详悉列表(&A" , ID_VIEW_ALL_ATTRIBUTES, CHECKED MENUITEM "文件详悉列表(&A" , ID_VIEW_ALL_ATTRIBUTES, CHECKED
MENUITEM "部分属性(&P..." , ID_VIEW_SELECTED_ATTRIBUTES MENUITEM "部分属性(&P..." , ID_VIEW_SELECTED_ATTRIBUTES
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "按文件名排序(&S" , 404 MENUITEM "按文件名排序(&S" , ID_VIEW_SORT_NAME
MENUITEM "按类型排序(&B" , 405 MENUITEM "按类型排序(&B" , ID_VIEW_SORT_TYPE
MENUITEM "按大小排序(&Z" , 406 MENUITEM "按大小排序(&Z" , ID_VIEW_SORT_SIZE
MENUITEM "按日期排序(&D" , 407 MENUITEM "按日期排序(&D" , ID_VIEW_SORT_DATE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "定制排序..." , 409 MENUITEM "定制排序..." , 409
} }

View File

@ -44,6 +44,10 @@
#define ID_VIEW_NAME 401 #define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402 #define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403 #define ID_VIEW_SELECTED_ATTRIBUTES 403
#define ID_VIEW_SORT_NAME 404
#define ID_VIEW_SORT_TYPE 405
#define ID_VIEW_SORT_SIZE 406
#define ID_VIEW_SORT_DATE 407
#define ID_SELECT_FONT 510 #define ID_SELECT_FONT 510
#define ID_VIEW_TOOL_BAR 508 #define ID_VIEW_TOOL_BAR 508
#define ID_VIEW_DRIVE_BAR 507 #define ID_VIEW_DRIVE_BAR 507

View File

@ -168,7 +168,8 @@ extern void WineWarranty(HWND hwnd);
static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd); static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND hwnd);
static void set_curdir(ChildWnd* child, Entry* entry, HWND hwnd); static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd);
static void refresh_child(ChildWnd* child);
static void get_path(Entry* dir, PTSTR path); static void get_path(Entry* dir, PTSTR path);
LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam); LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
@ -1260,13 +1261,59 @@ static void read_directory(Entry* dir, LPCTSTR path, SORT_ORDER sortOrder, HWND
} }
static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd) static Entry* read_tree(Root* root, LPCTSTR path, LPITEMIDLIST pidl, LPTSTR drv, SORT_ORDER sortOrder, HWND hwnd)
{ {
const static TCHAR sBackslash[] = {'\\', '\0'};
#if !defined(_NO_EXTENSIONS) && defined(__WINE__) #if !defined(_NO_EXTENSIONS) && defined(__WINE__)
const static TCHAR sSlash[] = {'/', '\0'}; const static TCHAR sSlash[] = {'/', '\0'};
#endif #endif
const static TCHAR sBackslash[] = {'\\', '\0'};
#ifdef _SHELL_FOLDERS
if (pidl)
{
/* read shell namespace tree */
root->drive_type = DRIVE_UNKNOWN;
drv[0] = '\\';
drv[1] = '\0';
load_string(root->volname, IDS_DESKTOP);
root->fs_flags = 0;
load_string(root->fs, IDS_SHELL);
return read_tree_shell(root, pidl, sortOrder, hwnd);
}
else
#endif
#if !defined(_NO_EXTENSIONS) && defined(__WINE__)
if (*path == '/')
{
/* read unix file system tree */
root->drive_type = GetDriveType(path);
lstrcat(drv, sSlash);
load_string(root->volname, IDS_ROOT_FS);
root->fs_flags = 0;
load_string(root->fs, IDS_UNIXFS);
lstrcpy(root->path, sSlash);
return read_tree_unix(root, path, sortOrder, hwnd);
}
#endif
/* read WIN32 file system tree */
root->drive_type = GetDriveType(path);
lstrcat(drv, sBackslash);
GetVolumeInformation(drv, root->volname, _MAX_FNAME, 0, 0, &root->fs_flags, root->fs, _MAX_DIR);
lstrcpy(root->path, drv);
return read_tree_win(root, path, sortOrder, hwnd);
}
static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd)
{
TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT]; TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
TCHAR b1[BUFFER_LEN]; TCHAR b1[BUFFER_LEN];
@ -1308,44 +1355,7 @@ static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd)
root->entry.level = 0; root->entry.level = 0;
#ifdef _SHELL_FOLDERS entry = read_tree(root, path, pidl, drv, child->sortOrder, hwnd);
if (pidl)
{
root->drive_type = DRIVE_UNKNOWN;
drv[0] = '\\';
drv[1] = '\0';
load_string(root->volname, IDS_DESKTOP);
root->fs_flags = 0;
load_string(root->fs, IDS_SHELL);
entry = read_tree_shell(root, pidl, child->sortOrder, hwnd);
}
else
#endif
#if !defined(_NO_EXTENSIONS) && defined(__WINE__)
if (*path == '/')
{
root->drive_type = GetDriveType(path);
lstrcat(drv, sSlash);
load_string(root->volname, IDS_ROOT_FS);
root->fs_flags = 0;
load_string(root->fs, IDS_UNIXFS);
lstrcpy(root->path, sSlash);
entry = read_tree_unix(root, path, child->sortOrder, hwnd);
}
else
#endif
{
root->drive_type = GetDriveType(path);
lstrcat(drv, sBackslash);
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, hwnd);
}
#ifdef _SHELL_FOLDERS #ifdef _SHELL_FOLDERS
if (root->entry.etype == ET_SHELL) if (root->entry.etype == ET_SHELL)
@ -1359,7 +1369,7 @@ static ChildWnd* alloc_child_window(LPCTSTR path, LPITEMIDLIST pidl, HWND hwnd)
child->left.root = &root->entry; child->left.root = &root->entry;
child->right.root = NULL; child->right.root = NULL;
set_curdir(child, entry, hwnd); set_curdir(child, entry, 0, hwnd);
return child; return child;
} }
@ -1551,7 +1561,8 @@ static HWND create_child_window(ChildWnd* child)
ListBox_SetItemHeight(child->left.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3)); 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)); 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);
idx = ListBox_FindItemData(child->left.hwnd, 0, child->left.cur);
ListBox_SetCurSel(child->left.hwnd, idx); ListBox_SetCurSel(child->left.hwnd, idx);
return child->hwnd; return child->hwnd;
@ -1814,6 +1825,13 @@ LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_INITMENUPOPUP: {
HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
if (!SendMessage(hwndClient, WM_INITMENUPOPUP, wparam, lparam))
return 0;
break;}
case WM_COMMAND: { case WM_COMMAND: {
UINT cmd = LOWORD(wparam); UINT cmd = LOWORD(wparam);
HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0); HWND hwndClient = (HWND) SendMessage(Globals.hmdiclient, WM_MDIGETACTIVE, 0, 0);
@ -3091,10 +3109,9 @@ static LRESULT pane_notify(Pane* pane, NMHDR* pnmh)
#endif /* _NO_EXTENSIONS */ #endif /* _NO_EXTENSIONS */
static void scan_entry(ChildWnd* child, Entry* entry, HWND hwnd) static void scan_entry(ChildWnd* child, Entry* entry, int idx, HWND hwnd)
{ {
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
int idx = ListBox_GetCurSel(child->left.hwnd);
HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT)); HCURSOR old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
/* delete sub entries in left pane */ /* delete sub entries in left pane */
@ -3208,7 +3225,7 @@ static void collapse_entry(Pane* pane, Entry* dir)
} }
static void set_curdir(ChildWnd* child, Entry* entry, HWND hwnd) static void set_curdir(ChildWnd* child, Entry* entry, int idx, HWND hwnd)
{ {
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
@ -3219,7 +3236,7 @@ static void set_curdir(ChildWnd* child, Entry* entry, HWND hwnd)
child->right.cur = entry; child->right.cur = entry;
if (!entry->scanned) if (!entry->scanned)
scan_entry(child, entry, hwnd); scan_entry(child, entry, idx, hwnd);
else { else {
ListBox_ResetContent(child->right.hwnd); ListBox_ResetContent(child->right.hwnd);
insert_entries(&child->right, entry->down, -1); insert_entries(&child->right, entry->down, -1);
@ -3241,6 +3258,30 @@ static void set_curdir(ChildWnd* child, Entry* entry, HWND hwnd)
} }
static void refresh_child(ChildWnd* child)
{
TCHAR path[MAX_PATH], drv[_MAX_DRIVE+1];
Entry* entry;
int idx;
get_path(child->left.cur, path);
_tsplitpath(path, drv, NULL, NULL, NULL);
child->right.root = NULL;
scan_entry(child, &child->root.entry, 0, child->hwnd);
entry = read_tree(&child->root, path, NULL, drv, child->sortOrder, child->hwnd);
insert_entries(&child->left, child->root.entry.down, 0);
set_curdir(child, entry, 0, child->hwnd);
idx = ListBox_FindItemData(child->left.hwnd, 0, child->left.cur);
ListBox_SetCurSel(child->left.hwnd, idx);
}
BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow) BOOL launch_file(HWND hwnd, LPCTSTR cmd, UINT nCmdShow)
{ {
HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow); HINSTANCE hinst = ShellExecute(hwnd, NULL/*operation*/, cmd, NULL/*parameters*/, NULL/*dir*/, nCmdShow);
@ -3318,7 +3359,7 @@ static void activate_entry(ChildWnd* child, Pane* pane, HWND hwnd)
int scanned_old = entry->scanned; int scanned_old = entry->scanned;
if (!scanned_old) if (!scanned_old)
scan_entry(child, entry, hwnd); scan_entry(child, entry, ListBox_GetCurSel(child->left.hwnd), hwnd);
#ifndef _NO_EXTENSIONS #ifndef _NO_EXTENSIONS
if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='\0') if (entry->data.cFileName[0]=='.' && entry->data.cFileName[1]=='\0')
@ -3337,7 +3378,7 @@ static void activate_entry(ChildWnd* child, Pane* pane, HWND hwnd)
if (!pane->treePane) focus_entry: { if (!pane->treePane) focus_entry: {
int idx = ListBox_FindItemData(child->left.hwnd, ListBox_GetCurSel(child->left.hwnd), entry); int idx = ListBox_FindItemData(child->left.hwnd, ListBox_GetCurSel(child->left.hwnd), entry);
ListBox_SetCurSel(child->left.hwnd, idx); ListBox_SetCurSel(child->left.hwnd, idx);
set_curdir(child, entry, hwnd); set_curdir(child, entry, idx, hwnd);
} }
} }
@ -3403,6 +3444,23 @@ static BOOL pane_command(Pane* pane, UINT cmd)
} }
static void set_sort_order(ChildWnd* child, SORT_ORDER sortOrder)
{
if (child->sortOrder != sortOrder) {
child->sortOrder = sortOrder;
refresh_child(child);
}
}
static void update_view_menu(ChildWnd* child)
{
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_NAME, child->sortOrder==SORT_NAME? MF_CHECKED: MF_UNCHECKED);
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_TYPE, child->sortOrder==SORT_EXT? MF_CHECKED: MF_UNCHECKED);
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_SIZE, child->sortOrder==SORT_SIZE? MF_CHECKED: MF_UNCHECKED);
CheckMenuItem(Globals.hMenuView, ID_VIEW_SORT_DATE, child->sortOrder==SORT_DATE? MF_CHECKED: MF_UNCHECKED);
}
static IContextMenu2* s_pctxmenu2 = NULL; static IContextMenu2* s_pctxmenu2 = NULL;
static IContextMenu3* s_pctxmenu3 = NULL; static IContextMenu3* s_pctxmenu3 = NULL;
@ -3654,7 +3712,6 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
#endif /* _NO_EXTENSIONS */ #endif /* _NO_EXTENSIONS */
case WM_SETFOCUS: case WM_SETFOCUS:
SetCurrentDirectory(child->path);
if (SetCurrentDirectory(child->path)) if (SetCurrentDirectory(child->path))
set_space_status(); set_space_status();
SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd); SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd);
@ -3673,7 +3730,7 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
break;} break;}
case ID_REFRESH: case ID_REFRESH:
scan_entry(child, pane->cur, hwnd); refresh_child(child);
break; break;
case ID_ACTIVATE: case ID_ACTIVATE:
@ -3710,12 +3767,28 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
activate_entry(child, pane, hwnd); activate_entry(child, pane, hwnd);
} }
else else
scan_entry(child, pane->root, hwnd); refresh_child(child);
} }
else else
display_error(hwnd, GetLastError()); display_error(hwnd, GetLastError());
break;} break;}
case ID_VIEW_SORT_NAME:
set_sort_order(child, SORT_NAME);
break;
case ID_VIEW_SORT_TYPE:
set_sort_order(child, SORT_EXT);
break;
case ID_VIEW_SORT_SIZE:
set_sort_order(child, SORT_SIZE);
break;
case ID_VIEW_SORT_DATE:
set_sort_order(child, SORT_DATE);
break;
default: default:
return pane_command(pane, LOWORD(wparam)); return pane_command(pane, LOWORD(wparam));
} }
@ -3731,7 +3804,7 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx); Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx);
if (pane == &child->left) if (pane == &child->left)
set_curdir(child, entry, hwnd); set_curdir(child, entry, idx, hwnd);
else else
pane->cur = entry; pane->cur = entry;
break;} break;}
@ -3801,6 +3874,7 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam)) if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam))
return 0; return 0;
update_view_menu(child);
break; break;
case WM_MENUCHAR: /* only supported by IContextMenu3 */ case WM_MENUCHAR: /* only supported by IContextMenu3 */