test version of startmenu root with big icons
Modified: trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
Modified: trunk/reactos/subsys/system/explorer/doc/changes.txt
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
Modified: trunk/reactos/subsys/system/explorer/globals.h
Modified: trunk/reactos/subsys/system/explorer/res/arrow.ico
Modified: trunk/reactos/subsys/system/explorer/res/arrow_dwn.ico
Modified: trunk/reactos/subsys/system/explorer/res/arrow_up.ico
Modified: trunk/reactos/subsys/system/explorer/res/arrowsel.ico
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/entries.h
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.h
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
_____
Modified: trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
--- trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -344,7 +344,7 @@
Entry* entry = cache_entry._entry;
if (entry->_icon_id == ICID_UNKNOWN)
- entry->extract_icon();
+ entry->extract_icon(false);
pDispInfo->item.iImage =
g_Globals._icon_cache.get_icon(entry->_icon_id).get_sysiml_idx();
pDispInfo->item.mask |= LVIF_DI_SETITEM;
_____
Modified: trunk/reactos/subsys/system/explorer/doc/changes.txt
--- trunk/reactos/subsys/system/explorer/doc/changes.txt
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/doc/changes.txt
2005-11-04 00:21:12 UTC (rev 18983)
@@ -164,3 +164,4 @@
06.10.2005 m. fuchs implemented command line parser for
Explorer
09.10.2005 m. fuchs Fix for Bugzilla Entry 330: Correctly
handle WM_COMMAND messages in web windows without web control
m. fuchs replace "search computer" start
menu entry by a "not yet implemented" message
+01.11.2005 m. fuchs String::str(), String::toLower() to
allow conventient and WINE compatible string conversions
_____
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
--- trunk/reactos/subsys/system/explorer/explorer.cpp 2005-11-04
00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/explorer.cpp 2005-11-04
00:21:12 UTC (rev 18983)
@@ -246,10 +246,10 @@
{
}
-Icon::Icon(ICON_ID id, UINT nid)
+Icon::Icon(ICON_ID id, UINT nid) //, int cx, int cy
: _id(id),
_itype(IT_STATIC),
- _hicon(SmallIcon(nid))
+ _hicon(ResIcon(nid)) // ResIconEx(nid, cx, cy)
{
}
@@ -322,8 +322,25 @@
return ret;
}
-HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC
hdc_wnd)
+HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC
hdc_wnd/*, bool big_icons*/)
{
+ int cx = GetSystemMetrics(SM_CXSMICON); //ICON_SIZE_X;
+ int cy = GetSystemMetrics(SM_CYSMICON); //ICON_SIZE_Y;
+ HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
+
+ MemCanvas canvas;
+ BitmapSelection sel(canvas, hbmp);
+
+ RECT rect = {0, 0, cx, cy};
+ FillRect(canvas, &rect, hbrush_bkgnd);
+
+ DrawIconEx(canvas, 0, 0, hIcon, cx, cy, 0, hbrush_bkgnd,
DI_NORMAL);
+
+ return hbmp;
+}
+
+HBITMAP create_small_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd,
HDC hdc_wnd)
+{
int cx = GetSystemMetrics(SM_CXSMICON);
int cy = GetSystemMetrics(SM_CYSMICON);
HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
@@ -379,7 +396,7 @@
}
-const Icon& IconCache::extract(const String& path)
+const Icon& IconCache::extract(LPCTSTR path, bool big_icons)
{
PathMap::iterator found = _pathMap.find(path);
@@ -388,24 +405,32 @@
SHFILEINFO sfi;
-#if 1 // use system image list - the "search program dialog" needs it
- HIMAGELIST himlSys = (HIMAGELIST) SHGetFileInfo(path, 0, &sfi,
sizeof(sfi), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
+ if (big_icons) {
+ if (SHGetFileInfo(path, 0, &sfi, sizeof(sfi),
SHGFI_ICON)) {
+ const Icon& icon = add(sfi.hIcon, IT_CACHED);
- if (himlSys) {
- _himlSys = himlSys;
+ ///@todo limit cache size
+ _pathMap[path] = icon;
- const Icon& icon = add(sfi.iIcon/*, IT_SYSCACHE*/);
-#else
- if (SHGetFileInfo(path, 0, &sfi, sizeof(sfi),
SHGFI_ICON|SHGFI_SMALLICON)) {
- const Icon& icon = add(sfi.hIcon, IT_CACHED);
-#endif
+ return icon;
+ }
+ } else {
+ // use system image list - the "search program dialog"
needs it
+ HIMAGELIST himlSys_small = (HIMAGELIST)
SHGetFileInfo(path, 0, &sfi, sizeof(sfi),
SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
- ///@todo limit cache size
- _pathMap[path] = icon;
+ if (himlSys_small) {
+ _himlSys_small = himlSys_small;
- return icon;
- } else
- return _icons[ICID_NONE];
+ const Icon& icon = add(sfi.iIcon/*,
IT_SYSCACHE*/);
+
+ ///@todo limit cache size
+ _pathMap[path] = icon;
+
+ return icon;
+ }
+ }
+
+ return _icons[ICID_NONE];
}
const Icon& IconCache::extract(LPCTSTR path, int idx)
@@ -435,17 +460,24 @@
}
}
-const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path,
int idx)
+const Icon& IconCache::extract(IExtractIcon* pExtract, LPCTSTR path,
int idx, bool big_icons)
{
HICON hIconLarge = 0;
HICON hIcon;
- HRESULT hr = pExtract->Extract(path, idx, &hIconLarge, &hIcon,
MAKELONG(0/*GetSystemMetrics(SM_CXICON)*/,GetSystemMetrics(SM_CXSMICON))
);
+ HRESULT hr = pExtract->Extract(path, idx, &hIconLarge, &hIcon,
MAKELONG(GetSystemMetrics(SM_CXICON), ICON_SIZE_X));
if (hr == NOERROR) { //@@ oder SUCCEEDED(hr) ?
- if (hIconLarge)
- DestroyIcon(hIconLarge);
+ if (big_icons) { //@@ OK?
+ if (hIcon)
+ DestroyIcon(hIcon);
+ hIcon = hIconLarge;
+ } else {
+ if (hIconLarge)
+ DestroyIcon(hIconLarge);
+ }
+
if (hIcon)
return add(hIcon);
}
_____
Modified: trunk/reactos/subsys/system/explorer/globals.h
--- trunk/reactos/subsys/system/explorer/globals.h 2005-11-04
00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/globals.h 2005-11-04
00:21:12 UTC (rev 18983)
@@ -114,20 +114,21 @@
};
struct IconCache {
- IconCache() : _himlSys(0) {}
+ IconCache() : _himlSys_small(0) {}
void init();
- const Icon& extract(const String& path);
+ const Icon& extract(LPCTSTR path, bool big_icons);
const Icon& extract(LPCTSTR path, int idx);
- const Icon& extract(IExtractIcon* pExtract, LPCTSTR path,
int idx);
+ const Icon& extract(IExtractIcon* pExtract, LPCTSTR path,
int idx, bool big_icons);
const Icon& add(HICON hIcon, ICON_TYPE type=IT_DYNAMIC);
const Icon& add(int sys_idx/*, ICON_TYPE
type=IT_SYSCACHE*/);
const Icon& get_icon(int icon_id);
- HIMAGELIST get_sys_imagelist() const {return _himlSys;}
+ HIMAGELIST get_sys_imagelist() const {return _himlSys_small;}
+
void free_icon(int icon_id);
protected:
@@ -143,12 +144,16 @@
typedef map<CachePair, ICON_ID> PathIdxMap;
PathIdxMap _pathIdxMap;
- HIMAGELIST _himlSys;
+ HIMAGELIST _himlSys_small;
};
+#define ICON_SIZE_X GetSystemMetrics(big_icons?
SM_CXICON: SM_CXSMICON)
+#define ICON_SIZE_Y GetSystemMetrics(big_icons?
SM_CYICON: SM_CYSMICON)
+
+
/// create a bitmap from an icon
-extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd);
+extern HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd/*, bool big_icons*/);
/// add icon with alpha channel to imagelist using the specified
background color
extern int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH
hbrush_bkgnd, HDC hdc_wnd);
_____
Modified: trunk/reactos/subsys/system/explorer/res/arrow.ico
(Binary files differ)
_____
Modified: trunk/reactos/subsys/system/explorer/res/arrow_dwn.ico
(Binary files differ)
_____
Modified: trunk/reactos/subsys/system/explorer/res/arrow_up.ico
(Binary files differ)
_____
Modified: trunk/reactos/subsys/system/explorer/res/arrowsel.ico
(Binary files differ)
_____
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
--- trunk/reactos/subsys/system/explorer/shell/entries.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/shell/entries.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -319,14 +319,14 @@
}
-void Entry::extract_icon()
+void Entry::extract_icon(bool big_icons)
{
TCHAR path[MAX_PATH];
ICON_ID icon_id = ICID_NONE;
if (get_path(path, COUNTOF(path)) &&
_tcsncmp(path,TEXT("::{"),3))
- icon_id = g_Globals._icon_cache.extract(path);
+ icon_id = g_Globals._icon_cache.extract(path,
big_icons);
if (icon_id == ICID_NONE) {
IExtractIcon* pExtract;
@@ -336,7 +336,7 @@
if
(SUCCEEDED(pExtract->GetIconLocation(GIL_FORSHELL, path, MAX_PATH, &idx,
&flags))) {
if (flags & GIL_NOTFILENAME)
- icon_id =
g_Globals._icon_cache.extract(pExtract, path, idx);
+ icon_id =
g_Globals._icon_cache.extract(pExtract, path, idx, big_icons);
else {
if (idx == -1)
idx = 0; //
special case for some control panel applications ("System")
@@ -374,11 +374,11 @@
const ShellPath& pidl_abs =
create_absolute_pidl();
LPCITEMIDLIST pidl = pidl_abs;
- HIMAGELIST himlSys = (HIMAGELIST)
SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi),
SHGFI_SYSICONINDEX|SHGFI_PIDL|SHGFI_SMALLICON);
+ HIMAGELIST himlSys = (HIMAGELIST)
SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi),
SHGFI_SYSICONINDEX|SHGFI_PIDL|(big_icons? SHGFI_SMALLICON: 0));
if (himlSys)
icon_id =
g_Globals._icon_cache.add(sfi.iIcon);
/*
- if (SHGetFileInfo((LPCTSTR)pidl, 0, &sfi,
sizeof(sfi), SHGFI_PIDL|SHGFI_ICON|SHGFI_SMALLICON))
+ if (SHGetFileInfo((LPCTSTR)pidl, 0, &sfi,
sizeof(sfi), SHGFI_PIDL|SHGFI_ICON|(g_Globals._big_icons?
SHGFI_SMALLICON: 0)))
icon_id =
g_Globals._icon_cache.add(sfi.hIcon)._id;
*/
}
_____
Modified: trunk/reactos/subsys/system/explorer/shell/entries.h
--- trunk/reactos/subsys/system/explorer/shell/entries.h
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/shell/entries.h
2005-11-04 00:21:12 UTC (rev 18983)
@@ -48,7 +48,7 @@
};
enum SCAN_FLAGS {
- SCAN_EXTRACT_ICONS = 1,
+// SCAN_EXTRACT_ICONS = 1,
SCAN_DO_ACCESS = 2,
SCAN_ALL = 3,
@@ -103,7 +103,7 @@
Entry* read_tree(const void* path, SORT_ORDER
sortOrder=SORT_NAME, int scan_flags=SCAN_ALL);
void sort_directory(SORT_ORDER sortOrder);
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int
scan_flags=SCAN_ALL);
- void extract_icon();
+ void extract_icon(bool big_icons);
virtual void read_directory(int scan_flags=SCAN_ALL)
{}
virtual const void* get_next_path_component(const void*)
const {return NULL;}
@@ -115,7 +115,7 @@
virtual HRESULT do_context_menu(HWND hwnd, const POINT&
pos, CtxMenuInterfaces& cm_ifs);
protected:
- bool get_path_base(PTSTR path, size_t path_count, ENTRY_TYPE
etype) const;
+ bool get_path_base(PTSTR path, size_t path_count, ENTRY_TYPE
etype) const;
};
_____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
--- trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -149,9 +149,10 @@
MainFrameBase::MainFrameBase(HWND hwnd)
- : super(hwnd),
- _himl(ImageList_Create(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0))
+ : super(hwnd)
{
+ _himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0);
+
_hMenuFrame = GetMenu(hwnd);
_hMenuWindow = GetSubMenu(_hMenuFrame,
GetMenuItemCount(_hMenuFrame)-3);
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
--- trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -252,13 +252,13 @@
lpdi->item.pszText =
entry->_data.cFileName;
*/
if (lpdi->item.mask & TVIF_IMAGE)
- if
((HIMAGELIST)SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi),
SHGFI_PIDL|SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_LINKOVERLAY) ==
_himl)
+ if
((HIMAGELIST)SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi),
SHGFI_PIDL|SHGFI_SYSICONINDEX|SHGFI_LINKOVERLAY|SHGFI_SMALLICON) ==
_himl)
lpdi->item.iImage = sfi.iIcon;
else
lpdi->item.iImage = -1;
if (lpdi->item.mask & TVIF_SELECTEDIMAGE)
- if
((HIMAGELIST)SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi),
SHGFI_PIDL|SHGFI_SYSICONINDEX|SHGFI_SMALLICON|SHGFI_OPENICON) == _himl)
+ if
((HIMAGELIST)SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(sfi),
SHGFI_PIDL|SHGFI_SYSICONINDEX|SHGFI_OPENICON|SHGFI_SMALLICON) == _himl)
lpdi->item.iSelectedImage =
sfi.iIcon;
else
lpdi->item.iSelectedImage = -1;
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
--- trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -58,38 +58,40 @@
if (SUCCEEDED(hr)) {
LPCTSTR path =
(LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal));
- // fill with drive names "C:", ...
- assert(_tcslen(path) <
GlobalSize(medium.UNION_MEMBER(hGlobal)));
- _tcscpy(pw32fdata->cFileName, path);
+ if (path) {
+ // fill with drive names "C:",
...
+ assert(_tcslen(path) <
GlobalSize(medium.UNION_MEMBER(hGlobal)));
+ _tcscpy(pw32fdata->cFileName,
path);
- UINT sem_org =
SetErrorMode(SEM_FAILCRITICALERRORS);
+ UINT sem_org =
SetErrorMode(SEM_FAILCRITICALERRORS);
- if (GetFileAttributesEx(path,
GetFileExInfoStandard, &fad)) {
- pw32fdata->dwFileAttributes =
fad.dwFileAttributes;
- pw32fdata->ftCreationTime =
fad.ftCreationTime;
- pw32fdata->ftLastAccessTime =
fad.ftLastAccessTime;
- pw32fdata->ftLastWriteTime =
fad.ftLastWriteTime;
+ if (GetFileAttributesEx(path,
GetFileExInfoStandard, &fad)) {
+
pw32fdata->dwFileAttributes = fad.dwFileAttributes;
+
pw32fdata->ftCreationTime = fad.ftCreationTime;
+
pw32fdata->ftLastAccessTime = fad.ftLastAccessTime;
+
pw32fdata->ftLastWriteTime = fad.ftLastWriteTime;
- if (!(fad.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY)) {
- pw32fdata->nFileSizeLow
= fad.nFileSizeLow;
- pw32fdata->nFileSizeHigh
= fad.nFileSizeHigh;
+ if
(!(fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+
pw32fdata->nFileSizeLow = fad.nFileSizeLow;
+
pw32fdata->nFileSizeHigh = fad.nFileSizeHigh;
+ }
}
- }
- HANDLE hFile = CreateFile(path,
GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-
0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
+ HANDLE hFile = CreateFile(path,
GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+
0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
- if (hFile != INVALID_HANDLE_VALUE) {
- if
(GetFileInformationByHandle(hFile, pbhfi))
- bhfi_valid = true;
+ if (hFile !=
INVALID_HANDLE_VALUE) {
+ if
(GetFileInformationByHandle(hFile, pbhfi))
+ bhfi_valid =
true;
- CloseHandle(hFile);
- }
+ CloseHandle(hFile);
+ }
- SetErrorMode(sem_org);
+ SetErrorMode(sem_org);
-
GlobalUnlock(medium.UNION_MEMBER(hGlobal));
-
GlobalFree(medium.UNION_MEMBER(hGlobal));
+
GlobalUnlock(medium.UNION_MEMBER(hGlobal));
+
GlobalFree(medium.UNION_MEMBER(hGlobal));
+ }
}
}
}
@@ -322,13 +324,13 @@
if (w32fd.dwFileAttributes &
FILE_ATTRIBUTE_DIRECTORY)
entry->_icon_id = ICID_FOLDER;
- else if (scan_flags &
SCAN_EXTRACT_ICONS)
+/* else if (scan_flags &
SCAN_EXTRACT_ICONS)
try {
- entry->extract_icon();
+
entry->extract_icon(big_icons);
} catch(COMException&) {
// ignore unexpected
exceptions while extracting icons
}
-
+*/
last = entry;
} while(FindNextFile(hFind, &w32fd));
@@ -428,13 +430,13 @@
// get icons for files and
virtual objects
if
(!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
!(attribs &
SFGAO_FILESYSTEM)) {
- if (scan_flags &
SCAN_EXTRACT_ICONS)
+/* if (scan_flags &
SCAN_EXTRACT_ICONS)
try {
-
entry->extract_icon();
+
entry->extract_icon(big_icons);
}
catch(COMException&) {
//
ignore unexpected exceptions while extracting icons
}
- } else if
(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+*/ } else if
(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
entry->_icon_id =
ICID_FOLDER;
else
entry->_icon_id =
ICID_NONE; // don't try again later
@@ -486,13 +488,13 @@
return NULL;
}
-int ShellDirectory::extract_icons()
+int ShellDirectory::extract_icons(bool big_icons)
{
int cnt = 0;
for(Entry*entry=_down; entry; entry=entry->_next)
if (entry->_icon_id == ICID_UNKNOWN) {
- entry->extract_icon();
+ entry->extract_icon(big_icons);
if (entry->_icon_id != ICID_NONE)
++cnt;
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.h
--- trunk/reactos/subsys/system/explorer/shell/shellfs.h
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/shell/shellfs.h
2005-11-04 00:21:12 UTC (rev 18983)
@@ -105,7 +105,7 @@
virtual bool get_path(PTSTR path, size_t path_count) const;
- int extract_icons();
+ int extract_icons(bool big_icons);
ShellFolder _folder;
HWND _hwnd;
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -161,7 +161,7 @@
RegisterHotkeys();
// prepare Startmenu, but hide it for now
- _startMenuRoot = GET_WINDOW(StartMenuRoot,
StartMenuRoot::Create(_hwnd));
+ _startMenuRoot = GET_WINDOW(StartMenuRoot,
StartMenuRoot::Create(_hwnd, true)); //@@ _big_icons
return 0;
}
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -105,7 +105,15 @@
RecursiveCreateDirectory(path);
_dir = new ShellDirectory(GetDesktopFolder(), path,
_hwnd);
- _dir->smart_scan(SORT_NAME,
SCAN_EXTRACT_ICONS|SCAN_FILESYSTEM);
+ _dir->smart_scan(SORT_NAME,
/*SCAN_EXTRACT_ICONS|*/SCAN_FILESYSTEM);
+
+ // immediatelly extract the shortcut icons
+ for(Entry*entry=_dir->_down; entry; entry=entry->_next)
+ try {
+ entry->extract_icon(false);
+ } catch(COMException&) {
+ // ignore unexpected exceptions while
extracting icons
+ }
} catch(COMException&) {
return;
}
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
2005-11-04 00:21:12 UTC (rev 18983)
@@ -46,8 +46,9 @@
#define SHELLPATH_NET_CONNECTIONS
TEXT("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2
DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")
-StartMenu::StartMenu(HWND hwnd)
- : super(hwnd)
+StartMenu::StartMenu(HWND hwnd, bool big_icons)
+ : super(hwnd),
+ _big_icons(big_icons)
{
_next_id = IDC_FIRST_MENU;
_submenu_id = 0;
@@ -69,9 +70,10 @@
#endif
}
-StartMenu::StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info)
+StartMenu::StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info,
bool big_icons)
: super(hwnd),
- _create_info(create_info)
+ _create_info(create_info),
+ _big_icons(big_icons)
{
for(StartMenuFolders::const_iterator
it=create_info._folders.begin(); it!=create_info._folders.end(); ++it)
if (*it)
@@ -115,7 +117,8 @@
Window::CREATORFUNC_INFO StartMenu::s_def_creator =
STARTMENU_CREATOR(StartMenu);
-HWND StartMenu::Create(int x, int y, const StartMenuFolders& folders,
HWND hwndParent, LPCTSTR title, CREATORFUNC_INFO creator, void* info,
const String& filter)
+HWND StartMenu::Create(int x, int y, const StartMenuFolders& folders,
HWND hwndParent, LPCTSTR title, bool parent_big_icons,
+ CREATORFUNC_INFO
creator, void* info, const String& filter)
{
UINT style, ex_style;
int top_height;
@@ -130,6 +133,7 @@
top_height = 0;
}
+ bool big_icons = false;
RECT rect = {x, y-STARTMENU_LINE_HEIGHT-top_height,
x+STARTMENU_WIDTH_MIN, y};
#ifndef _LIGHT_STARTMENU
@@ -344,7 +348,7 @@
WindowRect pos(_hwnd);
///@todo do something similar to
StartMenuRoot::TrackStartmenu() in order to automatically close submenus
when clicking on the desktop background
- StartMenu::Create(pos.left+3, pos.bottom-3,
_create_info._folders, 0, _create_info._title, _create_info._creator,
_create_info._info);
+ StartMenu::Create(pos.left+3, pos.bottom-3,
_create_info._folders, 0, _create_info._title, _big_icons,
_create_info._creator, _create_info._info);
CloseStartMenu();
}
@@ -511,6 +515,7 @@
int StartMenu::ButtonHitTest(POINT pt)
{
ClientRect clnt(_hwnd);
+ const bool big_icons = _big_icons;
RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
if (pt.x<rect.left || pt.x>rect.right)
@@ -542,6 +547,7 @@
return;
ClientRect clnt(_hwnd);
+ const bool big_icons = _big_icons;
RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos;
it!=_buttons.end(); ++it) {
@@ -767,6 +773,7 @@
{
#ifdef _LIGHT_STARTMENU
ClientRect clnt(_hwnd);
+ const bool big_icons = _big_icons;
RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos;
it!=_buttons.end(); ++it) {
@@ -816,15 +823,18 @@
}
-void StartMenu::DrawArrows(HDC hdc)
+void StartMenu::DrawArrows(HDC hdc, bool big_icons)
{
- static ResIconEx arrowUpIcon(IDI_ARROW_UP, 8, 4);
- static ResIconEx arrowDownIcon(IDI_ARROW_DOWN, 8, 4);
+ int cx = big_icons? 16: 8;
+ int cy = big_icons? 8: 4;
+ ResIconEx arrowUpIcon(IDI_ARROW_UP, cx, cy);
+ ResIconEx arrowDownIcon(IDI_ARROW_DOWN, cx, cy);
+
ClientRect clnt(_hwnd);
- DrawIconEx(hdc, clnt.right/2-4, _floating_btn?3:1, arrowUpIcon,
8, 4, 0, 0, DI_NORMAL);
- DrawIconEx(hdc, clnt.right/2-4, clnt.bottom-5, arrowDownIcon, 8,
4, 0, 0, DI_NORMAL);
+ DrawIconEx(hdc, clnt.right/2-cx/2, _floating_btn?3:1,
arrowUpIcon, cx, cy, 0, 0, DI_NORMAL);
+ DrawIconEx(hdc, clnt.right/2-cx/2, clnt.bottom-cy-1,
arrowDownIcon, cx, cy, 0, 0, DI_NORMAL);
}
void StartMenu::GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down)
@@ -852,9 +862,10 @@
#ifdef _LIGHT_STARTMENU
if (_arrow_btns)
- DrawArrows(canvas);
+ DrawArrows(canvas, _big_icons);
ClientRect clnt(_hwnd);
+ const bool big_icons = _big_icons;
RECT rect = {_border_left, _border_top, clnt.right,
STARTMENU_LINE_HEIGHT};
int sep_width = rect.right-rect.left - 4;
@@ -886,7 +897,7 @@
break;
if (rect.top >= canvas.rcPaint.top)
- DrawStartMenuButton(canvas, rect,
btn._title, btn, btn._id==_selected_id, false);
+ DrawStartMenuButton(canvas, rect,
btn._title, btn, btn._id==_selected_id, false, _big_icons);
}
rect.top = rect.bottom;
@@ -917,7 +928,7 @@
if (entry->_icon_id == ICID_UNKNOWN)
try {
- entry->extract_icon();
+
entry->extract_icon(_big_icons);
} catch(COMException&) {
// ignore unexpected
exceptions while extracting icons
}
@@ -933,7 +944,7 @@
break;
WindowCanvas canvas(_hwnd);
- DrawStartMenuButton(canvas,
rect, NULL, btn, btn._id==_selected_id, false);
+ DrawStartMenuButton(canvas,
rect, NULL, btn, btn._id==_selected_id, false, _big_icons);
//InvalidateRect(_hwnd, &rect,
FALSE);
//UpdateWindow(_hwnd);
@@ -1134,7 +1145,7 @@
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
// widen window, if it is too small
- int text_width = GetStartMenuBtnTextWidth(canvas, title, _hwnd)
+ 16/*icon*/ + 10/*placeholder*/ + 16/*arrow*/;
+ int text_width = GetStartMenuBtnTextWidth(canvas, title, _hwnd)
+ ICON_SIZE_X + 10/*placeholder*/ + 16/*arrow*/;
int cx = clnt.right - _border_left;
if (text_width > cx)
@@ -1252,6 +1263,7 @@
ClientToScreen(_hwnd, &rect);
x = rect.right; // Submenus should overlap their parent
a bit.
+ const bool big_icons = _big_icons;
y = rect.top+STARTMENU_LINE_HEIGHT +_border_top/*own
border*/ -STARTMENU_TOP_BTN_SPACE/*border of new submenu*/;
} else {
WindowRect pos(_hwnd);
@@ -1261,7 +1273,7 @@
}
_submenu_id = id;
- _submenu = StartMenu::Create(x, y, new_folders, _hwnd, title,
creator, info, _create_info._filter);
+ _submenu = StartMenu::Create(x, y, new_folders, _hwnd, title,
_big_icons, creator, info, _create_info._filter);
}
@@ -1353,10 +1365,10 @@
}
#ifdef _LIGHT_STARTMENU
-void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title,
const SMBtnInfo& btn, bool has_focus, bool pushed)
+void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title,
const SMBtnInfo& btn, bool has_focus, bool pushed, bool big_icons)
#else
void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR title,
HICON hIcon,
- bool
hasSubmenu, bool enabled, bool has_focus, bool pushed);
+ bool
hasSubmenu, bool enabled, bool has_focus, bool pushed, bool big_icons);
#endif
{
UINT style = DFCS_BUTTONPUSH;
@@ -1364,8 +1376,8 @@
if (!btn._enabled)
style |= DFCS_INACTIVE;
- POINT iconPos = {rect.left+2, (rect.top+rect.bottom-16)/2};
- RECT textRect = {rect.left+16+4, rect.top+2, rect.right-4,
rect.bottom-4};
+ POINT iconPos = {rect.left+2,
(rect.top+rect.bottom-ICON_SIZE_Y)/2};
+ RECT textRect = {rect.left+ICON_SIZE_X+4, rect.top+2,
rect.right-4, rect.bottom-4};
if (pushed) {
style |= DFCS_PUSHED;
@@ -1389,16 +1401,16 @@
FillRect(hdc, &rect, bk_brush);
if (btn._icon_id > ICID_NONE)
- g_Globals._icon_cache.get_icon(btn._icon_id).draw(hdc,
iconPos.x, iconPos.y, 16, 16, bk_color, bk_brush);
+ g_Globals._icon_cache.get_icon(btn._icon_id).draw(hdc,
iconPos.x, iconPos.y, ICON_SIZE_X, ICON_SIZE_Y, bk_color, bk_brush/*,
big_icons*/);
// draw submenu arrow at the right
if (btn._hasSubmenu) {
- static SmallIcon arrowIcon(IDI_ARROW);
- static SmallIcon selArrowIcon(IDI_ARROW_SELECTED);
+ ResIconEx arrowIcon(IDI_ARROW, ICON_SIZE_X,
ICON_SIZE_Y);
+ ResIconEx selArrowIcon(IDI_ARROW_SELECTED, ICON_SIZE_X,
ICON_SIZE_Y);
- DrawIconEx(hdc, rect.right-16, iconPos.y,
+ DrawIconEx(hdc, rect.right-ICON_SIZE_X, iconPos.y,
has_focus? selArrowIcon:
arrowIcon,
- 16, 16, 0, bk_brush, DI_NORMAL);
+ ICON_SIZE_X, ICON_SIZE_Y, 0,
bk_brush, DI_NORMAL);
}
if (title) {
@@ -1423,6 +1435,8 @@
WindowCanvas canvas(_hwnd);
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
+ const bool big_icons = _big_icons;
+
int max_width = STARTMENU_WIDTH_MIN;
int height = 0;
@@ -1439,7 +1453,7 @@
}
// calculate new window size
- int text_width = max_width + 16/*icon*/ + 10/*placeholder*/ +
16/*arrow*/;
+ int text_width = max_width + ICON_SIZE_X + 10/*placeholder*/ +
16/*arrow*/;
RECT rt_hgt = {rect.left, rect.bottom-_border_top-height,
rect.left+_border_left+text_width, rect.bottom};
AdjustWindowRectEx(&rt_hgt, GetWindowStyle(_hwnd), FALSE,
GetWindowExStyle(_hwnd));
@@ -1529,7 +1543,7 @@
StartMenuRoot::StartMenuRoot(HWND hwnd)
- : super(hwnd)
+ : super(hwnd, true) ///@todo big icons in start menu root
{
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of
29.10.2003)
if (!g_Globals._SHRestricted ||
!SHRestricted(REST_NOCOMMONGROUPS))
@@ -1566,7 +1580,7 @@
}
-static void CalculateStartPos(HWND hwndOwner, RECT& rect)
+static void CalculateStartPos(HWND hwndOwner, RECT& rect, bool
big_icons)
{
WindowRect pos(hwndOwner);
@@ -1582,11 +1596,11 @@
AdjustWindowRectEx(&rect,
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE, FALSE, 0);
}
-HWND StartMenuRoot::Create(HWND hwndOwner)
+HWND StartMenuRoot::Create(HWND hwndOwner, bool big_icons)
{
RECT rect;
- CalculateStartPos(hwndOwner, rect);
+ CalculateStartPos(hwndOwner, rect, big_icons);
return Window::Create(WINDOW_CREATOR(StartMenuRoot), 0,
GetWndClasss(), TITLE_STARTMENU,
WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN,
@@ -1607,7 +1621,7 @@
// recalculate start menu root position
RECT rect;
- CalculateStartPos(GetParent(hwnd), rect);
+ CalculateStartPos(GetParent(hwnd), rect, _big_icons);
SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right-rect.left,
rect.bottom-rect.top, 0);
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
--- trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
2005-11-04 00:20:17 UTC (rev 18982)
+++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.h
2005-11-04 00:21:12 UTC (rev 18983)
@@ -36,7 +36,7 @@
#define STARTMENU_WIDTH_MIN 120
-#define STARTMENU_LINE_HEIGHT 20
+#define STARTMENU_LINE_HEIGHT (ICON_SIZE_X+4)
#define STARTMENU_SEP_HEIGHT (STARTMENU_LINE_HEIGHT/2)
#define STARTMENU_TOP_BTN_SPACE 8
@@ -187,12 +187,12 @@
typedef vector<SMBtnInfo> SMBtnVector;
-extern void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR
title, const SMBtnInfo& btn, bool has_focus, bool pushed);
+extern void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR
title, const SMBtnInfo& btn, bool has_focus, bool pushed, bool
big_icons);
#else
extern void DrawStartMenuButton(HDC hdc, const RECT& rect, LPCTSTR
title, HICON hIcon,
- bool
hasSubmenu, bool enabled, bool has_focus, bool pushed);
+ bool
hasSubmenu, bool enabled, bool has_focus, bool pushed, bool big_icons);
#endif
@@ -214,11 +214,11 @@
typedef ExtContextMenuHandlerT<OwnerDrawParent<DialogWindow> >
super;
#endif
- StartMenu(HWND hwnd);
- StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info);
+ StartMenu(HWND hwnd, bool big_icons=false);
+ StartMenu(HWND hwnd, const StartMenuCreateInfo& create_info,
bool big_icons=false);
~StartMenu();
- static HWND Create(int x, int y, const StartMenuFolders&, HWND
hwndParent, LPCTSTR title,
+ static HWND Create(int x, int y, const StartMenuFolders&, HWND
hwndParent, LPCTSTR title, bool parent_big_icons,
CREATORFUNC_INFO
creator=s_def_creator, void* info=NULL, const String& filter="");
static CREATORFUNC_INFO s_def_creator;
@@ -253,6 +253,8 @@
StartMenuCreateInfo _create_info; // copy of the original
create info
+ bool _big_icons;
+
#ifdef _LIGHT_STARTMENU
SMBtnVector _buttons;
int _selected_id;
@@ -301,7 +303,7 @@
void GetFloatingButtonRect(LPRECT prect);
void GetArrowButtonRects(LPRECT prect_up, LPRECT prect_down);
- void DrawArrows(HDC hdc);
+ void DrawArrows(HDC hdc, bool big_icons);
void Paint(PaintCanvas& canvas);
void UpdateIcons(/*int idx*/);
@@ -336,13 +338,13 @@
{
typedef StartMenu super;
- StartMenuHandler(HWND hwnd)
- : super(hwnd)
+ StartMenuHandler(HWND hwnd, bool big_icons=false)
+ : super(hwnd, big_icons)
{
}
- StartMenuHandler(HWND hwnd, const StartMenuCreateInfo&
create_info)
- : super(hwnd, create_info)
+ StartMenuHandler(HWND hwnd, const StartMenuCreateInfo&
create_info, bool big_icons=false)
+ : super(hwnd, create_info, big_icons)
{
}
@@ -363,7 +365,7 @@
StartMenuRoot(HWND hwnd);
- static HWND Create(HWND hwndDesktopBar);
+ static HWND Create(HWND hwndDesktopBar, bool big_icons);
void TrackStartmenu();
protected: