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 */
#ifndef _INC_REACTOS_BUILDNO
#define _INC_REACTOS_BUILDNO
#define KERNEL_VERSION_BUILD 1
#define KERNEL_VERSION_BUILD_STR "1"
#define KERNEL_RELEASE_RC "0.1.4.1\0"
#define KERNEL_RELEASE_STR "0.1.4.1"
#define KERNEL_VERSION_BUILD 4
#define KERNEL_VERSION_BUILD_STR "4"
#define KERNEL_RELEASE_RC "0.1.4.4\0"
#define KERNEL_RELEASE_STR "0.1.4.4"
#define KERNEL_VERSION_RC "0.1.4\0"
#define KERNEL_VERSION_STR "0.1.4"
#endif

View file

@ -73,6 +73,8 @@ void CollectProgramsThread::collect_programs(const ShellPath& path)
if (_alive)
_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));
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};
@ -119,6 +122,12 @@ void FindProgramTopicDlg::Refresh()
{
WaitCursor wait;
_thread.Stop();
TCHAR buffer[1024];
GetWindowText(GetDlgItem(_hwnd, IDC_TOPIC), buffer, 1024);
_filter = buffer;
ListView_DeleteAllItems(_list_ctrl);
_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);
if (SUCCEEDED(hr)) {
FindProgramTopicDlg* pThis = (FindProgramTopicDlg*) param;
String lwr_path = path;
String lwr_name = entry->_display_name;
String filter = pThis->_filter;
#ifndef __WINE__ //TODO
_tcslwr((LPTSTR)lwr_path.c_str());
_tcslwr((LPTSTR)lwr_name.c_str());
_tcslwr((LPTSTR)filter.c_str());
#endif
if (_tcsstr(lwr_path, _T(".exe")) && //@@ filter on ".exe" suffix
!_tcsstr(lwr_name, _T("uninstal")) && !_tcsstr(lwr_name, _T("deinstal"))) { //@@ filter out deinstallation links
FindProgramTopicDlg* pThis = (FindProgramTopicDlg*) param;
//if (_tcsstr(lwr_path, _T(".exe"))) //@@ filter on ".exe" suffix
//if (!_tcsstr(lwr_name, _T("uninstal")) && !_tcsstr(lwr_name, _T("deinstal"))) //@@ filter out deinstallation links
if (_tcsstr(lwr_path, filter) || _tcsstr(lwr_name, filter)) {
LV_ITEM item = {LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, INT_MAX};
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; //@@
//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.mask = LVIF_TEXT;
item.iSubItem = 1;
item.pszText = path;
if (!pThis->_thread.is_alive())
return;
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)
{
switch(id) {
case ID_REFRESH:
Refresh();
break;
if (code == BN_CLICKED)
switch(id) {
case ID_REFRESH:
Refresh();
break;
default:
return super::Command(id, code);
}
default:
return super::Command(id, code);
}
else if (code == EN_CHANGE)
switch(id) {
case IDC_TOPIC:
Refresh();
}
return TRUE;
}

View file

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

View file

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

View file

@ -47,6 +47,7 @@
#define IDB_LOGOV 129
#define IDB_LOGOV256 130
#define IDA_SEARCH_PROGRAM 133
#define IDI_APPICON 134
#define ID_VIEW_NAME 401
#define ID_VIEW_ALL_ATTRIBUTES 402
#define ID_VIEW_SELECTED_ATTRIBUTES 403
@ -81,7 +82,7 @@
//
#ifdef APSTUDIO_INVOKED
#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_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101

View file

@ -8,7 +8,6 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#include <winuser.h>
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@ -146,8 +145,8 @@ IDB_LOGOV256 BITMAP DISCARDABLE "res/logov256.bmp"
IDA_EXPLORER ACCELERATORS DISCARDABLE
BEGIN
88, ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
83, ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL,
"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
"S", ID_VIEW_FULLSCREEN, VIRTKEY, SHIFT, CONTROL,
NOINVERT
END
@ -345,6 +344,7 @@ IDI_STARTMENU ICON DISCARDABLE "res/startmenu.ico"
IDI_LOGOFF ICON DISCARDABLE "res/logoff.ico"
IDI_ARROW ICON DISCARDABLE "res/arrow.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
EXSTYLE WS_EX_APPWINDOW
CAPTION "Search Program in Startmenu"
FONT 8, "MS Sans Serif"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
EDITTEXT IDC_TOPIC,7,7,130,14,ES_AUTOHSCROLL
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);
}
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;
}
}
@ -294,10 +315,22 @@ void ShellDirectory::read_directory()
// get display icons for files and virtual objects
if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
!(attribs & SFGAO_FILESYSTEM)) {
entry->_hIcon = extract_icon(_folder, pidls[n]);
entry->_hIcon = extract_icon(_folder, pidls[n]/*, (ShellEntry*)entry*/);
if (!entry->_hIcon)
entry->_hIcon = (HICON)-1; // don't try again later
if (!entry->_hIcon) {
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;

View file

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