activate find-progra-dialog filter

svn path=/trunk/; revision=6352
This commit is contained in:
Martin Fuchs 2003-10-17 22:56:25 +00:00
parent 5304188395
commit b33671f3ab
9 changed files with 108 additions and 27 deletions

View file

@ -1,10 +1,10 @@
/* Do not edit - Machine generated */ /* Do not edit - Machine generated */
#ifndef _INC_REACTOS_BUILDNO #ifndef _INC_REACTOS_BUILDNO
#define _INC_REACTOS_BUILDNO #define _INC_REACTOS_BUILDNO
#define KERNEL_VERSION_BUILD 1 #define KERNEL_VERSION_BUILD 4
#define KERNEL_VERSION_BUILD_STR "1" #define KERNEL_VERSION_BUILD_STR "4"
#define KERNEL_RELEASE_RC "0.1.4.1\0" #define KERNEL_RELEASE_RC "0.1.4.4\0"
#define KERNEL_RELEASE_STR "0.1.4.1" #define KERNEL_RELEASE_STR "0.1.4.4"
#define KERNEL_VERSION_RC "0.1.4\0" #define KERNEL_VERSION_RC "0.1.4\0"
#define KERNEL_VERSION_STR "0.1.4" #define KERNEL_VERSION_STR "0.1.4"
#endif #endif

View file

@ -73,6 +73,8 @@ void CollectProgramsThread::collect_programs(const ShellPath& path)
if (_alive) if (_alive)
_callback(dir._folder, shell_entry, _para); _callback(dir._folder, shell_entry, _para);
} }
dir.free_subentries();
} }
@ -94,6 +96,7 @@ FindProgramTopicDlg::FindProgramTopicDlg(HWND hwnd)
_haccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_SEARCH_PROGRAM)); _haccel = LoadAccelerators(g_Globals._hInstance, MAKEINTRESOURCE(IDA_SEARCH_PROGRAM));
ListView_SetImageList(_list_ctrl, _himl, LVSIL_SMALL); ListView_SetImageList(_list_ctrl, _himl, LVSIL_SMALL);
_idxNoIcon = ImageList_AddIcon(_himl, SmallIcon(IDI_APPICON));
LV_COLUMN column = {LVCF_FMT|LVCF_WIDTH|LVCF_TEXT, LVCFMT_LEFT, 250}; LV_COLUMN column = {LVCF_FMT|LVCF_WIDTH|LVCF_TEXT, LVCFMT_LEFT, 250};
@ -119,6 +122,12 @@ void FindProgramTopicDlg::Refresh()
{ {
WaitCursor wait; WaitCursor wait;
_thread.Stop();
TCHAR buffer[1024];
GetWindowText(GetDlgItem(_hwnd, IDC_TOPIC), buffer, 1024);
_filter = buffer;
ListView_DeleteAllItems(_list_ctrl); ListView_DeleteAllItems(_list_ctrl);
_thread.Start(); _thread.Start();
@ -140,32 +149,49 @@ void FindProgramTopicDlg::collect_programs_callback(ShellFolder& folder, const S
hr = pShellLink->GetPath(path, MAX_PATH-1, (WIN32_FIND_DATA*)&wfd, SLGP_UNCPRIORITY); hr = pShellLink->GetPath(path, MAX_PATH-1, (WIN32_FIND_DATA*)&wfd, SLGP_UNCPRIORITY);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
FindProgramTopicDlg* pThis = (FindProgramTopicDlg*) param;
String lwr_path = path; String lwr_path = path;
String lwr_name = entry->_display_name; String lwr_name = entry->_display_name;
String filter = pThis->_filter;
#ifndef __WINE__ //TODO #ifndef __WINE__ //TODO
_tcslwr((LPTSTR)lwr_path.c_str()); _tcslwr((LPTSTR)lwr_path.c_str());
_tcslwr((LPTSTR)lwr_name.c_str()); _tcslwr((LPTSTR)lwr_name.c_str());
_tcslwr((LPTSTR)filter.c_str());
#endif #endif
if (_tcsstr(lwr_path, _T(".exe")) && //@@ filter on ".exe" suffix //if (_tcsstr(lwr_path, _T(".exe"))) //@@ filter on ".exe" suffix
!_tcsstr(lwr_name, _T("uninstal")) && !_tcsstr(lwr_name, _T("deinstal"))) { //@@ filter out deinstallation links //if (!_tcsstr(lwr_name, _T("uninstal")) && !_tcsstr(lwr_name, _T("deinstal"))) //@@ filter out deinstallation links
FindProgramTopicDlg* pThis = (FindProgramTopicDlg*) param; if (_tcsstr(lwr_path, filter) || _tcsstr(lwr_name, filter)) {
LV_ITEM item = {LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, INT_MAX}; LV_ITEM item = {LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, INT_MAX};
item.pszText = entry->_display_name; item.pszText = entry->_display_name;
item.iImage = ImageList_AddIcon(pThis->_himl, entry->_hIcon);
if (entry->_hIcon != (HICON)-1)
item.iImage = ImageList_AddIcon(pThis->_himl, entry->_hIcon);
else
item.iImage = pThis->_idxNoIcon;
item.lParam = 0; //@@ item.lParam = 0; //@@
//TODO: store info in ShellPathWithFolder //TODO: store info in ShellPathWithFolder
Lock lock(pThis->_thread._crit_sect);
// resolve deadlocks while executing Thread::Stop()
if (!pThis->_thread.is_alive())
return;
item.iItem = ListView_InsertItem(pThis->_list_ctrl, &item); item.iItem = ListView_InsertItem(pThis->_list_ctrl, &item);
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;
item.iSubItem = 1; item.iSubItem = 1;
item.pszText = path; item.pszText = path;
if (!pThis->_thread.is_alive())
return;
ListView_SetItem(pThis->_list_ctrl, &item); ListView_SetItem(pThis->_list_ctrl, &item);
} }
} }
@ -187,14 +213,20 @@ LRESULT FindProgramTopicDlg::WndProc(UINT message, WPARAM wparam, LPARAM lparam)
int FindProgramTopicDlg::Command(int id, int code) int FindProgramTopicDlg::Command(int id, int code)
{ {
switch(id) { if (code == BN_CLICKED)
case ID_REFRESH: switch(id) {
Refresh(); case ID_REFRESH:
break; Refresh();
break;
default: default:
return super::Command(id, code); return super::Command(id, code);
} }
else if (code == EN_CHANGE)
switch(id) {
case IDC_TOPIC:
Refresh();
}
return TRUE; return TRUE;
} }

View file

@ -72,6 +72,8 @@ protected:
HWND _list_ctrl; HWND _list_ctrl;
HACCEL _haccel; HACCEL _haccel;
HIMAGELIST _himl; HIMAGELIST _himl;
int _idxNoIcon; // Ersatzicon für Links ohne Symbole
String _filter;
CollectProgramsThread _thread; CollectProgramsThread _thread;

View file

@ -561,6 +561,10 @@ SOURCE=.\dialogs\searchprogram.h
# End Group # End Group
# Begin Source File # Begin Source File
SOURCE=.\res\appicon.ico
# End Source File
# Begin Source File
SOURCE=.\buildno.h SOURCE=.\buildno.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View file

@ -47,6 +47,7 @@
#define IDB_LOGOV 129 #define IDB_LOGOV 129
#define IDB_LOGOV256 130 #define IDB_LOGOV256 130
#define IDA_SEARCH_PROGRAM 133 #define IDA_SEARCH_PROGRAM 133
#define IDI_APPICON 134
#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
@ -81,7 +82,7 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 134 #define _APS_NEXT_RESOURCE_VALUE 135
#define _APS_NEXT_COMMAND_VALUE 40002 #define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101

View file

@ -8,7 +8,6 @@
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#include <windows.h> #include <windows.h>
#include <winuser.h>
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
@ -146,8 +145,8 @@ IDB_LOGOV256 BITMAP DISCARDABLE "res/logov256.bmp"
IDA_EXPLORER ACCELERATORS DISCARDABLE IDA_EXPLORER ACCELERATORS DISCARDABLE
BEGIN BEGIN
88, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT "X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
83, ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL, "S", ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL,
NOINVERT NOINVERT
END END
@ -345,6 +344,7 @@ IDI_STARTMENU ICON DISCARDABLE "res/startmenu.ico"
IDI_LOGOFF ICON DISCARDABLE "res/logoff.ico" IDI_LOGOFF ICON DISCARDABLE "res/logoff.ico"
IDI_ARROW ICON DISCARDABLE "res/arrow.ico" IDI_ARROW ICON DISCARDABLE "res/arrow.ico"
IDI_ARROW_SELECTED ICON DISCARDABLE "res/arrowsel.ico" IDI_ARROW_SELECTED ICON DISCARDABLE "res/arrowsel.ico"
IDI_APPICON ICON DISCARDABLE "res/appicon.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -565,7 +565,7 @@ STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW EXSTYLE WS_EX_APPWINDOW
CAPTION "Search Program in Startmenu" CAPTION "Search Program in Startmenu"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
EDITTEXT IDC_TOPIC,7,7,130,14,ES_AUTOHSCROLL EDITTEXT IDC_TOPIC,7,7,130,14,ES_AUTOHSCROLL
CONTROL "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT | CONTROL "List1",IDC_MAILS_FOUND,"SysListView32",LVS_REPORT |

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View file

@ -196,6 +196,27 @@ static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl)
DestroyIcon(hIconLarge); DestroyIcon(hIconLarge);
} }
if (!hIcon) {
SHFILEINFO sfi;
if (SHGetFileInfo(path, 0, &sfi, sizeof(sfi), SHGFI_ICON|SHGFI_SMALLICON))
hIcon = sfi.hIcon;
}
/*
if (!hIcon) {
LPBYTE b = (LPBYTE) alloca(0x10000);
SHFILEINFO sfi;
FILE* file = fopen(path, "rb");
if (file) {
int l = fread(b, 1, 0x10000, file);
fclose(file);
if (l)
hIcon = CreateIconFromResourceEx(b, l, TRUE, 0x00030000, 16, 16, LR_DEFAULTCOLOR);
}
}
*/
return hIcon; return hIcon;
} }
} }
@ -294,10 +315,22 @@ void ShellDirectory::read_directory()
// get display icons for files and virtual objects // get display icons for files and virtual objects
if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
!(attribs & SFGAO_FILESYSTEM)) { !(attribs & SFGAO_FILESYSTEM)) {
entry->_hIcon = extract_icon(_folder, pidls[n]); entry->_hIcon = extract_icon(_folder, pidls[n]/*, (ShellEntry*)entry*/);
if (!entry->_hIcon) if (!entry->_hIcon) {
entry->_hIcon = (HICON)-1; // don't try again later if (!entry->_hIcon) {
ShellPath pidl_abs = static_cast<ShellEntry*>(entry)->create_absolute_pidl();
LPCITEMIDLIST pidl = pidl_abs;
SHFILEINFO sfi;
if (SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi), SHGFI_PIDL|SHGFI_ICON|SHGFI_SMALLICON))
entry->_hIcon = sfi.hIcon;
}
if (!entry->_hIcon)
entry->_hIcon = (HICON)-1; // don't try again later
}
} }
entry->_down = NULL; entry->_down = NULL;

View file

@ -191,14 +191,23 @@ struct Thread
void Stop() void Stop()
{ {
_alive = false; if (_alive) {
{
Lock lock(_crit_sect);
_alive = false;
}
// wait for finishing // wait for finishing
WaitForSingleObject(_hThread, INFINITE); WaitForSingleObject(_hThread, INFINITE);
}
} }
virtual int Run() = 0; virtual int Run() = 0;
bool is_alive() const {return _alive;}
CritSect _crit_sect;
protected: protected:
static DWORD WINAPI ThreadProc(void* para); static DWORD WINAPI ThreadProc(void* para);